linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] USB: make devnode() callback in usb_class_driver take a const *
@ 2022-10-01 16:51 Greg Kroah-Hartman
  2022-10-03  6:39 ` Johan Hovold
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-10-01 16:51 UTC (permalink / raw)
  To: linux-usb
  Cc: linux-kernel, Greg Kroah-Hartman, Jiri Kosina,
	Benjamin Tissoires, Pete Zaitcev, Juergen Stuber, Johan Hovold

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 <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Juergen Stuber <starblue@users.sourceforge.net>
Cc: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 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(-)

diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 2fb2991dbe4c..59cf3ddfdf78 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -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));
 }
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index f27b4aecff3d..5a2e43331064 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -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));
 }
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 988a8c02e7e2..f9427a67789c 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -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));
 }
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 1c9e09138c10..379cf01a6e96 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -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));
 }
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 9ff1ad4dfad1..316e0a6b50e2 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -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;
 };
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] USB: make devnode() callback in usb_class_driver take a const *
  2022-10-01 16:51 [PATCH] USB: make devnode() callback in usb_class_driver take a const * Greg Kroah-Hartman
@ 2022-10-03  6:39 ` Johan Hovold
  2022-10-04  8:24 ` Jiri Kosina
  2022-10-11  5:45 ` Pete Zaitcev
  2 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2022-10-03  6:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Jiri Kosina, Benjamin Tissoires,
	Pete Zaitcev, Juergen Stuber

On Sat, Oct 01, 2022 at 06:51:28PM +0200, Greg Kroah-Hartman wrote:
> 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 <jikos@kernel.org>
> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> Cc: Pete Zaitcev <zaitcev@redhat.com>
> Cc: Juergen Stuber <starblue@users.sourceforge.net>
> Cc: Johan Hovold <johan@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  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.

Reviewed-by: Johan Hovold <johan@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] USB: make devnode() callback in usb_class_driver take a const *
  2022-10-01 16:51 [PATCH] USB: make devnode() callback in usb_class_driver take a const * Greg Kroah-Hartman
  2022-10-03  6:39 ` Johan Hovold
@ 2022-10-04  8:24 ` Jiri Kosina
  2022-10-11  5:45 ` Pete Zaitcev
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2022-10-04  8:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Benjamin Tissoires, Pete Zaitcev,
	Juergen Stuber, Johan Hovold

On Sat, 1 Oct 2022, Greg Kroah-Hartman wrote:

> 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 <jikos@kernel.org>
> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> Cc: Pete Zaitcev <zaitcev@redhat.com>
> Cc: Juergen Stuber <starblue@users.sourceforge.net>
> Cc: Johan Hovold <johan@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/hid/usbhid/hiddev.c     | 2 +-

For hiddev.c:

	Reviewed-by: Jiri Kosina <jkosina@suse.cz>

Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] USB: make devnode() callback in usb_class_driver take a const *
  2022-10-01 16:51 [PATCH] USB: make devnode() callback in usb_class_driver take a const * Greg Kroah-Hartman
  2022-10-03  6:39 ` Johan Hovold
  2022-10-04  8:24 ` Jiri Kosina
@ 2022-10-11  5:45 ` Pete Zaitcev
  2 siblings, 0 replies; 4+ messages in thread
From: Pete Zaitcev @ 2022-10-11  5:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Jiri Kosina, Benjamin Tissoires,
	Juergen Stuber, Johan Hovold

On Sat,  1 Oct 2022 18:51:28 +0200
Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:

> +++ b/drivers/usb/class/usblp.c
> @@ -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.

Acked-by: Pete Zaitcev <zaitcev@redhat.com>

-- P


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-11  5:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-01 16:51 [PATCH] USB: make devnode() callback in usb_class_driver take a const * Greg Kroah-Hartman
2022-10-03  6:39 ` Johan Hovold
2022-10-04  8:24 ` Jiri Kosina
2022-10-11  5:45 ` Pete Zaitcev

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).