Message ID | 20190916090047.122078-3-hverkuil-cisco@xs4all.nl (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add helper functions to print a fourcc | expand |
On Mon, Sep 16, 2019 at 11:00:47AM +0200, Hans Verkuil wrote: > Use these new standard macros to log the fourcc value in a > human readable format. > > Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> > --- > drivers/media/v4l2-core/v4l2-ioctl.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > index 51b912743f0f..80030533e1b8 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1383,12 +1383,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > return; > WARN(1, "Unknown pixelformat 0x%08x\n", fmt->pixelformat); > flags = 0; > - snprintf(fmt->description, sz, "%c%c%c%c%s", > - (char)(fmt->pixelformat & 0x7f), > - (char)((fmt->pixelformat >> 8) & 0x7f), > - (char)((fmt->pixelformat >> 16) & 0x7f), > - (char)((fmt->pixelformat >> 24) & 0x7f), > - (fmt->pixelformat & (1UL << 31)) ? "-BE" : ""); > + snprintf(fmt->description, sz, V4L2_FOURCC_CONV, > + V4L2_FOURCC_ARGS(fmt->pixelformat)); > break; > } > } Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 51b912743f0f..80030533e1b8 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1383,12 +1383,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) return; WARN(1, "Unknown pixelformat 0x%08x\n", fmt->pixelformat); flags = 0; - snprintf(fmt->description, sz, "%c%c%c%c%s", - (char)(fmt->pixelformat & 0x7f), - (char)((fmt->pixelformat >> 8) & 0x7f), - (char)((fmt->pixelformat >> 16) & 0x7f), - (char)((fmt->pixelformat >> 24) & 0x7f), - (fmt->pixelformat & (1UL << 31)) ? "-BE" : ""); + snprintf(fmt->description, sz, V4L2_FOURCC_CONV, + V4L2_FOURCC_ARGS(fmt->pixelformat)); break; } }
Use these new standard macros to log the fourcc value in a human readable format. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> --- drivers/media/v4l2-core/v4l2-ioctl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)