public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: laurent.pinchart@ideasonboard.com, bingbu.cao@intel.com
Subject: [PATCH 3/3] media: uapi: Use _BITUL macro for assigning bits in u32 fields
Date: Mon,  8 May 2023 12:17:53 +0300	[thread overview]
Message-ID: <20230508091753.80803-4-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20230508091753.80803-1-sakari.ailus@linux.intel.com>

Use _BITUL macro for assigning bits in u32 fields. While this is a good
practice, there doesn't appear to be a bug that this patch would fix. For
multi-bit fields, use U notation (for unsigned int).

The patch has been generated using the following command:

	perl -i -pe 's/\([0-9]+\K <</U <</g;
		s/\(1U\s*<<\s*([0-9]+)\)$/_BITUL($1)/
			if ! /MEDIA_LNK_FL_INTERFACE_LINK/
		s/\|\s*0\K\)/U\)/' --
		include/uapi/linux/media.h

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 include/uapi/linux/media.h | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index 3ddadaea849f..370d0135780a 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -140,11 +140,11 @@ struct media_device_info {
 #define MEDIA_ENT_F_DV_ENCODER			(MEDIA_ENT_F_BASE + 0x6002)
 
 /* Entity flags */
-#define MEDIA_ENT_FL_DEFAULT			(1 << 0)
-#define MEDIA_ENT_FL_CONNECTOR			(1 << 1)
+#define MEDIA_ENT_FL_DEFAULT			_BITUL(0)
+#define MEDIA_ENT_FL_CONNECTOR			_BITUL(1)
 
 /* OR with the entity id value to find the next entity */
-#define MEDIA_ENT_ID_FLAG_NEXT			(1U << 31)
+#define MEDIA_ENT_ID_FLAG_NEXT			_BITUL(31)
 
 struct media_entity_desc {
 	__u32 id;
@@ -205,9 +205,9 @@ struct media_entity_desc {
 	};
 };
 
-#define MEDIA_PAD_FL_SINK			(1 << 0)
-#define MEDIA_PAD_FL_SOURCE			(1 << 1)
-#define MEDIA_PAD_FL_MUST_CONNECT		(1 << 2)
+#define MEDIA_PAD_FL_SINK			_BITUL(0)
+#define MEDIA_PAD_FL_SOURCE			_BITUL(1)
+#define MEDIA_PAD_FL_MUST_CONNECT		_BITUL(2)
 
 struct media_pad_desc {
 	__u32 entity;		/* entity ID */
@@ -216,14 +216,14 @@ struct media_pad_desc {
 	__u32 reserved[2];
 };
 
-#define MEDIA_LNK_FL_ENABLED			(1 << 0)
-#define MEDIA_LNK_FL_IMMUTABLE			(1 << 1)
-#define MEDIA_LNK_FL_DYNAMIC			(1 << 2)
+#define MEDIA_LNK_FL_ENABLED			_BITUL(0)
+#define MEDIA_LNK_FL_IMMUTABLE			_BITUL(1)
+#define MEDIA_LNK_FL_DYNAMIC			_BITUL(2)
 
 #define MEDIA_LNK_FL_LINK_TYPE			(0xf << 28)
-#  define MEDIA_LNK_FL_DATA_LINK		(0 << 28)
-#  define MEDIA_LNK_FL_INTERFACE_LINK		(1 << 28)
-#  define MEDIA_LNK_FL_ANCILLARY_LINK		(2 << 28)
+#  define MEDIA_LNK_FL_DATA_LINK		(0U << 28)
+#  define MEDIA_LNK_FL_INTERFACE_LINK		(1U << 28)
+#  define MEDIA_LNK_FL_ANCILLARY_LINK		(2U << 28)
 
 struct media_link_desc {
 	struct media_pad_desc source;
@@ -293,7 +293,7 @@ struct media_links_enum {
  * struct media_device_info.
  */
 #define MEDIA_V2_ENTITY_HAS_FLAGS(media_version) \
-	((media_version) >= ((4 << 16) | (19 << 8) | 0))
+	((media_version) >= ((4U << 16) | (19U << 8) | 0U))
 
 struct media_v2_entity {
 	__u32 id;
@@ -328,7 +328,7 @@ struct media_v2_interface {
  * struct media_device_info.
  */
 #define MEDIA_V2_PAD_HAS_INDEX(media_version) \
-	((media_version) >= ((4 << 16) | (19 << 8) | 0))
+	((media_version) >= ((4U << 16) | (19U << 8) | 0U))
 
 struct media_v2_pad {
 	__u32 id;
@@ -432,7 +432,7 @@ struct media_v2_topology {
 #define MEDIA_INTF_T_ALSA_TIMER                (MEDIA_INTF_T_ALSA_BASE + 7)
 
 /* Obsolete symbol for media_version, no longer used in the kernel */
-#define MEDIA_API_VERSION			((0 << 16) | (1 << 8) | 0)
+#define MEDIA_API_VERSION			((0U << 16) | (1U << 8) | 0U)
 
 #endif
 
-- 
2.30.2


  parent reply	other threads:[~2023-05-08  9:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-08  9:17 [PATCH v2 0/3] Random cleanups Sakari Ailus
2023-05-08  9:17 ` [PATCH 1/3] media: mc: Make media_get_pad_index() use pad type flag Sakari Ailus
2023-05-08  9:17 ` [PATCH 2/3] media: Documentation: Rename meta format files Sakari Ailus
2023-05-08  9:17 ` Sakari Ailus [this message]
2023-05-08  9:41   ` [PATCH 3/3] media: uapi: Use _BITUL macro for assigning bits in u32 fields Laurent Pinchart
2023-05-08 11:42   ` kernel test robot
2023-05-08  9:20 ` [PATCH 0/3] Random cleanups 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=20230508091753.80803-4-sakari.ailus@linux.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=bingbu.cao@intel.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    /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