USB: make devnode() callback in usb_class_driver take a const *
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 1/1 USB: make devnode() callback in usb_class_driver take a const *
With the changes to the driver core to make more pointers const, the USB subsystem also needs to be modified to take a const * for the devnode callback so that the driver core's constant pointer will also be properly propagated.
--- drivers/hid/usbhid/hiddev.c | 2 +- drivers/usb/class/usblp.c | 2 +- drivers/usb/misc/iowarrior.c | 2 +- drivers/usb/misc/legousbtower.c | 2 +- include/linux/usb.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
drivers/hid/usbhid/hiddev.c +1 -1
@@ -857,7 +857,7 @@ static const struct file_operations hiddev_fops = { .llseek = noop_llseek, }; -static char *hiddev_devnode (struct device *dev,umode_t *mode) +static char *hiddev_devnode (const struct device *dev,umode_t *mode) {return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); }
drivers/usb/class/usblp.c +1 -1
@@ -1090,7 +1090,7 @@ static const struct file_operations usblp_fops = { .llseek = noop_llseek, }; -static char *usblp_devnode (struct device *dev,umode_t *mode) +static char *usblp_devnode (const struct device *dev,umode_t *mode) {return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); }
drivers/usb/misc/iowarrior.c +1 -1
@@ -717,7 +717,7 @@ static const struct file_operations iowarrior_fops = { .llseek = noop_llseek, }; -static char *iowarrior_devnode (struct device *dev,umode_t *mode) +static char *iowarrior_devnode (const struct device *dev,umode_t *mode) {return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); }
drivers/usb/misc/legousbtower.c +1 -1
@@ -245,7 +245,7 @@ static const struct file_operations tower_fops = { .llseek = tower_llseek, }; -static char *legousbtower_devnode (struct device *dev,umode_t *mode) +static char *legousbtower_devnode (const struct device *dev,umode_t *mode) {return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); }
include/linux/usb.h +1 -1
@@ -1272,7 +1272,7 @@ struct usb_device_driver {*/ struct usb_class_driver {char *name; -char *(*devnode)(struct device *dev,umode_t *mode); +char *(*devnode)(const struct device *dev,umode_t *mode);const struct file_operations *fops;int minor_base; };
Signature · 1 line
2.37.3
Quoted 11 lines · Greg Kroah-Hartman
With the changes to the driver core to make more pointers const, the USB subsystem also needs to be modified to take a const * for the devnode callback so that the driver core's constant pointer will also be properly propagated.
Cc Jiri Kosina <[email protected]>Cc Benjamin Tissoires <[email protected]>Cc Pete Zaitcev <[email protected]>Cc Juergen Stuber <[email protected]>Cc Johan Hovold <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 7 lines
--- drivers/hid/usbhid/hiddev.c | 2 +- drivers/usb/class/usblp.c | 2 +- drivers/usb/misc/iowarrior.c | 2 +- drivers/usb/misc/legousbtower.c | 2 +- include/linux/usb.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
Looks correct and complete.
Quoted 5 lines · Greg Kroah-Hartman
With the changes to the driver core to make more pointers const, the USB subsystem also needs to be modified to take a const * for the devnode callback so that the driver core's constant pointer will also be properly propagated.
Quoted 8 lines
Cc Jiri Kosina <[email protected]>Cc Benjamin Tissoires <[email protected]>Cc Pete Zaitcev <[email protected]>Cc Juergen Stuber <[email protected]>Cc Johan Hovold <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/hid/usbhid/hiddev.c | 2 +-
For hiddev.c:
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs
drivers/usb/class/usblp.c static const struct file_operations usblp_fops = { · line 1093
Quoted 7 lines · On Sat, 1 Oct 2022 18:51:28 +0200 Greg Kroah-Hartman…
+++
b/drivers/usb/class/usblp.cdrivers/usb/class/usblp.c +1
-1@@ -1090,7 +1090,7 @@ static const struct file_operations usblp_fops = { -static char *usblp_devnode (struct device *dev,umode_t *mode) +static char *usblp_devnode (const struct device *dev,umode_t *mode) {return kasprintf (GFP_KERNEL ,"usb/%s" ,dev_name (dev)); }
Seems obvious.
-- P