aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-08-06 10:44:52 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-08-07 08:05:04 -0400
commit7d9c1d2f7aca2651b3821947bf928ee131df102a (patch)
tree41f47e82cc671e67b79576cf727c70f3be73e7b6
parentb71b283e3d6df40cef03b5ce882b2385971f58a3 (diff)
USB: add support for dev_groups to struct usb_device_driver
Now that the driver core supports dev_groups for individual drivers, expose that pointer to struct usb_device_driver to make it easier for USB drivers to also use it. Yes, users of usb_device_driver are much rare, but there are instances already that use custom sysfs files, so adding this support will make things easier for those drivers. usbip is one example, hubs might be another one. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20190806144502.17792-3-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/core/driver.c1
-rw-r--r--include/linux/usb.h3
2 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 687fc5df4c17..2b27d232d7a7 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -892,6 +892,7 @@ int usb_register_device_driver(struct usb_device_driver *new_udriver,
892 new_udriver->drvwrap.driver.probe = usb_probe_device; 892 new_udriver->drvwrap.driver.probe = usb_probe_device;
893 new_udriver->drvwrap.driver.remove = usb_unbind_device; 893 new_udriver->drvwrap.driver.remove = usb_unbind_device;
894 new_udriver->drvwrap.driver.owner = owner; 894 new_udriver->drvwrap.driver.owner = owner;
895 new_udriver->drvwrap.driver.dev_groups = new_udriver->dev_groups;
895 896
896 retval = driver_register(&new_udriver->drvwrap.driver); 897 retval = driver_register(&new_udriver->drvwrap.driver);
897 898
diff --git a/include/linux/usb.h b/include/linux/usb.h
index af4eb6419ae8..57f667cad3ec 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1224,6 +1224,8 @@ struct usb_driver {
1224 * module is being unloaded. 1224 * module is being unloaded.
1225 * @suspend: Called when the device is going to be suspended by the system. 1225 * @suspend: Called when the device is going to be suspended by the system.
1226 * @resume: Called when the device is being resumed by the system. 1226 * @resume: Called when the device is being resumed by the system.
1227 * @dev_groups: Attributes attached to the device that will be created once it
1228 * is bound to the driver.
1227 * @drvwrap: Driver-model core structure wrapper. 1229 * @drvwrap: Driver-model core structure wrapper.
1228 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend 1230 * @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
1229 * for devices bound to this driver. 1231 * for devices bound to this driver.
@@ -1238,6 +1240,7 @@ struct usb_device_driver {
1238 1240
1239 int (*suspend) (struct usb_device *udev, pm_message_t message); 1241 int (*suspend) (struct usb_device *udev, pm_message_t message);
1240 int (*resume) (struct usb_device *udev, pm_message_t message); 1242 int (*resume) (struct usb_device *udev, pm_message_t message);
1243 const struct attribute_group **dev_groups;
1241 struct usbdrv_wrap drvwrap; 1244 struct usbdrv_wrap drvwrap;
1242 unsigned int supports_autosuspend:1; 1245 unsigned int supports_autosuspend:1;
1243}; 1246};