linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: staging: max96712: Constify static v4l2_subdev_ops
@ 2021-11-27  9:49 Rikard Falkeborn
  2021-11-27 14:02 ` Niklas Söderlund
  2021-11-27 19:48 ` Kieran Bingham
  0 siblings, 2 replies; 3+ messages in thread
From: Rikard Falkeborn @ 2021-11-27  9:49 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab
  Cc: Greg Kroah-Hartman, linux-media, linux-staging, linux-kernel,
	Rikard Falkeborn

The only usage of max96712_subdev_ops is to pass its address to
v4l2_i2c_subdev_init() which takes a pointer to const struct
v4l2_subdev_ops as argument. Make it const to allow the compiler to put
it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/staging/media/max96712/max96712.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/max96712/max96712.c b/drivers/staging/media/max96712/max96712.c
index 847e2ffd4f53..9bc72d9a858b 100644
--- a/drivers/staging/media/max96712/max96712.c
+++ b/drivers/staging/media/max96712/max96712.c
@@ -250,7 +250,7 @@ static const struct v4l2_subdev_pad_ops max96712_pad_ops = {
 	.set_fmt = max96712_get_pad_format,
 };
 
-static struct v4l2_subdev_ops max96712_subdev_ops = {
+static const struct v4l2_subdev_ops max96712_subdev_ops = {
 	.video = &max96712_video_ops,
 	.pad = &max96712_pad_ops,
 };
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: staging: max96712: Constify static v4l2_subdev_ops
  2021-11-27  9:49 [PATCH] media: staging: max96712: Constify static v4l2_subdev_ops Rikard Falkeborn
@ 2021-11-27 14:02 ` Niklas Söderlund
  2021-11-27 19:48 ` Kieran Bingham
  1 sibling, 0 replies; 3+ messages in thread
From: Niklas Söderlund @ 2021-11-27 14:02 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: Mauro Carvalho Chehab, Greg Kroah-Hartman, linux-media,
	linux-staging, linux-kernel

Hej Rikard,

Tack för din patch, ser bra ut.

On 2021-11-27 10:49:44 +0100, Rikard Falkeborn wrote:
> The only usage of max96712_subdev_ops is to pass its address to
> v4l2_i2c_subdev_init() which takes a pointer to const struct
> v4l2_subdev_ops as argument. Make it const to allow the compiler to put
> it in read-only memory.
> 
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  drivers/staging/media/max96712/max96712.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/max96712/max96712.c b/drivers/staging/media/max96712/max96712.c
> index 847e2ffd4f53..9bc72d9a858b 100644
> --- a/drivers/staging/media/max96712/max96712.c
> +++ b/drivers/staging/media/max96712/max96712.c
> @@ -250,7 +250,7 @@ static const struct v4l2_subdev_pad_ops max96712_pad_ops = {
>  	.set_fmt = max96712_get_pad_format,
>  };
>  
> -static struct v4l2_subdev_ops max96712_subdev_ops = {
> +static const struct v4l2_subdev_ops max96712_subdev_ops = {
>  	.video = &max96712_video_ops,
>  	.pad = &max96712_pad_ops,
>  };
> -- 
> 2.34.1
> 

-- 
Kind Regards,
Niklas Söderlund

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: staging: max96712: Constify static v4l2_subdev_ops
  2021-11-27  9:49 [PATCH] media: staging: max96712: Constify static v4l2_subdev_ops Rikard Falkeborn
  2021-11-27 14:02 ` Niklas Söderlund
@ 2021-11-27 19:48 ` Kieran Bingham
  1 sibling, 0 replies; 3+ messages in thread
From: Kieran Bingham @ 2021-11-27 19:48 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Niklas Söderlund, Rikard Falkeborn
  Cc: Greg Kroah-Hartman, linux-media, linux-staging, linux-kernel,
	Rikard Falkeborn

Hi Richard,

Quoting Rikard Falkeborn (2021-11-27 09:49:44)
> The only usage of max96712_subdev_ops is to pass its address to
> v4l2_i2c_subdev_init() which takes a pointer to const struct
> v4l2_subdev_ops as argument. Make it const to allow the compiler to put
> it in read-only memory.
> 
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>

Yes, Good spot.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> ---
>  drivers/staging/media/max96712/max96712.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/max96712/max96712.c b/drivers/staging/media/max96712/max96712.c
> index 847e2ffd4f53..9bc72d9a858b 100644
> --- a/drivers/staging/media/max96712/max96712.c
> +++ b/drivers/staging/media/max96712/max96712.c
> @@ -250,7 +250,7 @@ static const struct v4l2_subdev_pad_ops max96712_pad_ops = {
>         .set_fmt = max96712_get_pad_format,
>  };
>  
> -static struct v4l2_subdev_ops max96712_subdev_ops = {
> +static const struct v4l2_subdev_ops max96712_subdev_ops = {
>         .video = &max96712_video_ops,
>         .pad = &max96712_pad_ops,
>  };
> -- 
> 2.34.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-27 19:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27  9:49 [PATCH] media: staging: max96712: Constify static v4l2_subdev_ops Rikard Falkeborn
2021-11-27 14:02 ` Niklas Söderlund
2021-11-27 19:48 ` Kieran Bingham

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).