From 162736b0d71a9630f7c99dda7cefd5600fa03d69 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 11 Jan 2023 12:30:07 +0100 Subject: driver core: make struct device_type.uevent() take a const * The uevent() callback in struct device_type should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into all relevant subsystems that use this callback. Cc: Alan Stern Cc: Andreas Noever Cc: Andy Shevchenko Cc: Bard Liao Cc: Chaitanya Kulkarni Cc: Dan Williams Cc: Dmitry Torokhov Cc: Frank Rowand Cc: Ira Weiny Cc: Jason Gunthorpe Cc: Jens Axboe Cc: Jilin Yuan Cc: Jiri Slaby Cc: Len Brown Cc: Mark Gross Cc: "Martin K. Petersen" Cc: "Matthew Wilcox (Oracle)" Cc: Maximilian Luz Cc: Michael Jamet Cc: Ming Lei Cc: Pierre-Louis Bossart Cc: Rob Herring Cc: Sakari Ailus Cc: Sanyog Kale Cc: Sean Young Cc: Stefan Richter Cc: Thomas Gleixner Cc: Won Chung Cc: Yehezkel Bernat Acked-by: Rafael J. Wysocki Acked-by: Mika Westerberg # for Thunderbolt Acked-by: Mauro Carvalho Chehab Acked-by: Alexandre Belloni Acked-by: Heikki Krogerus Acked-by: Wolfram Sang Acked-by: Vinod Koul Acked-by: Hans de Goede Link: https://lore.kernel.org/r/20230111113018.459199-6-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/message.c | 8 ++++---- drivers/usb/core/usb.c | 4 ++-- drivers/usb/phy/phy.c | 6 +++--- drivers/usb/roles/class.c | 3 +-- drivers/usb/typec/class.c | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 127fac1af676..cc404bb7e8f7 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1819,11 +1819,11 @@ void usb_authorize_interface(struct usb_interface *intf) } } -static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env) +static int usb_if_uevent(const struct device *dev, struct kobj_uevent_env *env) { - struct usb_device *usb_dev; - struct usb_interface *intf; - struct usb_host_interface *alt; + const struct usb_device *usb_dev; + const struct usb_interface *intf; + const struct usb_host_interface *alt; intf = to_usb_interface(dev); usb_dev = interface_to_usbdev(intf); diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 11b15d7b357a..8527c06b65e6 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -423,9 +423,9 @@ static void usb_release_dev(struct device *dev) kfree(udev); } -static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env) +static int usb_dev_uevent(const struct device *dev, struct kobj_uevent_env *env) { - struct usb_device *usb_dev; + const struct usb_device *usb_dev; usb_dev = to_usb_device(dev); diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index 1b24492bb4e5..4b468bde19cf 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c @@ -80,7 +80,7 @@ static struct usb_phy *__of_usb_find_phy(struct device_node *node) return ERR_PTR(-EPROBE_DEFER); } -static struct usb_phy *__device_to_usb_phy(struct device *dev) +static struct usb_phy *__device_to_usb_phy(const struct device *dev) { struct usb_phy *usb_phy; @@ -145,9 +145,9 @@ static void usb_phy_notify_charger_work(struct work_struct *work) kobject_uevent(&usb_phy->dev->kobj, KOBJ_CHANGE); } -static int usb_phy_uevent(struct device *dev, struct kobj_uevent_env *env) +static int usb_phy_uevent(const struct device *dev, struct kobj_uevent_env *env) { - struct usb_phy *usb_phy; + const struct usb_phy *usb_phy; char uchger_state[50] = { 0 }; char uchger_type[50] = { 0 }; unsigned long flags; diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c index eacb46ec2ab3..56814ef80c24 100644 --- a/drivers/usb/roles/class.c +++ b/drivers/usb/roles/class.c @@ -274,8 +274,7 @@ static const struct attribute_group *usb_role_switch_groups[] = { NULL, }; -static int -usb_role_switch_uevent(struct device *dev, struct kobj_uevent_env *env) +static int usb_role_switch_uevent(const struct device *dev, struct kobj_uevent_env *env) { int ret; diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 5897905cb4f0..a89d8fd3f46c 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -1737,7 +1737,7 @@ static const struct attribute_group *typec_groups[] = { NULL }; -static int typec_uevent(struct device *dev, struct kobj_uevent_env *env) +static int typec_uevent(const struct device *dev, struct kobj_uevent_env *env) { int ret; -- cgit v1.2.3