* [PATCH] media: uvcvideo: Make uvc_event_control attribute name array const
@ 2026-08-05 9:34 イムティヤズ
2026-08-06 9:06 ` Ricardo Ribalda
2026-09-29 14:30 ` Hans de Goede
0 siblings, 2 replies; 5+ messages in thread
From: イムティヤズ @ 2026-08-05 9:34 UTC (permalink / raw)
To: laurent.pinchart, hansg
Cc: linux-media, イムティヤズ
The attrs array in uvc_event_control() is only ever read, never
modified. Declare it as static const char *const so the pointer array
itself is also immutable.
Signed-off-by: イムティヤズ <reza1234khan1234@gmail.com>
Assisted-by: opencode:auto/best-free
---
drivers/media/usb/uvc/uvc_status.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c
index b632cf5e3fe9..97c939206302 100644
--- a/drivers/media/usb/uvc/uvc_status.c
+++ b/drivers/media/usb/uvc/uvc_status.c
@@ -165,7 +165,7 @@ static struct uvc_control *uvc_event_find_ctrl(struct uvc_device *dev,
static bool uvc_event_control(struct urb *urb,
const struct uvc_status *status, int len)
{
- static const char *attrs[] = { "value", "info", "failure", "min", "max" };
+ static const char *const attrs[] = { "value", "info", "failure", "min", "max" };
struct uvc_device *dev = urb->context;
struct uvc_video_chain *chain;
struct uvc_control *ctrl;
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] media: uvcvideo: Make uvc_event_control attribute name array const
2026-08-05 9:34 [PATCH] media: uvcvideo: Make uvc_event_control attribute name array const イムティヤズ
@ 2026-08-06 9:06 ` Ricardo Ribalda
2026-08-06 9:45 ` イムティヤズ
2026-09-29 14:30 ` Hans de Goede
1 sibling, 1 reply; 5+ messages in thread
From: Ricardo Ribalda @ 2026-08-06 9:06 UTC (permalink / raw)
To: イムティヤズ
Cc: laurent.pinchart, hansg, linux-media
Hi イムティヤズ
Thanks for the change. Have you checked if there are other variables
that could be constified like this?
Grouping all that family of changes would be more sustainable than
reviewing 10s of similar patches (if that was your plan :))
Thanks
On Wed, 5 Aug 2026 at 11:36, イムティヤズ <reza1234khan1234@gmail.com> wrote:
>
> The attrs array in uvc_event_control() is only ever read, never
> modified. Declare it as static const char *const so the pointer array
> itself is also immutable.
>
> Signed-off-by: イムティヤズ <reza1234khan1234@gmail.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
> Assisted-by: opencode:auto/best-free
> ---
> drivers/media/usb/uvc/uvc_status.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c
> index b632cf5e3fe9..97c939206302 100644
> --- a/drivers/media/usb/uvc/uvc_status.c
> +++ b/drivers/media/usb/uvc/uvc_status.c
> @@ -165,7 +165,7 @@ static struct uvc_control *uvc_event_find_ctrl(struct uvc_device *dev,
> static bool uvc_event_control(struct urb *urb,
> const struct uvc_status *status, int len)
> {
> - static const char *attrs[] = { "value", "info", "failure", "min", "max" };
> + static const char *const attrs[] = { "value", "info", "failure", "min", "max" };
> struct uvc_device *dev = urb->context;
> struct uvc_video_chain *chain;
> struct uvc_control *ctrl;
> --
> 2.55.0
>
>
--
Ricardo Ribalda
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: uvcvideo: Make uvc_event_control attribute name array const
2026-08-06 9:06 ` Ricardo Ribalda
@ 2026-08-06 9:45 ` イムティヤズ
[not found] ` <CANQ=N_CC=Wzzq5XG+a+7K5KDOOHo6Z=xBXWyK8AxYmKOVOY7uw@mail.gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: イムティヤズ @ 2026-08-06 9:45 UTC (permalink / raw)
To: ribalda; +Cc: hansg, laurent.pinchart, linux-media, reza1234khan1234
Hi Ricardo,
Thanks for the review.
I went through the whole uvc driver looking for other variables that
could be constified the same way. The attrs array in uvc_status.c is
the only one of this kind (an array of string pointers). The other
data tables in the driver (exposure_auto_mapping, cros_colorfx_mapping
in uvc_ctrl.c) are already declared const, so there is no remaining
group of changes to batch together.
Thanks,
イムティヤズ
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: uvcvideo: Make uvc_event_control attribute name array const
[not found] ` <CANQ=N_CC=Wzzq5XG+a+7K5KDOOHo6Z=xBXWyK8AxYmKOVOY7uw@mail.gmail.com>
@ 2026-08-10 8:27 ` Ricardo Ribalda
0 siblings, 0 replies; 5+ messages in thread
From: Ricardo Ribalda @ 2026-08-10 8:27 UTC (permalink / raw)
To: Shagor Khan; +Cc: hansg, laurent.pinchart, linux-media
hi Shagor
On Sat, 8 Aug 2026 at 11:16, Shagor Khan <reza1234khan1234@gmail.com> wrote:
>
> hey Ricardo,
>
> sorry to interrupt but it might be that the mail I've previously was left behind, it would be really kind if you see my previous mail about ensuring that there is no variables left that could be constified like that, I would be great if you accept the patch even if it's a very little one, I'd be grateful to become a little kernel contributor :p
Just give it a couple of weeks and if Hans or Laurent like the patch
they will take it.
Regards!
>
> Thanks
>
> On Thu, Aug 6, 2026, 15:45 イムティヤズ <reza1234khan1234@gmail.com> wrote:
>>
>> Hi Ricardo,
>>
>> Thanks for the review.
>>
>> I went through the whole uvc driver looking for other variables that
>> could be constified the same way. The attrs array in uvc_status.c is
>> the only one of this kind (an array of string pointers). The other
>> data tables in the driver (exposure_auto_mapping, cros_colorfx_mapping
>> in uvc_ctrl.c) are already declared const, so there is no remaining
>> group of changes to batch together.
>>
>> Thanks,
>> イムティヤズ
--
Ricardo Ribalda
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: uvcvideo: Make uvc_event_control attribute name array const
2026-08-05 9:34 [PATCH] media: uvcvideo: Make uvc_event_control attribute name array const イムティヤズ
2026-08-06 9:06 ` Ricardo Ribalda
@ 2026-09-29 14:30 ` Hans de Goede
1 sibling, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2026-09-29 14:30 UTC (permalink / raw)
To: イムティヤズ,
laurent.pinchart
Cc: linux-media
Hi,
On 5-Aug-26 11:34, イムティヤズ wrote:
> The attrs array in uvc_event_control() is only ever read, never
> modified. Declare it as static const char *const so the pointer array
> itself is also immutable.
>
> Signed-off-by: イムティヤズ <reza1234khan1234@gmail.com>
> Assisted-by: opencode:auto/best-free
Thank you for your patch.
I have merged this into:
https://gitlab.freedesktop.org/linux-media/users/uvc/-/commits/for-next/
Regards,
Hans
> ---
> drivers/media/usb/uvc/uvc_status.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c
> index b632cf5e3fe9..97c939206302 100644
> --- a/drivers/media/usb/uvc/uvc_status.c
> +++ b/drivers/media/usb/uvc/uvc_status.c
> @@ -165,7 +165,7 @@ static struct uvc_control *uvc_event_find_ctrl(struct uvc_device *dev,
> static bool uvc_event_control(struct urb *urb,
> const struct uvc_status *status, int len)
> {
> - static const char *attrs[] = { "value", "info", "failure", "min", "max" };
> + static const char *const attrs[] = { "value", "info", "failure", "min", "max" };
> struct uvc_device *dev = urb->context;
> struct uvc_video_chain *chain;
> struct uvc_control *ctrl;
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-29 14:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-05 9:34 [PATCH] media: uvcvideo: Make uvc_event_control attribute name array const イムティヤズ
2026-08-06 9:06 ` Ricardo Ribalda
2026-08-06 9:45 ` イムティヤズ
[not found] ` <CANQ=N_CC=Wzzq5XG+a+7K5KDOOHo6Z=xBXWyK8AxYmKOVOY7uw@mail.gmail.com>
2026-08-10 8:27 ` Ricardo Ribalda
2026-09-29 14:30 ` Hans de Goede
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).