On Sun Feb 23 17:01:32 2025 +0200, 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.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
> Reviewed-by: Ricardo Ribalda <riba...@chromium.org>
> Signed-off-by: Hans Verkuil <hverk...@xs4all.nl>

Patch committed.

Thanks,
Hans Verkuil

 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 11b04f6f60cd..107e0fafd80f 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);
        }
 
@@ -3205,17 +3206,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)
@@ -3224,7 +3223,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;
@@ -3235,7 +3234,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. */

Reply via email to