2020-04-27 08:09:30

by 赵军奎

[permalink] [raw]
Subject: [PATCH] drivers/video: cleanup coding style in video a bit

Eliminate the magic numbers, add vender infoframe size macro
like other hdmi modules.

Signed-off-by: Bernard Zhao <[email protected]>
---
drivers/video/hdmi.c | 2 +-
include/linux/hdmi.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
index 856a8c4e84a2..f693076f2e5f 100644
--- a/drivers/video/hdmi.c
+++ b/drivers/video/hdmi.c
@@ -495,7 +495,7 @@ int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame)
* value
*/
frame->s3d_struct = HDMI_3D_STRUCTURE_INVALID;
- frame->length = 4;
+ frame->length = HDMI_VENDOR_INFOFRAME_SIZE;

return 0;
}
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 9613d796cfb1..ff25aeb95ee4 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -57,6 +57,7 @@ enum hdmi_infoframe_type {
#define HDMI_SPD_INFOFRAME_SIZE 25
#define HDMI_AUDIO_INFOFRAME_SIZE 10
#define HDMI_DRM_INFOFRAME_SIZE 26
+#define HDMI_VENDOR_INFOFRAME_SIZE 4

#define HDMI_INFOFRAME_SIZE(type) \
(HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE)
--
2.26.2


2020-04-27 08:38:24

by Markus Elfring

[permalink] [raw]
Subject: Re: [PATCH] drivers/video: cleanup coding style in video a bit

> Eliminate the magic numbers, add vender infoframe size macro
> like other hdmi modules.

How do you think about a wording variant like the following?

Subject:
[PATCH v2] video/hdmi: Use “HDMI_VENDOR_INFOFRAME_SIZE” in hdmi_vendor_infoframe_init()

Change description:
Adjust the usage of a “magic” number here by adding a macro for
the vendor info frame size (similar to other video modules).


Regards,
Markus

2020-05-08 01:55:22

by 赵军奎

[permalink] [raw]
Subject: Re:[PATCH] drivers/video: cleanup coding style in video a bit


From: Bernard Zhao <[email protected]>
Date: 2020-04-27 16:05:23
To: Bartlomiej Zolnierkiewicz <[email protected]>,Uma Shankar <[email protected]>,"Ville Syrjälä" <[email protected]>,Shashank Sharma <[email protected]>,Laurent Pinchart <[email protected]>,Daniel Vetter <[email protected]>,Bernard Zhao <[email protected]>,[email protected],[email protected],[email protected]
Cc: [email protected]
Subject: [PATCH] drivers/video: cleanup coding style in video a bit>Eliminate the magic numbers, add vender infoframe size macro
>like other hdmi modules.
>
>Signed-off-by: Bernard Zhao <[email protected]>
>---
> drivers/video/hdmi.c | 2 +-
> include/linux/hdmi.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
>index 856a8c4e84a2..f693076f2e5f 100644
>--- a/drivers/video/hdmi.c
>+++ b/drivers/video/hdmi.c
>@@ -495,7 +495,7 @@ int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame)
> * value
> */
> frame->s3d_struct = HDMI_3D_STRUCTURE_INVALID;
>- frame->length = 4;
>+ frame->length = HDMI_VENDOR_INFOFRAME_SIZE;
>
> return 0;
> }
>diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
>index 9613d796cfb1..ff25aeb95ee4 100644
>--- a/include/linux/hdmi.h
>+++ b/include/linux/hdmi.h
>@@ -57,6 +57,7 @@ enum hdmi_infoframe_type {
> #define HDMI_SPD_INFOFRAME_SIZE 25
> #define HDMI_AUDIO_INFOFRAME_SIZE 10
> #define HDMI_DRM_INFOFRAME_SIZE 26
>+#define HDMI_VENDOR_INFOFRAME_SIZE 4
>
> #define HDMI_INFOFRAME_SIZE(type) \
> (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE)
>--
>2.26.2
>


Subject: Re: [PATCH] drivers/video: cleanup coding style in video a bit


On 4/27/20 10:05 AM, Bernard Zhao wrote:
> Eliminate the magic numbers, add vender infoframe size macro
> like other hdmi modules.
>
> Signed-off-by: Bernard Zhao <[email protected]>

Applied to drm-misc-next tree (patch should show up in v5.9), thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> ---
> drivers/video/hdmi.c | 2 +-
> include/linux/hdmi.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
> index 856a8c4e84a2..f693076f2e5f 100644
> --- a/drivers/video/hdmi.c
> +++ b/drivers/video/hdmi.c
> @@ -495,7 +495,7 @@ int hdmi_vendor_infoframe_init(struct hdmi_vendor_infoframe *frame)
> * value
> */
> frame->s3d_struct = HDMI_3D_STRUCTURE_INVALID;
> - frame->length = 4;
> + frame->length = HDMI_VENDOR_INFOFRAME_SIZE;
>
> return 0;
> }
> diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
> index 9613d796cfb1..ff25aeb95ee4 100644
> --- a/include/linux/hdmi.h
> +++ b/include/linux/hdmi.h
> @@ -57,6 +57,7 @@ enum hdmi_infoframe_type {
> #define HDMI_SPD_INFOFRAME_SIZE 25
> #define HDMI_AUDIO_INFOFRAME_SIZE 10
> #define HDMI_DRM_INFOFRAME_SIZE 26
> +#define HDMI_VENDOR_INFOFRAME_SIZE 4
>
> #define HDMI_INFOFRAME_SIZE(type) \
> (HDMI_INFOFRAME_HEADER_SIZE + HDMI_ ## type ## _INFOFRAME_SIZE)
>