linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: Sakari Ailus <sakari.ailus@iki.fi>,
	Dave Stevenson <dave.stevenson@raspberrypi.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>
Subject: [PATCH 2/2] v4l2-ioctl.c: use new V4L2_FOURCC_CONV/ARGS macros
Date: Mon, 16 Sep 2019 11:00:47 +0200	[thread overview]
Message-ID: <20190916090047.122078-3-hverkuil-cisco@xs4all.nl> (raw)
In-Reply-To: <20190916090047.122078-1-hverkuil-cisco@xs4all.nl>

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;
 		}
 	}
-- 
2.20.1


  parent reply	other threads:[~2019-09-16  9:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-16  9:00 [PATCH 0/2] Add helper functions to print a fourcc Hans Verkuil
2019-09-16  9:00 ` [PATCH 1/2] videodev2.h: add macros " Hans Verkuil
2019-09-16  9:26   ` Sakari Ailus
2019-09-16  9:31     ` Hans Verkuil
2019-09-16  9:00 ` Hans Verkuil [this message]
2019-09-16  9:27   ` [PATCH 2/2] v4l2-ioctl.c: use new V4L2_FOURCC_CONV/ARGS macros Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190916090047.122078-3-hverkuil-cisco@xs4all.nl \
    --to=hverkuil-cisco@xs4all.nl \
    --cc=dave.stevenson@raspberrypi.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).