diff mbox series

media: uvcvideo: Drop the uvc_driver structure

Message ID 20250223150557.25148-1-laurent.pinchart@ideasonboard.com (mailing list archive)
State New
Headers show
Series media: uvcvideo: Drop the uvc_driver structure | expand

Commit Message

Laurent Pinchart Feb. 23, 2025, 3:05 p.m. UTC
The uvc_driver structure used to contain more fields, but those got
removed in commit ba2fa99668bb ("[media] uvcvideo: Hardcode the
index/selector relationship for XU controls"). The structure is now just
a wrapper around usb_driver. Drop it.

Fixes: ba2fa99668bb ("[media] uvcvideo: Hardcode the index/selector relationship for XU controls")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/usb/uvc/uvc_driver.c | 35 +++++++++++++++---------------
 drivers/media/usb/uvc/uvcvideo.h   |  7 ------
 2 files changed, 17 insertions(+), 25 deletions(-)


base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b

Comments

Ricardo Ribalda Feb. 23, 2025, 7:05 p.m. UTC | #1
Hi Laurent

On Sun, 23 Feb 2025 at 16:06, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> The uvc_driver structure used to contain more fields, but those got
> removed in commit ba2fa99668bb ("[media] uvcvideo: Hardcode the
> index/selector relationship for XU controls"). The structure is now just
> a wrapper around usb_driver. Drop it.
>
> Fixes: ba2fa99668bb ("[media] uvcvideo: Hardcode the index/selector relationship for XU controls")
Do we really want to declare a fix here?

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  drivers/media/usb/uvc/uvc_driver.c | 35 +++++++++++++++---------------
>  drivers/media/usb/uvc/uvcvideo.h   |  7 ------
>  2 files changed, 17 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index deadbcea5e22..84e931959198 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -37,6 +37,8 @@ static unsigned int uvc_quirks_param = -1;
>  unsigned int uvc_dbg_param;
>  unsigned int uvc_timeout_param = UVC_CTRL_STREAMING_TIMEOUT;
>
> +static struct usb_driver uvc_driver;
> +
>  /* ------------------------------------------------------------------------
>   * Utility functions
>   */
> @@ -546,7 +548,7 @@ static int uvc_parse_streaming(struct uvc_device *dev,
>                 return -EINVAL;
>         }
>
> -       if (usb_driver_claim_interface(&uvc_driver.driver, intf, dev)) {
> +       if (usb_driver_claim_interface(&uvc_driver, intf, dev)) {
>                 uvc_dbg(dev, DESCR,
>                         "device %d interface %d is already claimed\n",
>                         dev->udev->devnum,
> @@ -556,7 +558,7 @@ static int uvc_parse_streaming(struct uvc_device *dev,
>
>         streaming = uvc_stream_new(dev, intf);
>         if (streaming == NULL) {
> -               usb_driver_release_interface(&uvc_driver.driver, intf);
> +               usb_driver_release_interface(&uvc_driver, intf);
>                 return -ENOMEM;
>         }
>
> @@ -779,7 +781,7 @@ static int uvc_parse_streaming(struct uvc_device *dev,
>         return 0;
>
>  error:
> -       usb_driver_release_interface(&uvc_driver.driver, intf);
> +       usb_driver_release_interface(&uvc_driver, intf);
>         uvc_stream_delete(streaming);
>         return ret;
>  }
> @@ -1922,8 +1924,7 @@ static void uvc_delete(struct kref *kref)
>                 struct uvc_streaming *streaming;
>
>                 streaming = list_entry(p, struct uvc_streaming, list);
> -               usb_driver_release_interface(&uvc_driver.driver,
> -                       streaming->intf);
> +               usb_driver_release_interface(&uvc_driver, streaming->intf);
>                 uvc_stream_delete(streaming);
>         }
>
> @@ -3196,17 +3197,15 @@ static const struct usb_device_id uvc_ids[] = {
>
>  MODULE_DEVICE_TABLE(usb, uvc_ids);
>
> -struct uvc_driver uvc_driver = {
> -       .driver = {
> -               .name           = "uvcvideo",
> -               .probe          = uvc_probe,
> -               .disconnect     = uvc_disconnect,
> -               .suspend        = uvc_suspend,
> -               .resume         = uvc_resume,
> -               .reset_resume   = uvc_reset_resume,
> -               .id_table       = uvc_ids,
> -               .supports_autosuspend = 1,
> -       },
> +static struct usb_driver uvc_driver = {
> +       .name           = "uvcvideo",
> +       .probe          = uvc_probe,
> +       .disconnect     = uvc_disconnect,
> +       .suspend        = uvc_suspend,
> +       .resume         = uvc_resume,
> +       .reset_resume   = uvc_reset_resume,
> +       .id_table       = uvc_ids,
> +       .supports_autosuspend = 1,
>  };
>
>  static int __init uvc_init(void)
> @@ -3215,7 +3214,7 @@ static int __init uvc_init(void)
>
>         uvc_debugfs_init();
>
> -       ret = usb_register(&uvc_driver.driver);
> +       ret = usb_register(&uvc_driver);
>         if (ret < 0) {
>                 uvc_debugfs_cleanup();
>                 return ret;
> @@ -3226,7 +3225,7 @@ static int __init uvc_init(void)
>
>  static void __exit uvc_cleanup(void)
>  {
> -       usb_deregister(&uvc_driver.driver);
> +       usb_deregister(&uvc_driver);
>         uvc_debugfs_cleanup();
>  }
>
> diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> index b63720e21075..b4ee701835fc 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -632,10 +632,6 @@ struct uvc_fh {
>         unsigned int pending_async_ctrls;
>  };
>
> -struct uvc_driver {
> -       struct usb_driver driver;
> -};
> -
>  /* ------------------------------------------------------------------------
>   * Debugging, printing and logging
>   */
> @@ -686,9 +682,6 @@ do {                                                                        \
>   * Internal functions.
>   */
>
> -/* Core driver */
> -extern struct uvc_driver uvc_driver;
> -
>  struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id);
>
>  /* Video buffers queue management. */
>
> base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
> --
> Regards,
>
> Laurent Pinchart
>
Laurent Pinchart Feb. 23, 2025, 7:30 p.m. UTC | #2
On Sun, Feb 23, 2025 at 08:05:33PM +0100, Ricardo Ribalda wrote:
> On Sun, 23 Feb 2025 at 16:06, Laurent Pinchart wrote:
> >
> > The uvc_driver structure used to contain more fields, but those got
> > removed in commit ba2fa99668bb ("[media] uvcvideo: Hardcode the
> > index/selector relationship for XU controls"). The structure is now just
> > a wrapper around usb_driver. Drop it.
> >
> > Fixes: ba2fa99668bb ("[media] uvcvideo: Hardcode the index/selector relationship for XU controls")
>
> Do we really want to declare a fix here?

I don't mind dropping it. Backports are not important.

> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
>
> > ---
> >  drivers/media/usb/uvc/uvc_driver.c | 35 +++++++++++++++---------------
> >  drivers/media/usb/uvc/uvcvideo.h   |  7 ------
> >  2 files changed, 17 insertions(+), 25 deletions(-)
> >
> > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> > index deadbcea5e22..84e931959198 100644
> > --- a/drivers/media/usb/uvc/uvc_driver.c
> > +++ b/drivers/media/usb/uvc/uvc_driver.c
> > @@ -37,6 +37,8 @@ static unsigned int uvc_quirks_param = -1;
> >  unsigned int uvc_dbg_param;
> >  unsigned int uvc_timeout_param = UVC_CTRL_STREAMING_TIMEOUT;
> >
> > +static struct usb_driver uvc_driver;
> > +
> >  /* ------------------------------------------------------------------------
> >   * Utility functions
> >   */
> > @@ -546,7 +548,7 @@ static int uvc_parse_streaming(struct uvc_device *dev,
> >                 return -EINVAL;
> >         }
> >
> > -       if (usb_driver_claim_interface(&uvc_driver.driver, intf, dev)) {
> > +       if (usb_driver_claim_interface(&uvc_driver, intf, dev)) {
> >                 uvc_dbg(dev, DESCR,
> >                         "device %d interface %d is already claimed\n",
> >                         dev->udev->devnum,
> > @@ -556,7 +558,7 @@ static int uvc_parse_streaming(struct uvc_device *dev,
> >
> >         streaming = uvc_stream_new(dev, intf);
> >         if (streaming == NULL) {
> > -               usb_driver_release_interface(&uvc_driver.driver, intf);
> > +               usb_driver_release_interface(&uvc_driver, intf);
> >                 return -ENOMEM;
> >         }
> >
> > @@ -779,7 +781,7 @@ static int uvc_parse_streaming(struct uvc_device *dev,
> >         return 0;
> >
> >  error:
> > -       usb_driver_release_interface(&uvc_driver.driver, intf);
> > +       usb_driver_release_interface(&uvc_driver, intf);
> >         uvc_stream_delete(streaming);
> >         return ret;
> >  }
> > @@ -1922,8 +1924,7 @@ static void uvc_delete(struct kref *kref)
> >                 struct uvc_streaming *streaming;
> >
> >                 streaming = list_entry(p, struct uvc_streaming, list);
> > -               usb_driver_release_interface(&uvc_driver.driver,
> > -                       streaming->intf);
> > +               usb_driver_release_interface(&uvc_driver, streaming->intf);
> >                 uvc_stream_delete(streaming);
> >         }
> >
> > @@ -3196,17 +3197,15 @@ static const struct usb_device_id uvc_ids[] = {
> >
> >  MODULE_DEVICE_TABLE(usb, uvc_ids);
> >
> > -struct uvc_driver uvc_driver = {
> > -       .driver = {
> > -               .name           = "uvcvideo",
> > -               .probe          = uvc_probe,
> > -               .disconnect     = uvc_disconnect,
> > -               .suspend        = uvc_suspend,
> > -               .resume         = uvc_resume,
> > -               .reset_resume   = uvc_reset_resume,
> > -               .id_table       = uvc_ids,
> > -               .supports_autosuspend = 1,
> > -       },
> > +static struct usb_driver uvc_driver = {
> > +       .name           = "uvcvideo",
> > +       .probe          = uvc_probe,
> > +       .disconnect     = uvc_disconnect,
> > +       .suspend        = uvc_suspend,
> > +       .resume         = uvc_resume,
> > +       .reset_resume   = uvc_reset_resume,
> > +       .id_table       = uvc_ids,
> > +       .supports_autosuspend = 1,
> >  };
> >
> >  static int __init uvc_init(void)
> > @@ -3215,7 +3214,7 @@ static int __init uvc_init(void)
> >
> >         uvc_debugfs_init();
> >
> > -       ret = usb_register(&uvc_driver.driver);
> > +       ret = usb_register(&uvc_driver);
> >         if (ret < 0) {
> >                 uvc_debugfs_cleanup();
> >                 return ret;
> > @@ -3226,7 +3225,7 @@ static int __init uvc_init(void)
> >
> >  static void __exit uvc_cleanup(void)
> >  {
> > -       usb_deregister(&uvc_driver.driver);
> > +       usb_deregister(&uvc_driver);
> >         uvc_debugfs_cleanup();
> >  }
> >
> > diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> > index b63720e21075..b4ee701835fc 100644
> > --- a/drivers/media/usb/uvc/uvcvideo.h
> > +++ b/drivers/media/usb/uvc/uvcvideo.h
> > @@ -632,10 +632,6 @@ struct uvc_fh {
> >         unsigned int pending_async_ctrls;
> >  };
> >
> > -struct uvc_driver {
> > -       struct usb_driver driver;
> > -};
> > -
> >  /* ------------------------------------------------------------------------
> >   * Debugging, printing and logging
> >   */
> > @@ -686,9 +682,6 @@ do {                                                                        \
> >   * Internal functions.
> >   */
> >
> > -/* Core driver */
> > -extern struct uvc_driver uvc_driver;
> > -
> >  struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id);
> >
> >  /* Video buffers queue management. */
> >
> > base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
diff mbox series

Patch

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index deadbcea5e22..84e931959198 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -37,6 +37,8 @@  static unsigned int uvc_quirks_param = -1;
 unsigned int uvc_dbg_param;
 unsigned int uvc_timeout_param = UVC_CTRL_STREAMING_TIMEOUT;
 
+static struct usb_driver uvc_driver;
+
 /* ------------------------------------------------------------------------
  * Utility functions
  */
@@ -546,7 +548,7 @@  static int uvc_parse_streaming(struct uvc_device *dev,
 		return -EINVAL;
 	}
 
-	if (usb_driver_claim_interface(&uvc_driver.driver, intf, dev)) {
+	if (usb_driver_claim_interface(&uvc_driver, intf, dev)) {
 		uvc_dbg(dev, DESCR,
 			"device %d interface %d is already claimed\n",
 			dev->udev->devnum,
@@ -556,7 +558,7 @@  static int uvc_parse_streaming(struct uvc_device *dev,
 
 	streaming = uvc_stream_new(dev, intf);
 	if (streaming == NULL) {
-		usb_driver_release_interface(&uvc_driver.driver, intf);
+		usb_driver_release_interface(&uvc_driver, intf);
 		return -ENOMEM;
 	}
 
@@ -779,7 +781,7 @@  static int uvc_parse_streaming(struct uvc_device *dev,
 	return 0;
 
 error:
-	usb_driver_release_interface(&uvc_driver.driver, intf);
+	usb_driver_release_interface(&uvc_driver, intf);
 	uvc_stream_delete(streaming);
 	return ret;
 }
@@ -1922,8 +1924,7 @@  static void uvc_delete(struct kref *kref)
 		struct uvc_streaming *streaming;
 
 		streaming = list_entry(p, struct uvc_streaming, list);
-		usb_driver_release_interface(&uvc_driver.driver,
-			streaming->intf);
+		usb_driver_release_interface(&uvc_driver, streaming->intf);
 		uvc_stream_delete(streaming);
 	}
 
@@ -3196,17 +3197,15 @@  static const struct usb_device_id uvc_ids[] = {
 
 MODULE_DEVICE_TABLE(usb, uvc_ids);
 
-struct uvc_driver uvc_driver = {
-	.driver = {
-		.name		= "uvcvideo",
-		.probe		= uvc_probe,
-		.disconnect	= uvc_disconnect,
-		.suspend	= uvc_suspend,
-		.resume		= uvc_resume,
-		.reset_resume	= uvc_reset_resume,
-		.id_table	= uvc_ids,
-		.supports_autosuspend = 1,
-	},
+static struct usb_driver uvc_driver = {
+	.name		= "uvcvideo",
+	.probe		= uvc_probe,
+	.disconnect	= uvc_disconnect,
+	.suspend	= uvc_suspend,
+	.resume		= uvc_resume,
+	.reset_resume	= uvc_reset_resume,
+	.id_table	= uvc_ids,
+	.supports_autosuspend = 1,
 };
 
 static int __init uvc_init(void)
@@ -3215,7 +3214,7 @@  static int __init uvc_init(void)
 
 	uvc_debugfs_init();
 
-	ret = usb_register(&uvc_driver.driver);
+	ret = usb_register(&uvc_driver);
 	if (ret < 0) {
 		uvc_debugfs_cleanup();
 		return ret;
@@ -3226,7 +3225,7 @@  static int __init uvc_init(void)
 
 static void __exit uvc_cleanup(void)
 {
-	usb_deregister(&uvc_driver.driver);
+	usb_deregister(&uvc_driver);
 	uvc_debugfs_cleanup();
 }
 
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index b63720e21075..b4ee701835fc 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -632,10 +632,6 @@  struct uvc_fh {
 	unsigned int pending_async_ctrls;
 };
 
-struct uvc_driver {
-	struct usb_driver driver;
-};
-
 /* ------------------------------------------------------------------------
  * Debugging, printing and logging
  */
@@ -686,9 +682,6 @@  do {									\
  * Internal functions.
  */
 
-/* Core driver */
-extern struct uvc_driver uvc_driver;
-
 struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id);
 
 /* Video buffers queue management. */