2022-09-01 01:29:15

by Jilin Yuan

[permalink] [raw]
Subject: [PATCH] media: v4l2-tpg: Use 'unsigned int' instead of just 'unsigned'.

'unsigned int' should be clearer than 'unsigned'.

Signed-off-by: Jilin Yuan <[email protected]>
---
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index 9b7bcdce6e44..10ed9e65eecc 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -86,7 +86,7 @@ void tpg_set_font(const u8 *f)
}
EXPORT_SYMBOL_GPL(tpg_set_font);

-void tpg_init(struct tpg_data *tpg, unsigned w, unsigned h)
+void tpg_init(struct tpg_data *tpg, unsigned int w, unsigned int h)
{
memset(tpg, 0, sizeof(*tpg));
tpg->scaled_width = tpg->src_width = w;
@@ -109,15 +109,15 @@ void tpg_init(struct tpg_data *tpg, unsigned w, unsigned h)
}
EXPORT_SYMBOL_GPL(tpg_init);

-int tpg_alloc(struct tpg_data *tpg, unsigned max_w)
+int tpg_alloc(struct tpg_data *tpg, unsigned int max_w)
{
- unsigned pat;
- unsigned plane;
+ unsigned int pat;
+ unsigned int plane;

tpg->max_line_width = max_w;
for (pat = 0; pat < TPG_MAX_PAT_LINES; pat++) {
for (plane = 0; plane < TPG_MAX_PLANES; plane++) {
- unsigned pixelsz = plane ? 2 : 4;
+ unsigned int pixelsz = plane ? 2 : 4;

tpg->lines[pat][plane] =
vzalloc(array3_size(max_w, 2, pixelsz));
@@ -132,7 +132,7 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w)
}
}
for (plane = 0; plane < TPG_MAX_PLANES; plane++) {
- unsigned pixelsz = plane ? 2 : 4;
+ unsigned int pixelsz = plane ? 2 : 4;

tpg->contrast_line[plane] =
vzalloc(array_size(pixelsz, max_w));
@@ -153,8 +153,8 @@ EXPORT_SYMBOL_GPL(tpg_alloc);

void tpg_free(struct tpg_data *tpg)
{
- unsigned pat;
- unsigned plane;
+ unsigned int pat;
+ unsigned int plane;

for (pat = 0; pat < TPG_MAX_PAT_LINES; pat++)
for (plane = 0; plane < TPG_MAX_PLANES; plane++) {
--
2.36.1


2022-09-01 07:18:28

by Hans Verkuil

[permalink] [raw]
Subject: Re: [PATCH] media: v4l2-tpg: Use 'unsigned int' instead of just 'unsigned'.

Hi Jilin,

On 9/1/22 03:11, Jilin Yuan wrote:
> 'unsigned int' should be clearer than 'unsigned'.
>
> Signed-off-by: Jilin Yuan <[email protected]>
> ---
> drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)

I don't get it, just 8 changes? If I do a 'git grep unsigned drivers/media/common/v4l2-tpg'
I get 128 hits, and include/media/tpg/v4l2-tpg.h has another 52.

What's the point of changing just a few of these instances instead of doing
them all?

In any case, patches like this just create a lot of noise and take away too
much code reviewer bandwidth for very little gain.

Speaking for the media subsystem I will reject patches like this, it's not
worth the effort.

Regards,

Hans

>
> diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> index 9b7bcdce6e44..10ed9e65eecc 100644
> --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> @@ -86,7 +86,7 @@ void tpg_set_font(const u8 *f)
> }
> EXPORT_SYMBOL_GPL(tpg_set_font);
>
> -void tpg_init(struct tpg_data *tpg, unsigned w, unsigned h)
> +void tpg_init(struct tpg_data *tpg, unsigned int w, unsigned int h)
> {
> memset(tpg, 0, sizeof(*tpg));
> tpg->scaled_width = tpg->src_width = w;
> @@ -109,15 +109,15 @@ void tpg_init(struct tpg_data *tpg, unsigned w, unsigned h)
> }
> EXPORT_SYMBOL_GPL(tpg_init);
>
> -int tpg_alloc(struct tpg_data *tpg, unsigned max_w)
> +int tpg_alloc(struct tpg_data *tpg, unsigned int max_w)
> {
> - unsigned pat;
> - unsigned plane;
> + unsigned int pat;
> + unsigned int plane;
>
> tpg->max_line_width = max_w;
> for (pat = 0; pat < TPG_MAX_PAT_LINES; pat++) {
> for (plane = 0; plane < TPG_MAX_PLANES; plane++) {
> - unsigned pixelsz = plane ? 2 : 4;
> + unsigned int pixelsz = plane ? 2 : 4;
>
> tpg->lines[pat][plane] =
> vzalloc(array3_size(max_w, 2, pixelsz));
> @@ -132,7 +132,7 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w)
> }
> }
> for (plane = 0; plane < TPG_MAX_PLANES; plane++) {
> - unsigned pixelsz = plane ? 2 : 4;
> + unsigned int pixelsz = plane ? 2 : 4;
>
> tpg->contrast_line[plane] =
> vzalloc(array_size(pixelsz, max_w));
> @@ -153,8 +153,8 @@ EXPORT_SYMBOL_GPL(tpg_alloc);
>
> void tpg_free(struct tpg_data *tpg)
> {
> - unsigned pat;
> - unsigned plane;
> + unsigned int pat;
> + unsigned int plane;
>
> for (pat = 0; pat < TPG_MAX_PAT_LINES; pat++)
> for (plane = 0; plane < TPG_MAX_PLANES; plane++) {