driver core: make more things const!
Subsystems (87)
Greg Kroah-Hartman
maintainerv2 cover driver core: make more things const!
Here's an updated version of this original series:
https://lore.kernel.org/all/[email protected]/
that has the goal of making more functions in the driver core take const pointers as they do not actually modify anything. This work is an outgrowth of some conversations I had with the Linux Rust developers talking about the mutability of many of the driver model pointers.
A small subset of the original submission is now in 6.2-rc1 and this series is an outgrown of the original submission in that many things are now changed and a bit more explicit than before.
I can take all of these through the driver-core git tree as they depend on each other. 0-day has been passing on this series for quite a while, so all should be good unless some subsystem trees have added new busses without me noticing.
Bonus for all of this work, the overall code size of the kernel actually decreased a tiny bit:
126 files changed, 283 insertions(+), 309 deletions(-)
while adding a lot more type-safeness to the system.
Changes from v1:
- rebased on 6.2-rc1 and dropped accepted patches already in there.
- container_of_const() is now in 6.2-rc1 so use that in many individual subsystems to make the follow-on changes in the driver core more obvious.
- collected some Reviewed-by
- of_device_uevent_modalias was being "abused" by many different subsystems in using it instead of a local bus function which played havoc when enabling stricter type-checking. Move that out into a new function for the busses that were doing this to make it more obvious what they need here.
Greg Kroah-Hartman (16):
of: device: make of_device_uevent_modalias() take a const device *
i3c: move dev_to_i3cdev() to use container_of_const() platform/surface: aggregator: move to_ssam_device() to use
container_of_const()
firewire: move fw_device() and fw_unit() to use container_of_const() driver core: make struct device_type.uevent() take a const * driver core: make struct device_type.devnode() take a const * driver core: device_get_devnode() should take a const *
vio: move to_vio_dev() to use container_of_const() platform/x86: wmi: move dev_to_wblock() and dev_to_wdev to use
container_of_const()
drivers: hv: move device_to_hv_device to use container_of_const()
virtio: move dev_to_virtio() to use container_of_const() drm/mipi-dsi: move to_mipi_dsi_device() to use container_of_const()
mcb: move to_mcb_device() to use container_of_const() xen/xenbus: move to_xenbus_device() to use container_of_const() driver core: make struct bus_type.uevent() take a const *
kobject: kset_uevent_ops: make uevent() callback take a const *
arch/mips/sgi-ip22/ip22-gio.c | 4 ++-- arch/parisc/kernel/drivers.c | 4 ++-- arch/powerpc/include/asm/vio.h | 5 +---- arch/powerpc/platforms/pseries/ibmebus.c | 7 ++++++- arch/powerpc/platforms/pseries/vio.c | 4 ++-- arch/sparc/include/asm/vio.h | 5 +---- arch/sparc/kernel/vio.c | 2 +- block/genhd.c | 2 +- block/partitions/core.c | 4 ++-- drivers/acpi/bus.c | 2 +- drivers/acpi/device_sysfs.c | 8 ++++---- drivers/acpi/internal.h | 2 +- drivers/amba/bus.c | 4 ++-- drivers/base/auxiliary.c | 2 +- drivers/base/base.h | 2 ++ drivers/base/core.c | 6 +++--- drivers/base/cpu.c | 2 +- drivers/base/platform.c | 4 ++-- drivers/bcma/main.c | 6 +++--- drivers/bus/fsl-mc/fsl-mc-bus.c | 4 ++-- drivers/bus/mhi/ep/main.c | 4 ++-- drivers/bus/mhi/host/init.c | 4 ++-- drivers/bus/mips_cdmm.c | 4 ++-- drivers/bus/sunxi-rsb.c | 7 ++++++- drivers/cxl/core/memdev.c | 4 ++-- drivers/cxl/core/port.c | 8 ++++---- drivers/cxl/cxl.h | 4 ++-- drivers/cxl/cxlmem.h | 2 +- drivers/dax/bus.c | 2 +- drivers/eisa/eisa-bus.c | 4 ++-- drivers/firewire/core-device.c | 8 ++++---- drivers/firmware/arm_ffa/bus.c | 4 ++-- drivers/fpga/dfl.c | 4 ++-- drivers/fsi/fsi-core.c | 6 +++--- drivers/gpu/drm/display/drm_dp_aux_bus.c | 7 ++++++- drivers/gpu/drm/drm_mipi_dsi.c | 4 ++-- drivers/gpu/host1x/bus.c | 2 +- drivers/greybus/core.c | 14 +++++++------- drivers/hid/hid-core.c | 4 ++-- drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +- drivers/hsi/hsi_core.c | 2 +- drivers/hv/vmbus_drv.c | 4 ++-- drivers/hwtracing/intel_th/core.c | 6 +++--- drivers/hwtracing/intel_th/intel_th.h | 4 ++-- drivers/i2c/i2c-core-base.c | 4 ++-- drivers/i3c/device.c | 14 +------------- drivers/i3c/master.c | 4 ++-- drivers/input/input.c | 16 ++++++++-------- drivers/input/serio/serio.c | 4 ++-- drivers/ipack/ipack.c | 4 ++-- drivers/macintosh/macio_asic.c | 7 ++++++- drivers/mcb/mcb-core.c | 4 ++-- drivers/media/rc/rc-main.c | 2 +- drivers/memstick/core/memstick.c | 6 +++--- drivers/misc/mei/bus.c | 4 ++-- drivers/misc/tifm_core.c | 4 ++-- drivers/mmc/core/bus.c | 4 ++-- drivers/mmc/core/sdio_bus.c | 4 ++-- drivers/net/phy/mdio_bus.c | 2 +- drivers/net/xen-netback/xenbus.c | 2 +- drivers/nvdimm/bus.c | 4 ++-- drivers/nvdimm/dax_devs.c | 2 +- drivers/nvdimm/dimm_devs.c | 2 +- drivers/nvdimm/nd-core.h | 10 +++++----- drivers/nvdimm/nd.h | 4 ++-- drivers/nvdimm/region_devs.c | 4 ++-- drivers/of/device.c | 4 ++-- drivers/pci/pci-driver.c | 4 ++-- drivers/pcmcia/ds.c | 4 ++-- drivers/platform/surface/aggregator/bus.c | 4 ++-- drivers/platform/x86/wmi.c | 15 ++++----------- drivers/rapidio/rio-driver.c | 4 ++-- drivers/rpmsg/rpmsg_core.c | 4 ++-- drivers/s390/cio/css.c | 4 ++-- drivers/s390/cio/device.c | 8 ++++---- drivers/s390/cio/scm.c | 2 +- drivers/s390/crypto/ap_bus.c | 4 ++-- drivers/scsi/scsi_sysfs.c | 4 ++-- drivers/slimbus/core.c | 4 ++-- drivers/soc/qcom/apr.c | 4 ++-- drivers/soundwire/bus_type.c | 4 ++-- drivers/spi/spi.c | 2 +- drivers/spmi/spmi.c | 2 +- drivers/ssb/main.c | 4 ++-- drivers/staging/greybus/gbphy.c | 14 +++++++------- drivers/tee/tee_core.c | 2 +- drivers/thunderbolt/switch.c | 4 ++-- drivers/thunderbolt/tb.h | 2 +- drivers/thunderbolt/xdomain.c | 6 +++--- drivers/tty/serdev/core.c | 2 +- drivers/usb/common/ulpi.c | 4 ++-- drivers/usb/core/driver.c | 6 +++--- drivers/usb/core/message.c | 8 ++++---- drivers/usb/core/usb.c | 8 ++++---- drivers/usb/phy/phy.c | 6 +++--- drivers/usb/roles/class.c | 3 +-- drivers/usb/typec/bus.c | 4 ++-- drivers/usb/typec/class.c | 2 +- drivers/virtio/virtio.c | 4 ++-- drivers/w1/w1.c | 10 +++++----- drivers/xen/pvcalls-back.c | 2 +- drivers/xen/xenbus/xenbus_probe_backend.c | 8 ++++---- drivers/xen/xenbus/xenbus_probe_frontend.c | 4 ++-- drivers/zorro/zorro-driver.c | 4 ++-- fs/dlm/lockspace.c | 4 ++-- fs/gfs2/sys.c | 6 +++--- include/drm/drm_mipi_dsi.h | 5 +---- include/linux/acpi.h | 4 ++-- include/linux/device.h | 6 ++---- include/linux/device/bus.h | 2 +- include/linux/firewire.h | 15 +++------------ include/linux/hyperv.h | 5 +---- include/linux/i3c/device.h | 11 +++++++++-- include/linux/kobject.h | 2 +- include/linux/mcb.h | 5 +---- include/linux/of_device.h | 4 ++-- include/linux/soundwire/sdw_type.h | 2 +- include/linux/spi/spi.h | 2 +- include/linux/ssb/ssb.h | 2 +- include/linux/surface_aggregator/device.h | 5 +---- include/linux/virtio.h | 5 +---- include/sound/hdaudio.h | 2 +- include/xen/xenbus.h | 7 ++----- sound/aoa/soundbus/core.c | 6 +++--- sound/hda/hda_bus_type.c | 2 +- sound/hda/hdac_device.c | 2 +- 126 files changed, 283 insertions(+), 309 deletions(-)
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH v2 1/16 of: device: make of_device_uevent_modalias() take a const device *
of_device_uevent_modalias() does not modify the device pointer passed to it, so mark it constant. In order to properly do this, a number of busses need to have a modalias function added as they were attempting to just point to of_device_uevent_modalias instead of their bus-specific modalias function. This is fine except if the prototype for a bus and device type modalias function diverges and then problems could happen. To prevent all of that, just wrap the call to of_device_uevent_modalias() directly for each bus and device type individually.
--- arch/powerpc/platforms/pseries/ibmebus.c | 7 ++++++- drivers/bus/sunxi-rsb.c | 7 ++++++- drivers/gpu/drm/display/drm_dp_aux_bus.c | 7 ++++++- drivers/macintosh/macio_asic.c | 7 ++++++- drivers/of/device.c | 4 ++-- include/linux/of_device.h | 4 ++-- 6 files changed, 28 insertions(+), 8 deletions(-)
arch/powerpc/platforms/pseries/ibmebus.c +6 -1
@@ -426,9 +426,14 @@ static struct attribute *ibmebus_bus_device_attrs[] = { };ATTRIBUTE_GROUPS (ibmebus_bus_device); +static int ibmebus_bus_modalias (struct device *dev,struct kobj_uevent_env *env) +{ +return of_device_uevent_modalias (dev, env); +} +struct bus_type ibmebus_bus_type = { .name ="ibmebus" , - .uevent = of_device_uevent_modalias, + .uevent = ibmebus_bus_modalias, .bus_groups = ibmbus_bus_groups, .match = ibmebus_bus_bus_match, .probe = ibmebus_bus_device_probe,
drivers/bus/sunxi-rsb.c +6 -1
@@ -172,12 +172,17 @@ static void sunxi_rsb_device_remove(struct device *dev) drv->remove (to_sunxi_rsb_device (dev)); } +static int sunxi_rsb_device_modalias (struct device *dev,struct kobj_uevent_env *env) +{ +return of_device_uevent_modalias (dev, env); +} +static struct bus_type sunxi_rsb_bus = { .name =RSB_CTRL_NAME , .match = sunxi_rsb_device_match, .probe = sunxi_rsb_device_probe, .remove = sunxi_rsb_device_remove, - .uevent = of_device_uevent_modalias, + .uevent = sunxi_rsb_device_modalias, };static void sunxi_rsb_dev_release (struct device *dev)
drivers/gpu/drm/display/drm_dp_aux_bus.c +6 -1
@@ -161,9 +161,14 @@ static void dp_aux_ep_dev_release(struct device *dev)kfree (aux_ep_with_data); } +static int dp_aux_ep_dev_modalias (struct device *dev,struct kobj_uevent_env *env) +{ +return of_device_uevent_modalias (dev, env); +} +static struct device_type dp_aux_device_type_type = { .groups = dp_aux_ep_dev_groups, - .uevent = of_device_uevent_modalias, + .uevent = dp_aux_ep_dev_modalias, .release = dp_aux_ep_dev_release, };
drivers/macintosh/macio_asic.c +6 -1
@@ -128,12 +128,17 @@ static int macio_device_resume(struct device * dev)return 0 ; } +static int macio_device_modalias (struct device *dev,struct kobj_uevent_env *env) +{ +return of_device_uevent_modalias (dev, env); +} +extern const struct attribute_group *macio_dev_groups[];struct bus_type macio_bus_type = { .name ="macio" , .match = macio_bus_match, - .uevent = of_device_uevent_modalias, + .uevent = macio_device_modalias, .probe = macio_device_probe, .remove = macio_device_remove, .shutdown = macio_device_shutdown,
drivers/of/device.c +2 -2
@@ -248,7 +248,7 @@ const void *of_device_get_match_data(const struct device *dev) }EXPORT_SYMBOL (of_device_get_match_data); -static ssize_t of_device_get_modalias (struct device *dev,char *str,ssize_t len) +static ssize_t of_device_get_modalias (const struct device *dev,char *str,ssize_t len) {const char *compat;char *c;
@@ -372,7 +372,7 @@ void of_device_uevent(const struct device *dev, struct kobj_uevent_env *env)mutex_unlock (&of_mutex); } -int of_device_uevent_modalias (struct device *dev,struct kobj_uevent_env *env) +int of_device_uevent_modalias (const struct device *dev,struct kobj_uevent_env *env) {int sl;
include/linux/of_device.h +2 -2
@@ -36,7 +36,7 @@ extern ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len);extern int of_device_request_module (struct device *dev);extern void of_device_uevent (const struct device *dev,struct kobj_uevent_env *env); -extern int of_device_uevent_modalias (struct device *dev,struct kobj_uevent_env *env); +extern int of_device_uevent_modalias (const struct device *dev,struct kobj_uevent_env *env);static inline struct device_node *of_cpu_device_node_get (int cpu) {
@@ -83,7 +83,7 @@ static inline int of_device_request_module(struct device *dev)return -ENODEV ; } -static inline int of_device_uevent_modalias (struct device *dev, +static inline int of_device_uevent_modalias (const struct device *dev,struct kobj_uevent_env *env) {return -ENODEV ;
Signature · 1 line
2.39.0
Re: [PATCH v2 01/16] of: device: make of_device_uevent_modalias() take a const device *
Quoted 9 lines · Greg Kroah-Hartman
of_device_uevent_modalias()does not modify the device pointer passed to it, so mark it constant. In order to properly do this, a number of busses need to have a modalias function added as they were attempting to just point toof_device_uevent_modaliasinstead of their bus-specific modalias function. This is fine except if the prototype for a bus and device type modalias function diverges and then problems could happen. To prevent all of that, just wrap the call toof_device_uevent_modalias()directly for each bus and device type individually.
Why not just put the wrapper function in the DT code instead of making 4 copies of it?
Rob
Greg Kroah-Hartman
maintainerRe: [PATCH v2 01/16] of: device: make of_device_uevent_modalias() take a const device *
Quoted 12 lines · Rob Herring
Quoted 9 lines · Greg Kroah-Hartman
of_device_uevent_modalias()does not modify the device pointer passed to it, so mark it constant. In order to properly do this, a number of busses need to have a modalias function added as they were attempting to just point toof_device_uevent_modaliasinstead of their bus-specific modalias function. This is fine except if the prototype for a bus and device type modalias function diverges and then problems could happen. To prevent all of that, just wrap the call toof_device_uevent_modalias()directly for each bus and device type individually.
Quoted 2 lines
Why not just put the wrapper function in the DT code instead of making 4 copies of it?
I could, if you think that it would be better there instead of in each individual bus (like all of the other bus callbacks). This way each bus "owns" their implementation :)
thanks,
greg k-h
Re: [PATCH v2 01/16] of: device: make of_device_uevent_modalias() take a const device *
Quoted 13 lines · Greg Kroah-Hartman
Quoted 12 lines · Rob Herring
Quoted 9 lines · Greg Kroah-Hartman
of_device_uevent_modalias()does not modify the device pointer passed to it, so mark it constant. In order to properly do this, a number of busses need to have a modalias function added as they were attempting to just point toof_device_uevent_modaliasinstead of their bus-specific modalias function. This is fine except if the prototype for a bus and device type modalias function diverges and then problems could happen. To prevent all of that, just wrap the call toof_device_uevent_modalias()directly for each bus and device type individually.
Quoted 6 lines
Quoted 2 lines
Why not just put the wrapper function in the DT code instead of making 4 copies of it?
I could, if you think that it would be better there instead of in each individual bus (like all of the other bus callbacks). This way each bus "owns" their implementation :)
I'd vote for the generic wrapper instead of 4 similar wrapper. In the end, if of_device_uevent_modalias (or the bus callback) interface changes again for whatever reasons, there will be just a single place to fix rather than fixing 4 (or more) bus drivers.
Signature · 2 lines
With best wishes Dmitry
Greg Kroah-Hartman
maintainerRe: [PATCH v2 01/16] of: device: make of_device_uevent_modalias() take a const device *
In reply to Rob HerringQuoted 12 lines · Rob Herring
Quoted 9 lines · Greg Kroah-Hartman
of_device_uevent_modalias()does not modify the device pointer passed to it, so mark it constant. In order to properly do this, a number of busses need to have a modalias function added as they were attempting to just point toof_device_uevent_modaliasinstead of their bus-specific modalias function. This is fine except if the prototype for a bus and device type modalias function diverges and then problems could happen. To prevent all of that, just wrap the call toof_device_uevent_modalias()directly for each bus and device type individually.
Quoted 2 lines
Why not just put the wrapper function in the DT code instead of making 4 copies of it?
Ok, I looked at doing this today, but in the end, making "4" copies of this is simpler overall. To do it your way would require a "const" version of the function be added to the core, and then convert these 4 busses to use that, and then when the real function is converted to be const, move all of these functions back over to use that again.
Lots of churn, and then in the end, we still have the mismatch of a the same function callback being used in two different types of callbacks (one a bus, one a class). This way we separate them to make things much more obvious and self-contained.
So I'll keep this as-is for now, thanks.
greg k-h
Greg Kroah-Hartman
maintainerPATCH v2 2/16 i3c: move dev_to_i3cdev() to use container_of_const()
In reply to Greg Kroah-HartmanThe driver core is changing to pass some pointers as const, so move dev_to_i3cdev() to use container_of_const() to handle this change. dev_to_i3cdev() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.
--- drivers/i3c/device.c | 12 ------------ include/linux/i3c/device.h | 9 ++++++++- 2 files changed, 8 insertions(+), 13 deletions(-)
drivers/i3c/device.c +0 -12
@@ -208,18 +208,6 @@ struct device *i3cdev_to_dev(struct i3c_device *i3cdev) }EXPORT_SYMBOL_GPL (i3cdev_to_dev); -/** -* dev_to_i3cdev() - Returns the I3C device containing @dev -* @dev: device object -* -* Return: a pointer to an I3C device object. -*/ -struct i3c_device *dev_to_i3cdev (struct device *dev) -{ - return container_of(dev, struct i3c_device, dev); -} -EXPORT_SYMBOL_GPL (dev_to_i3cdev); -/** * i3c_device_match_id() - Returns the i3c_device_id entry matching @i3cdev * @i3cdev: I3C device
include/linux/i3c/device.h +8 -1
@@ -186,7 +186,14 @@ static inline struct i3c_driver *drv_to_i3cdrv(struct device_driver *drv) }struct device *i3cdev_to_dev (struct i3c_device *i3cdev); -struct i3c_device *dev_to_i3cdev (struct device *dev); + +/** +* dev_to_i3cdev() - Returns the I3C device containing @dev +* @dev: device object +* +* Return: a pointer to an I3C device object. +*/ +#define dev_to_i3cdev (__dev) container_of_const(__dev, struct i3c_device, dev)const struct i3c_device_id * i3c_device_match_id(struct i3c_device *i3cdev,
Signature · 7 lines
2.39.0 -- linux-i3c mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-i3c
Re: [PATCH v2 02/16] i3c: move dev_to_i3cdev() to use container_of_const()
Quoted 8 lines · Greg Kroah-Hartman
The driver core is changing to pass some pointers as const, so move
dev_to_i3cdev()to usecontainer_of_const()to handle this change.dev_to_i3cdev()now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.Cc Alexandre Belloni <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 51 lines
--- drivers/i3c/device.c | 12 ------------ include/linux/i3c/device.h | 9 ++++++++- 2 files changed, 8 insertions(+), 13 deletions(-)drivers/i3c/device.c +0
-12@@ -208,18 +208,6 @@ struct device *i3cdev_to_dev(struct i3c_device *i3cdev) }EXPORT_SYMBOL_GPL (i3cdev_to_dev); -/** -* dev_to_i3cdev() - Returns the I3C device containing @dev -* @dev: device object -* -* Return: a pointer to an I3C device object. -*/ -struct i3c_device *dev_to_i3cdev (struct device *dev) -{ - return container_of(dev, struct i3c_device, dev); -} -EXPORT_SYMBOL_GPL (dev_to_i3cdev); -/** * i3c_device_match_id() - Returns the i3c_device_id entry matching @i3cdev * @i3cdev: I3C device include/linux/i3c/device.h +8
-1@@ -186,7 +186,14 @@ static inline struct i3c_driver *drv_to_i3cdrv(struct device_driver *drv) }struct device *i3cdev_to_dev (struct i3c_device *i3cdev); -struct i3c_device *dev_to_i3cdev (struct device *dev); + +/** +* dev_to_i3cdev() - Returns the I3C device containing @dev +* @dev: device object +* +* Return: a pointer to an I3C device object. +*/ +#define dev_to_i3cdev (__dev) container_of_const(__dev, struct i3c_device, dev)const struct i3c_device_id * i3c_device_match_id(struct i3c_device *i3cdev,Signature · 1 line
2.39.0
Signature · 8 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com -- linux-i3c mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-i3c
Greg Kroah-Hartman
maintainerPATCH v2 3/16 platform/surface: aggregator: move to_ssam_device() to use container_of_const()
In reply to Greg Kroah-HartmanThe driver core is changing to pass some pointers as const, so move to_ssam_device() to use container_of_const() to handle this change. to_ssam_device() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.
--- include/linux/surface_aggregator/device.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
include/linux/surface_aggregator/device.h +1 -4
@@ -229,10 +229,7 @@ static inline bool is_ssam_device(struct device *d)* Return: Returns a pointer to the &struct ssam_device wrapping the given * device @d. */ -static inline struct ssam_device *to_ssam_device (struct device *d) -{ - return container_of(d, struct ssam_device, dev); -} +#define to_ssam_device (d) container_of_const(d, struct ssam_device, dev)/** * to_ssam_device_driver() - Casts the given device driver to a SSAM client
Signature · 1 line
2.39.0
Re: [PATCH v2 03/16] platform/surface: aggregator: move to_ssam_device() to use container_of_const()
Hi,
Quoted 17 lines · Greg Kroah-Hartman
The driver core is changing to pass some pointers as const, so move
to_ssam_device()to usecontainer_of_const()to handle this change.to_ssam_device()now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.Cc Maximilian Luz <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- include/linux/surface_aggregator/device.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)include/linux/surface_aggregator/device.h +0
-0
include/linux/surface_aggregator/device.h static inline bool is_ssam_device(struct device *d) · line 232
Quoted 8 lines
include/linux/surface_aggregator/device.h +1
-4@@ -229,10 +229,7 @@ static inline bool is_ssam_device(struct device *d)* Return: Returns a pointer to the &struct ssam_device wrapping the given * device @d. */ -static inline struct ssam_device *to_ssam_device (struct device *d) -{ - return container_of(d, struct ssam_device, dev); -} +#define to_ssam_device (d) container_of_const(d, struct ssam_device, dev)
There is a kernel-doc comment for this helper, I'm not sure if sphinx is going to like changing this from a static inline to a #define ?
At a minimum I guess the generated docs are going to loose some type info by switching to a define. Can we keep this as a static inline ?
Regards,
Hans
Quoted 3 lines
include/linux/surface_aggregator/device.h +0
-0/** * to_ssam_device_driver() - Casts the given device driver to a SSAM client
Greg Kroah-Hartman
maintainerRe: [PATCH v2 03/16] platform/surface: aggregator: move to_ssam_device() to use container_of_const()
Quoted 32 lines · Hans de Goede
Hi,
Quoted 17 lines · Greg Kroah-Hartman
The driver core is changing to pass some pointers as const, so move
to_ssam_device()to usecontainer_of_const()to handle this change.to_ssam_device()now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.Cc Maximilian Luz <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- include/linux/surface_aggregator/device.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)include/linux/surface_aggregator/device.h +0
-0include/linux/surface_aggregator/device.h static inline bool is_ssam_device(struct device *d) · line 232
Quoted 8 lines
include/linux/surface_aggregator/device.h +1
-4@@ -229,10 +229,7 @@ static inline bool is_ssam_device(struct device *d)* Return: Returns a pointer to the &struct ssam_device wrapping the given * device @d. */ -static inline struct ssam_device *to_ssam_device (struct device *d) -{ - return container_of(d, struct ssam_device, dev); -} +#define to_ssam_device (d) container_of_const(d, struct ssam_device, dev)There is a kernel-doc comment for this helper, I'm not sure if sphinx is going to like changing this from a static inline to a #define ?
Quoted 2 lines
At a minimum I guess the generated docs are going to loose some type info by switching to a define. Can we keep this as a static inline ?
No, container_of_const() will not work properly as an inline function as you don't know the return type until the preprocessor runs. I thought kerneldoc should still work just fine here as it does work for defines in other places.
thanks,
greg k-h
Re: [PATCH v2 03/16] platform/surface: aggregator: move to_ssam_device() to use container_of_const()
Hi,
Quoted 33 lines · Greg Kroah-Hartman
Quoted 32 lines · Hans de Goede
Hi,
Quoted 17 lines · Greg Kroah-Hartman
The driver core is changing to pass some pointers as const, so move
to_ssam_device()to usecontainer_of_const()to handle this change.to_ssam_device()now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.Cc Maximilian Luz <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- include/linux/surface_aggregator/device.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)include/linux/surface_aggregator/device.h +0
-0include/linux/surface_aggregator/device.h static inline bool is_ssam_device(struct device *d) · line 232
Quoted 8 lines
include/linux/surface_aggregator/device.h +1
-4@@ -229,10 +229,7 @@ static inline bool is_ssam_device(struct device *d)* Return: Returns a pointer to the &struct ssam_device wrapping the given * device @d. */ -static inline struct ssam_device *to_ssam_device (struct device *d) -{ - return container_of(d, struct ssam_device, dev); -} +#define to_ssam_device (d) container_of_const(d, struct ssam_device, dev)There is a kernel-doc comment for this helper, I'm not sure if sphinx is going to like changing this from a static inline to a #define ?
Quoted 7 lines
Quoted 2 lines
At a minimum I guess the generated docs are going to loose some type info by switching to a define. Can we keep this as a static inline ?
No,
container_of_const()will not work properly as an inline function as you don't know the return type until the preprocessor runs. I thought kerneldoc should still work just fine here as it does work for defines in other places.
Ok then this is fine as is. Thanks for clarifying why the switch to a #define is necessary.
Regards,
Hans
Maximilian Luz
maintainerRe: [PATCH v2 03/16] platform/surface: aggregator: move to_ssam_device() to use container_of_const()
In reply to Greg Kroah-HartmanQuoted 18 lines · Greg Kroah-Hartman
The driver core is changing to pass some pointers as const, so move
to_ssam_device()to usecontainer_of_const()to handle this change.to_ssam_device()now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.Cc Maximilian Luz <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- include/linux/surface_aggregator/device.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)include/linux/surface_aggregator/device.h +0
-0@@ -229,10 +229,7 @@ static inline bool is_ssam_device(struct device *d)* Return: Returns a pointer to the &struct ssam_device wrapping the given
include/linux/surface_aggregator/device.h static inline bool is_ssam_device(struct device *d) · line 235
Quoted 10 lines
include/linux/surface_aggregator/device.h +1
-4* device @d. */ -static inline struct ssam_device *to_ssam_device (struct device *d) -{ - return container_of(d, struct ssam_device, dev); -} +#define to_ssam_device (d) container_of_const(d, struct ssam_device, dev)/** * to_ssam_device_driver() - Casts the given device driver to a SSAM client
A small note in addition to the comment by Hans: I think it might be a good idea to convert the to_ssam_device_driver() function as well. I could also send this in as a follow-up patch.
Regards,
Max
Greg Kroah-Hartman
maintainerRe: [PATCH v2 03/16] platform/surface: aggregator: move to_ssam_device() to use container_of_const()
Quoted 24 lines · Maximilian Luz
Quoted 23 lines · Greg Kroah-Hartman
The driver core is changing to pass some pointers as const, so move
to_ssam_device()to usecontainer_of_const()to handle this change.to_ssam_device()now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.Cc Maximilian Luz <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- include/linux/surface_aggregator/device.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)include/linux/surface_aggregator/device.h +0
-3@@ -229,10 +229,7 @@ static inline bool is_ssam_device(struct device *d)* Return: Returns a pointer to the &struct ssam_device wrapping the given * device @d. */ -static inline struct ssam_device *to_ssam_device (struct device *d) -{ - return container_of(d, struct ssam_device, dev);
Quoted 8 lines
include/linux/surface_aggregator/device.h static inline bool is_ssam_device(struct device *d) · line 235
Quoted 4 lines
include/linux/surface_aggregator/device.h +1
-1-} +#define to_ssam_device (d) container_of_const(d, struct ssam_device, dev)/** * to_ssam_device_driver() - Casts the given device driver to a SSAM client A small note in addition to the comment by Hans: I think it might be a good idea to convert the
to_ssam_device_driver()function as well. I could also send this in as a follow-up patch.
Sure, that can be a follow-on patch as it's not needed here.
thanks,
greg k-h
Re: [PATCH v2 03/16] platform/surface: aggregator: move to_ssam_device() to use container_of_const()
Quoted 34 lines · Greg Kroah-Hartman
Quoted 24 lines · Maximilian Luz
Quoted 23 lines · Greg Kroah-Hartman
The driver core is changing to pass some pointers as const, so move
to_ssam_device()to usecontainer_of_const()to handle this change.to_ssam_device()now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.Cc Maximilian Luz <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- include/linux/surface_aggregator/device.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)include/linux/surface_aggregator/device.h +0
-3@@ -229,10 +229,7 @@ static inline bool is_ssam_device(struct device *d)* Return: Returns a pointer to the &struct ssam_device wrapping the given * device @d. */ -static inline struct ssam_device *to_ssam_device (struct device *d) -{ - return container_of(d, struct ssam_device, dev);Quoted 8 lines
include/linux/surface_aggregator/device.h static inline bool is_ssam_device(struct device *d) · line 235
Quoted 4 lines
include/linux/surface_aggregator/device.h +1
-1-} +#define to_ssam_device (d) container_of_const(d, struct ssam_device, dev)/** * to_ssam_device_driver() - Casts the given device driver to a SSAM client A small note in addition to the comment by Hans: I think it might be a good idea to convert the
to_ssam_device_driver()function as well. I could also send this in as a follow-up patch.
Quoted 1 line
Sure, that can be a follow-on patch as it's not needed here.
Perfect, I'll do that.
As Hans' comment is now addressed, everything looks good to me.
Greg Kroah-Hartman
maintainerPATCH v2 4/16 firewire: move fw_device() and fw_unit() to use container_of_const()
In reply to Greg Kroah-HartmanThe driver core is changing to pass some pointers as const, so move fw_device() and fw_unit() functions to use container_of_const() to handle this change.
fw_device() and fw_unit() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.
This also required turning fw_parent_device() into a macro to preserve the const-ness of the pointer passed into it if necessary.
--- include/linux/firewire.h | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
include/linux/firewire.h +3 -12
@@ -208,10 +208,7 @@ struct fw_device {struct fw_attribute_group attribute_group; }; -static inline struct fw_device *fw_device (struct device *dev) -{ - return container_of(dev, struct fw_device, device); -} +#define fw_device (dev) container_of_const(dev, struct fw_device, device)static inline int fw_device_is_shutdown (struct fw_device *device) {
@@ -229,10 +226,7 @@ struct fw_unit {struct fw_attribute_group attribute_group; }; -static inline struct fw_unit *fw_unit (struct device *dev) -{ - return container_of(dev, struct fw_unit, device); -} +#define fw_unit (dev) container_of_const(dev, struct fw_unit, device)static inline struct fw_unit *fw_unit_get (struct fw_unit *unit) {
@@ -246,10 +240,7 @@ static inline void fw_unit_put(struct fw_unit *unit)put_device (&unit->device); } -static inline struct fw_device *fw_parent_device (struct fw_unit *unit) -{ -return fw_device (unit->device.parent); -} +#define fw_parent_device (unit) fw_device(unit->device.parent)struct ieee1394_device_id ;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH v2 5/16 driver core: make struct device_type.uevent() take a const *
In reply to Greg Kroah-HartmanThe 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.
--- block/partitions/core.c | 4 ++-- drivers/acpi/device_sysfs.c | 8 ++++---- drivers/acpi/internal.h | 2 +- drivers/firewire/core-device.c | 8 ++++---- drivers/gpu/drm/display/drm_dp_aux_bus.c | 2 +- drivers/i2c/i2c-core-base.c | 4 ++-- drivers/i3c/device.c | 2 +- drivers/i3c/master.c | 4 ++-- drivers/input/input.c | 16 ++++++++-------- drivers/media/rc/rc-main.c | 2 +- drivers/platform/surface/aggregator/bus.c | 4 ++-- drivers/soundwire/bus_type.c | 4 ++-- drivers/thunderbolt/switch.c | 4 ++-- drivers/thunderbolt/tb.h | 2 +- drivers/thunderbolt/xdomain.c | 6 +++--- drivers/tty/serdev/core.c | 2 +- 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 +- include/linux/acpi.h | 4 ++-- include/linux/device.h | 2 +- include/linux/i3c/device.h | 2 +- include/linux/soundwire/sdw_type.h | 2 +- 25 files changed, 53 insertions(+), 54 deletions(-)
block/partitions/core.c +2 -2
@@ -254,9 +254,9 @@ static void part_release(struct device *dev)iput (dev_to_bdev (dev)->bd_inode); } -static int part_uevent (struct device *dev,struct kobj_uevent_env *env) +static int part_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct block_device *part =dev_to_bdev (dev); +const struct block_device *part =dev_to_bdev (dev);add_uevent_var (env,"PARTN=%u" , part->bd_partno);if (part->bd_meta_info && part->bd_meta_info->volname[0 ])
drivers/acpi/device_sysfs.c +4 -4
@@ -133,7 +133,7 @@ static void acpi_hide_nondev_subnodes(struct acpi_device_data *data)* -EINVAL: output error * -ENOMEM: output is truncated */ -static int create_pnp_modalias (struct acpi_device *acpi_dev,char *modalias, +static int create_pnp_modalias (const struct acpi_device *acpi_dev,char *modalias,int size) {int len;
@@ -191,7 +191,7 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias,* only be called for devices having ACPI_DT_NAMESPACE_HID in their list of * ACPI/PNP IDs. */ -static int create_of_modalias (struct acpi_device *acpi_dev,char *modalias, +static int create_of_modalias (const struct acpi_device *acpi_dev,char *modalias,int size) {struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER };
@@ -239,7 +239,7 @@ static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias,return len; } -int __acpi_device_uevent_modalias (struct acpi_device *adev, +int __acpi_device_uevent_modalias (const struct acpi_device *adev,struct kobj_uevent_env *env) {int len;
@@ -277,7 +277,7 @@ int __acpi_device_uevent_modalias(struct acpi_device *adev,* Because other buses do not support ACPI HIDs & CIDs, e.g. for a device with * hid:IBM0001 and cid:ACPI0001 you get: "acpi:IBM0001:ACPI0001". */ -int acpi_device_uevent_modalias (struct device *dev,struct kobj_uevent_env *env) +int acpi_device_uevent_modalias (const struct device *dev,struct kobj_uevent_env *env) {return __acpi_device_uevent_modalias (acpi_companion_match (dev), env); }
drivers/acpi/internal.h +1 -1
@@ -120,7 +120,7 @@ int acpi_bus_register_early_device(int type);Device Matching and Notification -------------------------------------------------------------------------- */ struct acpi_device *acpi_companion_match (const struct device *dev); -int __acpi_device_uevent_modalias (struct acpi_device *adev, +int __acpi_device_uevent_modalias (const struct acpi_device *adev,struct kobj_uevent_env *env);/* --------------------------------------------------------------------------
drivers/firewire/core-device.c +4 -4
@@ -133,7 +133,7 @@ static void get_ids(const u32 *directory, int *id) } } -static void get_modalias_ids (struct fw_unit *unit,int *id) +static void get_modalias_ids (const struct fw_unit *unit,int *id) {get_ids (&fw_parent_device (unit)->config_rom[5 ], id);get_ids (unit->directory, id);
@@ -195,7 +195,7 @@ static void fw_unit_remove(struct device *dev) driver->remove (fw_unit (dev)); } -static int get_modalias (struct fw_unit *unit,char *buffer,size_t buffer_size) +static int get_modalias (const struct fw_unit *unit,char *buffer,size_t buffer_size) {int id[] = {0 ,0 ,0 ,0 };
@@ -206,9 +206,9 @@ static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size) id[0], id[1], id[2], id[3]); } -static int fw_unit_uevent (struct device *dev,struct kobj_uevent_env *env) +static int fw_unit_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct fw_unit *unit =fw_unit (dev); +const struct fw_unit *unit =fw_unit (dev);char modalias[64 ];get_modalias (unit, modalias,sizeof (modalias));
drivers/gpu/drm/display/drm_dp_aux_bus.c +1 -1
@@ -161,7 +161,7 @@ static void dp_aux_ep_dev_release(struct device *dev)kfree (aux_ep_with_data); } -static int dp_aux_ep_dev_modalias (struct device *dev,struct kobj_uevent_env *env) +static int dp_aux_ep_dev_modalias (const struct device *dev,struct kobj_uevent_env *env) {return of_device_uevent_modalias (dev, env); }
drivers/i2c/i2c-core-base.c +2 -2
@@ -136,9 +136,9 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int i2c_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int i2c_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct i2c_client *client =to_i2c_client (dev); +const struct i2c_client *client =to_i2c_client (dev);int rc; rc =of_device_uevent_modalias (dev, env);
drivers/i3c/device.c +1 -1
@@ -78,7 +78,7 @@ EXPORT_SYMBOL_GPL(i3c_device_do_setdasa);* * Retrieve I3C dev info. */ -void i3c_device_get_info (struct i3c_device *dev, +void i3c_device_get_info (const struct i3c_device *dev,struct i3c_device_info *info) {if (!info)
drivers/i3c/master.c +2 -2
@@ -273,9 +273,9 @@ static struct attribute *i3c_device_attrs[] = { };ATTRIBUTE_GROUPS (i3c_device); -static int i3c_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int i3c_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct i3c_device *i3cdev =dev_to_i3cdev (dev); +const struct i3c_device *i3cdev =dev_to_i3cdev (dev);struct i3c_device_info devinfo;u16 manuf, part, ext;
drivers/input/input.c +8 -8
@@ -1372,7 +1372,7 @@ INPUT_DEV_STRING_ATTR_SHOW(phys);INPUT_DEV_STRING_ATTR_SHOW (uniq);static int input_print_modalias_bits (char *buf,int size, -char name,unsigned long *bm, +char name,const unsigned long *bm,unsigned int min_bit,unsigned int max_bit) {int len =0 , i;
@@ -1384,7 +1384,7 @@ static int input_print_modalias_bits(char *buf, int size,return len; } -static int input_print_modalias (char *buf,int size,struct input_dev *id, +static int input_print_modalias (char *buf,int size,const struct input_dev *id,int add_cr) {int len;
@@ -1432,7 +1432,7 @@ static ssize_t input_dev_show_modalias(struct device *dev, } static DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); -static int input_print_bitmap (char *buf,int buf_size,unsigned long *bitmap, +static int input_print_bitmap (char *buf,int buf_size,const unsigned long *bitmap,int max,int add_cr); static ssize_t input_dev_show_properties(struct device *dev,
@@ -1524,7 +1524,7 @@ static const struct attribute_group input_dev_id_attr_group = { .attrs = input_dev_id_attrs, }; -static int input_print_bitmap (char *buf,int buf_size,unsigned long *bitmap, +static int input_print_bitmap (char *buf,int buf_size,const unsigned long *bitmap,int max,int add_cr) {int i;
@@ -1621,7 +1621,7 @@ static void input_dev_release(struct device *device)* device bitfields. */ static int input_add_uevent_bm_var (struct kobj_uevent_env *env, -const char *name,unsigned long *bitmap,int max) +const char *name,const unsigned long *bitmap,int max) {int len;
@@ -1639,7 +1639,7 @@ static int input_add_uevent_bm_var(struct kobj_uevent_env *env, }static int input_add_uevent_modalias_var (struct kobj_uevent_env *env, -struct input_dev *dev) +const struct input_dev *dev) {int len;
@@ -1677,9 +1677,9 @@ static int input_add_uevent_modalias_var(struct kobj_uevent_env *env,return err; \ }while (0 ) -static int input_dev_uevent(struct device *device, struct kobj_uevent_env *env) +static int input_dev_uevent(const struct device *device, struct kobj_uevent_env *env) { -struct input_dev *dev =to_input_dev (device); +const struct input_dev *dev =to_input_dev (device); INPUT_ADD_HOTPLUG_VAR("PRODUCT=%x/%x/%x/%x", dev->id.bustype, dev->id.vendor,
drivers/media/rc/rc-main.c +1 -1
@@ -1614,7 +1614,7 @@ static void rc_dev_release(struct device *device)kfree (dev); } -static int rc_dev_uevent (struct device *device,struct kobj_uevent_env *env) +static int rc_dev_uevent (const struct device *device,struct kobj_uevent_env *env) {struct rc_dev *dev =to_rc_dev (device);int ret =0 ;
drivers/platform/surface/aggregator/bus.c +2 -2
@@ -35,9 +35,9 @@ static struct attribute *ssam_device_attrs[] = { };ATTRIBUTE_GROUPS (ssam_device); -static int ssam_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ssam_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct ssam_device *sdev =to_ssam_device (dev); +const struct ssam_device *sdev =to_ssam_device (dev); return add_uevent_var(env, "MODALIAS=ssam:d%02Xc%02Xt%02Xi%02Xf%02X", sdev->uid.domain, sdev->uid.category,
drivers/soundwire/bus_type.c +2 -2
@@ -58,9 +58,9 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size) slave->id.sdw_version, slave->id.class_id); } -int sdw_slave_uevent (struct device *dev,struct kobj_uevent_env *env) +int sdw_slave_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +const struct sdw_slave *slave =dev_to_sdw_dev (dev);char modalias[32 ];sdw_slave_modalias (slave, modalias,sizeof (modalias));
drivers/thunderbolt/switch.c +2 -2
@@ -2176,9 +2176,9 @@ static void tb_switch_release(struct device *dev)kfree (sw); } -static int tb_switch_uevent (struct device *dev,struct kobj_uevent_env *env) +static int tb_switch_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct tb_switch *sw =tb_to_switch (dev); +const struct tb_switch *sw =tb_to_switch (dev);const char *type;if (sw->config.thunderbolt_version ==USB4_VERSION_1_0 ) {
drivers/thunderbolt/tb.h +1 -1
@@ -815,7 +815,7 @@ static inline bool tb_is_switch(const struct device *dev)return dev->type == &tb_switch_type; } -static inline struct tb_switch *tb_to_switch (struct device *dev) +static inline struct tb_switch *tb_to_switch (const struct device *dev) {if (tb_is_switch (dev)) return container_of(dev, struct tb_switch, dev);
drivers/thunderbolt/xdomain.c +3 -3
@@ -881,7 +881,7 @@ static ssize_t key_show(struct device *dev, struct device_attribute *attr, }static DEVICE_ATTR_RO (key); -static int get_modalias (struct tb_service *svc,char *buf,size_t size) +static int get_modalias (const struct tb_service *svc,char *buf,size_t size) {return snprintf (buf, size,"tbsvc:k%sp%08Xv%08Xr%08X" , svc->key, svc->prtcid, svc->prtcvers, svc->prtcrevs);
@@ -953,9 +953,9 @@ static const struct attribute_group *tb_service_attr_groups[] = { NULL, }; -static int tb_service_uevent (struct device *dev,struct kobj_uevent_env *env) +static int tb_service_uevent (const struct device *dev,struct kobj_uevent_env *env) { - struct tb_service *svc = container_of(dev, struct tb_service, dev); + const struct tb_service *svc = container_of_const(dev, struct tb_service, dev);char modalias[64 ];get_modalias (svc, modalias,sizeof (modalias));
drivers/tty/serdev/core.c +1 -1
@@ -42,7 +42,7 @@ static struct attribute *serdev_device_attrs[] = { };ATTRIBUTE_GROUPS (serdev_device); -static int serdev_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int serdev_device_uevent (const struct device *dev,struct kobj_uevent_env *env) {int rc;
drivers/usb/core/message.c +4 -4
@@ -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);
drivers/usb/core/usb.c +2 -2
@@ -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);
drivers/usb/phy/phy.c +3 -3
@@ -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;
drivers/usb/roles/class.c +1 -2
@@ -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;
drivers/usb/typec/class.c +1 -1
@@ -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;
include/linux/acpi.h +2 -2
@@ -723,7 +723,7 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,const void *acpi_device_get_match_data (const struct device *dev);extern bool acpi_driver_match_device (struct device *dev,const struct device_driver *drv); -int acpi_device_uevent_modalias (struct device *,struct kobj_uevent_env *); +int acpi_device_uevent_modalias (const struct device *,struct kobj_uevent_env *);int acpi_device_modalias (struct device *,char *,int ); struct platform_device *acpi_create_platform_device(struct acpi_device *,
@@ -958,7 +958,7 @@ static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,return NULL ; } -static inline int acpi_device_uevent_modalias (struct device *dev, +static inline int acpi_device_uevent_modalias (const struct device *dev,struct kobj_uevent_env *env) {return -ENODEV ;
include/linux/device.h +1 -1
@@ -88,7 +88,7 @@ int subsys_virtual_register(struct bus_type *subsys,struct device_type {const char *name;const struct attribute_group **groups; -int (*uevent)(struct device *dev,struct kobj_uevent_env *env); +int (*uevent)(const struct device *dev,struct kobj_uevent_env *env);char *(*devnode)(struct device *dev,umode_t *mode,kuid_t *uid,kgid_t *gid);void (*release)(struct device *dev);
include/linux/i3c/device.h +1 -1
@@ -303,7 +303,7 @@ int i3c_device_do_priv_xfers(struct i3c_device *dev,int i3c_device_do_setdasa (struct i3c_device *dev); -void i3c_device_get_info (struct i3c_device *dev,struct i3c_device_info *info); +void i3c_device_get_info (const struct i3c_device *dev,struct i3c_device_info *info);struct i3c_ibi_payload {unsigned int len;
include/linux/soundwire/sdw_type.h +1 -1
@@ -21,7 +21,7 @@ static inline int is_sdw_slave(const struct device *dev)int __sdw_register_driver (struct sdw_driver *drv,struct module *owner);void sdw_unregister_driver (struct sdw_driver *drv); -int sdw_slave_uevent (struct device *dev,struct kobj_uevent_env *env); +int sdw_slave_uevent (const struct device *dev,struct kobj_uevent_env *env);/** * module_sdw_driver() - Helper macro for registering a Soundwire driver
Signature · 1 line
2.39.0
Re: [PATCH v2 05/16] driver core: make struct device_type.uevent() take a const *
Quoted 48 lines · Greg Kroah-Hartman
The
uevent()callback in structdevice_typeshould 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 Jens Axboe <[email protected]>Cc Len Brown <[email protected]>Cc Stefan Richter <[email protected]>Cc Wolfram Sang <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc Sean Young <[email protected]>Cc Rob Herring <[email protected]>Cc Frank Rowand <[email protected]>Cc Maximilian Luz <[email protected]>Cc Hans de Goede <[email protected]>Cc Mark Gross <[email protected]>Cc Vinod Koul <[email protected]>Cc Bard Liao <[email protected]>Cc Pierre-Louis Bossart <[email protected]>Cc Sanyog Kale <[email protected]>Cc Andreas Noever <[email protected]>Cc Michael Jamet <[email protected]>Cc Yehezkel Bernat <[email protected]>Cc Jiri Slaby <[email protected]>Cc Heikki Krogerus <[email protected]>Cc "Matthew Wilcox (Oracle)" <[email protected]>Cc "Martin K. Petersen" <[email protected]>Cc Chaitanya Kulkarni <[email protected]>Cc Ming Lei <[email protected]>Cc Jilin Yuan <[email protected]>Cc Alan Stern <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Sakari Ailus <[email protected]>Cc Jason Gunthorpe <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ira Weiny <[email protected]>Cc Dan Williams <[email protected]>Cc Won Chung <[email protected]>
Quoted 8 lines
Re: [PATCH v2 05/16] driver core: make struct device_type.uevent() take a const *
In reply to Greg Kroah-HartmanQuoted 4 lines · Greg Kroah-Hartman
The
uevent()callback in structdevice_typeshould 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.
Signature · 1 line
~Vinod
Re: [PATCH v2 05/16] driver core: make struct device_type.uevent() take a const *
In reply to Greg Kroah-HartmanQuoted 48 lines · Greg Kroah-Hartman
The
uevent()callback in structdevice_typeshould 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 Jens Axboe <[email protected]>Cc Len Brown <[email protected]>Cc Stefan Richter <[email protected]>Cc Wolfram Sang <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc Sean Young <[email protected]>Cc Rob Herring <[email protected]>Cc Frank Rowand <[email protected]>Cc Maximilian Luz <[email protected]>Cc Hans de Goede <[email protected]>Cc Mark Gross <[email protected]>Cc Vinod Koul <[email protected]>Cc Bard Liao <[email protected]>Cc Pierre-Louis Bossart <[email protected]>Cc Sanyog Kale <[email protected]>Cc Andreas Noever <[email protected]>Cc Michael Jamet <[email protected]>Cc Yehezkel Bernat <[email protected]>Cc Jiri Slaby <[email protected]>Cc Heikki Krogerus <[email protected]>Cc "Matthew Wilcox (Oracle)" <[email protected]>Cc "Martin K. Petersen" <[email protected]>Cc Chaitanya Kulkarni <[email protected]>Cc Ming Lei <[email protected]>Cc Jilin Yuan <[email protected]>Cc Alan Stern <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Sakari Ailus <[email protected]>Cc Jason Gunthorpe <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ira Weiny <[email protected]>Cc Dan Williams <[email protected]>Cc Won Chung <[email protected]>
Quoted 8 lines
Quoted 523 lines
--- block/partitions/core.c | 4 ++-- drivers/acpi/device_sysfs.c | 8 ++++---- drivers/acpi/internal.h | 2 +- drivers/firewire/core-device.c | 8 ++++---- drivers/gpu/drm/display/drm_dp_aux_bus.c | 2 +- drivers/i2c/i2c-core-base.c | 4 ++-- drivers/i3c/device.c | 2 +- drivers/i3c/master.c | 4 ++-- drivers/input/input.c | 16 ++++++++-------- drivers/media/rc/rc-main.c | 2 +- drivers/platform/surface/aggregator/bus.c | 4 ++-- drivers/soundwire/bus_type.c | 4 ++-- drivers/thunderbolt/switch.c | 4 ++-- drivers/thunderbolt/tb.h | 2 +- drivers/thunderbolt/xdomain.c | 6 +++--- drivers/tty/serdev/core.c | 2 +- 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 +- include/linux/acpi.h | 4 ++-- include/linux/device.h | 2 +- include/linux/i3c/device.h | 2 +- include/linux/soundwire/sdw_type.h | 2 +- 25 files changed, 53 insertions(+), 54 deletions(-)block/partitions/core.c +2
-2@@ -254,9 +254,9 @@ static void part_release(struct device *dev)iput (dev_to_bdev (dev)->bd_inode); } -static int part_uevent (struct device *dev,struct kobj_uevent_env *env) +static int part_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct block_device *part =dev_to_bdev (dev); +const struct block_device *part =dev_to_bdev (dev);add_uevent_var (env,"PARTN=%u" , part->bd_partno);if (part->bd_meta_info && part->bd_meta_info->volname[0 ])drivers/acpi/device_sysfs.c +4
-4@@ -133,7 +133,7 @@ static void acpi_hide_nondev_subnodes(struct acpi_device_data *data)* -EINVAL: output error * -ENOMEM: output is truncated */ -static int create_pnp_modalias (struct acpi_device *acpi_dev,char *modalias, +static int create_pnp_modalias (const struct acpi_device *acpi_dev,char *modalias,int size) {int len;@@ -191,7 +191,7 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias,* only be called for devices having ACPI_DT_NAMESPACE_HID in their list of * ACPI/PNP IDs. */ -static int create_of_modalias (struct acpi_device *acpi_dev,char *modalias, +static int create_of_modalias (const struct acpi_device *acpi_dev,char *modalias,int size) {struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER };@@ -239,7 +239,7 @@ static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias,return len; } -int __acpi_device_uevent_modalias (struct acpi_device *adev, +int __acpi_device_uevent_modalias (const struct acpi_device *adev,struct kobj_uevent_env *env) {int len;@@ -277,7 +277,7 @@ int __acpi_device_uevent_modalias(struct acpi_device *adev,* Because other buses do not support ACPI HIDs & CIDs, e.g. for a device with * hid:IBM0001 and cid:ACPI0001 you get: "acpi:IBM0001:ACPI0001". */ -int acpi_device_uevent_modalias (struct device *dev,struct kobj_uevent_env *env) +int acpi_device_uevent_modalias (const struct device *dev,struct kobj_uevent_env *env) {return __acpi_device_uevent_modalias (acpi_companion_match (dev), env); }drivers/acpi/internal.h +1
-1@@ -120,7 +120,7 @@ int acpi_bus_register_early_device(int type);Device Matching and Notification -------------------------------------------------------------------------- */ struct acpi_device *acpi_companion_match (const struct device *dev); -int __acpi_device_uevent_modalias (struct acpi_device *adev, +int __acpi_device_uevent_modalias (const struct acpi_device *adev,struct kobj_uevent_env *env);/* -------------------------------------------------------------------------- drivers/firewire/core-device.c +4
-4@@ -133,7 +133,7 @@ static void get_ids(const u32 *directory, int *id) } } -static void get_modalias_ids (struct fw_unit *unit,int *id) +static void get_modalias_ids (const struct fw_unit *unit,int *id) {get_ids (&fw_parent_device (unit)->config_rom[5 ], id);get_ids (unit->directory, id);@@ -195,7 +195,7 @@ static void fw_unit_remove(struct device *dev) driver->remove (fw_unit (dev)); } -static int get_modalias (struct fw_unit *unit,char *buffer,size_t buffer_size) +static int get_modalias (const struct fw_unit *unit,char *buffer,size_t buffer_size) {int id[] = {0 ,0 ,0 ,0 };@@ -206,9 +206,9 @@ static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size) id[0], id[1], id[2], id[3]); } -static int fw_unit_uevent (struct device *dev,struct kobj_uevent_env *env) +static int fw_unit_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct fw_unit *unit =fw_unit (dev); +const struct fw_unit *unit =fw_unit (dev);char modalias[64 ];get_modalias (unit, modalias,sizeof (modalias));drivers/gpu/drm/display/drm_dp_aux_bus.c +1
-1@@ -161,7 +161,7 @@ static void dp_aux_ep_dev_release(struct device *dev)kfree (aux_ep_with_data); } -static int dp_aux_ep_dev_modalias (struct device *dev,struct kobj_uevent_env *env) +static int dp_aux_ep_dev_modalias (const struct device *dev,struct kobj_uevent_env *env) {return of_device_uevent_modalias (dev, env); }drivers/i2c/i2c-core-base.c +2
-2@@ -136,9 +136,9 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int i2c_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int i2c_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct i2c_client *client =to_i2c_client (dev); +const struct i2c_client *client =to_i2c_client (dev);int rc; rc =of_device_uevent_modalias (dev, env);drivers/i3c/device.c +1
-1@@ -78,7 +78,7 @@ EXPORT_SYMBOL_GPL(i3c_device_do_setdasa);* * Retrieve I3C dev info. */ -void i3c_device_get_info (struct i3c_device *dev, +void i3c_device_get_info (const struct i3c_device *dev,struct i3c_device_info *info) {if (!info)drivers/i3c/master.c +2
-2@@ -273,9 +273,9 @@ static struct attribute *i3c_device_attrs[] = { };ATTRIBUTE_GROUPS (i3c_device); -static int i3c_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int i3c_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct i3c_device *i3cdev =dev_to_i3cdev (dev); +const struct i3c_device *i3cdev =dev_to_i3cdev (dev);struct i3c_device_info devinfo;u16 manuf, part, ext;drivers/input/input.c +8
-8@@ -1372,7 +1372,7 @@ INPUT_DEV_STRING_ATTR_SHOW(phys);INPUT_DEV_STRING_ATTR_SHOW (uniq);static int input_print_modalias_bits (char *buf,int size, -char name,unsigned long *bm, +char name,const unsigned long *bm,unsigned int min_bit,unsigned int max_bit) {int len =0 , i;@@ -1384,7 +1384,7 @@ static int input_print_modalias_bits(char *buf, int size,return len; } -static int input_print_modalias (char *buf,int size,struct input_dev *id, +static int input_print_modalias (char *buf,int size,const struct input_dev *id,int add_cr) {int len;@@ -1432,7 +1432,7 @@ static ssize_t input_dev_show_modalias(struct device *dev, } static DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); -static int input_print_bitmap (char *buf,int buf_size,unsigned long *bitmap, +static int input_print_bitmap (char *buf,int buf_size,const unsigned long *bitmap,int max,int add_cr); static ssize_t input_dev_show_properties(struct device *dev,@@ -1524,7 +1524,7 @@ static const struct attribute_group input_dev_id_attr_group = { .attrs = input_dev_id_attrs, }; -static int input_print_bitmap (char *buf,int buf_size,unsigned long *bitmap, +static int input_print_bitmap (char *buf,int buf_size,const unsigned long *bitmap,int max,int add_cr) {int i;@@ -1621,7 +1621,7 @@ static void input_dev_release(struct device *device)* device bitfields. */ static int input_add_uevent_bm_var (struct kobj_uevent_env *env, -const char *name,unsigned long *bitmap,int max) +const char *name,const unsigned long *bitmap,int max) {int len;@@ -1639,7 +1639,7 @@ static int input_add_uevent_bm_var(struct kobj_uevent_env *env, }static int input_add_uevent_modalias_var (struct kobj_uevent_env *env, -struct input_dev *dev) +const struct input_dev *dev) {int len;@@ -1677,9 +1677,9 @@ static int input_add_uevent_modalias_var(struct kobj_uevent_env *env,return err; \ }while (0 ) -static int input_dev_uevent(struct device *device, struct kobj_uevent_env *env) +static int input_dev_uevent(const struct device *device, struct kobj_uevent_env *env) { -struct input_dev *dev =to_input_dev (device); +const struct input_dev *dev =to_input_dev (device); INPUT_ADD_HOTPLUG_VAR("PRODUCT=%x/%x/%x/%x", dev->id.bustype, dev->id.vendor,drivers/media/rc/rc-main.c +1
-1@@ -1614,7 +1614,7 @@ static void rc_dev_release(struct device *device)kfree (dev); } -static int rc_dev_uevent (struct device *device,struct kobj_uevent_env *env) +static int rc_dev_uevent (const struct device *device,struct kobj_uevent_env *env) {struct rc_dev *dev =to_rc_dev (device);int ret =0 ;drivers/platform/surface/aggregator/bus.c +2
-2@@ -35,9 +35,9 @@ static struct attribute *ssam_device_attrs[] = { };ATTRIBUTE_GROUPS (ssam_device); -static int ssam_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ssam_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct ssam_device *sdev =to_ssam_device (dev); +const struct ssam_device *sdev =to_ssam_device (dev); return add_uevent_var(env, "MODALIAS=ssam:d%02Xc%02Xt%02Xi%02Xf%02X", sdev->uid.domain, sdev->uid.category,drivers/soundwire/bus_type.c +2
-2@@ -58,9 +58,9 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size) slave->id.sdw_version, slave->id.class_id); } -int sdw_slave_uevent (struct device *dev,struct kobj_uevent_env *env) +int sdw_slave_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +const struct sdw_slave *slave =dev_to_sdw_dev (dev);char modalias[32 ];sdw_slave_modalias (slave, modalias,sizeof (modalias));drivers/thunderbolt/switch.c +2
-2@@ -2176,9 +2176,9 @@ static void tb_switch_release(struct device *dev)kfree (sw); } -static int tb_switch_uevent (struct device *dev,struct kobj_uevent_env *env) +static int tb_switch_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct tb_switch *sw =tb_to_switch (dev); +const struct tb_switch *sw =tb_to_switch (dev);const char *type;if (sw->config.thunderbolt_version ==USB4_VERSION_1_0 ) {drivers/thunderbolt/tb.h +1
-1@@ -815,7 +815,7 @@ static inline bool tb_is_switch(const struct device *dev)return dev->type == &tb_switch_type; } -static inline struct tb_switch *tb_to_switch (struct device *dev) +static inline struct tb_switch *tb_to_switch (const struct device *dev) {if (tb_is_switch (dev)) return container_of(dev, struct tb_switch, dev);drivers/thunderbolt/xdomain.c +3
-3@@ -881,7 +881,7 @@ static ssize_t key_show(struct device *dev, struct device_attribute *attr, }static DEVICE_ATTR_RO (key); -static int get_modalias (struct tb_service *svc,char *buf,size_t size) +static int get_modalias (const struct tb_service *svc,char *buf,size_t size) {return snprintf (buf, size,"tbsvc:k%sp%08Xv%08Xr%08X" , svc->key, svc->prtcid, svc->prtcvers, svc->prtcrevs);@@ -953,9 +953,9 @@ static const struct attribute_group *tb_service_attr_groups[] = { NULL, }; -static int tb_service_uevent (struct device *dev,struct kobj_uevent_env *env) +static int tb_service_uevent (const struct device *dev,struct kobj_uevent_env *env) { - struct tb_service *svc = container_of(dev, struct tb_service, dev); + const struct tb_service *svc = container_of_const(dev, struct tb_service, dev);char modalias[64 ];get_modalias (svc, modalias,sizeof (modalias));drivers/tty/serdev/core.c +1
-1@@ -42,7 +42,7 @@ static struct attribute *serdev_device_attrs[] = { };ATTRIBUTE_GROUPS (serdev_device); -static int serdev_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int serdev_device_uevent (const struct device *dev,struct kobj_uevent_env *env) {int rc;drivers/usb/core/message.c +4
-4@@ -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);drivers/usb/core/usb.c +2
-2@@ -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);drivers/usb/phy/phy.c +3
-3@@ -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;drivers/usb/roles/class.c +1
-2@@ -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;drivers/usb/typec/class.c +1
-1@@ -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;include/linux/acpi.h +2
-2@@ -723,7 +723,7 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,const void *acpi_device_get_match_data (const struct device *dev);extern bool acpi_driver_match_device (struct device *dev,const struct device_driver *drv); -int acpi_device_uevent_modalias (struct device *,struct kobj_uevent_env *); +int acpi_device_uevent_modalias (const struct device *,struct kobj_uevent_env *);int acpi_device_modalias (struct device *,char *,int ); struct platform_device *acpi_create_platform_device(struct acpi_device *,@@ -958,7 +958,7 @@ static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,return NULL ; } -static inline int acpi_device_uevent_modalias (struct device *dev, +static inline int acpi_device_uevent_modalias (const struct device *dev,struct kobj_uevent_env *env) {return -ENODEV ;include/linux/device.h +1
-1@@ -88,7 +88,7 @@ int subsys_virtual_register(struct bus_type *subsys,struct device_type {const char *name;const struct attribute_group **groups; -int (*uevent)(struct device *dev,struct kobj_uevent_env *env); +int (*uevent)(const struct device *dev,struct kobj_uevent_env *env);char *(*devnode)(struct device *dev,umode_t *mode,kuid_t *uid,kgid_t *gid);void (*release)(struct device *dev);include/linux/i3c/device.h +1
-1@@ -303,7 +303,7 @@ int i3c_device_do_priv_xfers(struct i3c_device *dev,int i3c_device_do_setdasa (struct i3c_device *dev); -void i3c_device_get_info (struct i3c_device *dev,struct i3c_device_info *info); +void i3c_device_get_info (const struct i3c_device *dev,struct i3c_device_info *info);struct i3c_ibi_payload {unsigned int len;include/linux/soundwire/sdw_type.h +1
-1@@ -21,7 +21,7 @@ static inline int is_sdw_slave(const struct device *dev)int __sdw_register_driver (struct sdw_driver *drv,struct module *owner);void sdw_unregister_driver (struct sdw_driver *drv); -int sdw_slave_uevent (struct device *dev,struct kobj_uevent_env *env); +int sdw_slave_uevent (const struct device *dev,struct kobj_uevent_env *env);/** * module_sdw_driver() - Helper macro for registering a Soundwire driver Signature · 1 line
2.39.0
Signature · 8 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com -- linux-i3c mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-i3c
Re: [PATCH v2 05/16] driver core: make struct device_type.uevent() take a const *
In reply to Greg Kroah-HartmanQuoted 48 lines · Greg Kroah-Hartman
The
uevent()callback in structdevice_typeshould 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 Jens Axboe <[email protected]>Cc Len Brown <[email protected]>Cc Stefan Richter <[email protected]>Cc Wolfram Sang <[email protected]>Cc Alexandre Belloni <[email protected]>Cc Dmitry Torokhov <[email protected]>Cc Sean Young <[email protected]>Cc Rob Herring <[email protected]>Cc Frank Rowand <[email protected]>Cc Maximilian Luz <[email protected]>Cc Hans de Goede <[email protected]>Cc Mark Gross <[email protected]>Cc Vinod Koul <[email protected]>Cc Bard Liao <[email protected]>Cc Pierre-Louis Bossart <[email protected]>Cc Sanyog Kale <[email protected]>Cc Andreas Noever <[email protected]>Cc Michael Jamet <[email protected]>Cc Yehezkel Bernat <[email protected]>Cc Jiri Slaby <[email protected]>Cc Heikki Krogerus <[email protected]>Cc "Matthew Wilcox (Oracle)" <[email protected]>Cc "Martin K. Petersen" <[email protected]>Cc Chaitanya Kulkarni <[email protected]>Cc Ming Lei <[email protected]>Cc Jilin Yuan <[email protected]>Cc Alan Stern <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Sakari Ailus <[email protected]>Cc Jason Gunthorpe <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ira Weiny <[email protected]>Cc Dan Williams <[email protected]>Cc Won Chung <[email protected]>
Quoted 8 lines
Quoted 522 lines
--- block/partitions/core.c | 4 ++-- drivers/acpi/device_sysfs.c | 8 ++++---- drivers/acpi/internal.h | 2 +- drivers/firewire/core-device.c | 8 ++++---- drivers/gpu/drm/display/drm_dp_aux_bus.c | 2 +- drivers/i2c/i2c-core-base.c | 4 ++-- drivers/i3c/device.c | 2 +- drivers/i3c/master.c | 4 ++-- drivers/input/input.c | 16 ++++++++-------- drivers/media/rc/rc-main.c | 2 +- drivers/platform/surface/aggregator/bus.c | 4 ++-- drivers/soundwire/bus_type.c | 4 ++-- drivers/thunderbolt/switch.c | 4 ++-- drivers/thunderbolt/tb.h | 2 +- drivers/thunderbolt/xdomain.c | 6 +++--- drivers/tty/serdev/core.c | 2 +- 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 +- include/linux/acpi.h | 4 ++-- include/linux/device.h | 2 +- include/linux/i3c/device.h | 2 +- include/linux/soundwire/sdw_type.h | 2 +- 25 files changed, 53 insertions(+), 54 deletions(-)block/partitions/core.c +2
-2@@ -254,9 +254,9 @@ static void part_release(struct device *dev)iput (dev_to_bdev (dev)->bd_inode); } -static int part_uevent (struct device *dev,struct kobj_uevent_env *env) +static int part_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct block_device *part =dev_to_bdev (dev); +const struct block_device *part =dev_to_bdev (dev);add_uevent_var (env,"PARTN=%u" , part->bd_partno);if (part->bd_meta_info && part->bd_meta_info->volname[0 ])drivers/acpi/device_sysfs.c +4
-4@@ -133,7 +133,7 @@ static void acpi_hide_nondev_subnodes(struct acpi_device_data *data)* -EINVAL: output error * -ENOMEM: output is truncated */ -static int create_pnp_modalias (struct acpi_device *acpi_dev,char *modalias, +static int create_pnp_modalias (const struct acpi_device *acpi_dev,char *modalias,int size) {int len;@@ -191,7 +191,7 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias,* only be called for devices having ACPI_DT_NAMESPACE_HID in their list of * ACPI/PNP IDs. */ -static int create_of_modalias (struct acpi_device *acpi_dev,char *modalias, +static int create_of_modalias (const struct acpi_device *acpi_dev,char *modalias,int size) {struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER };@@ -239,7 +239,7 @@ static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias,return len; } -int __acpi_device_uevent_modalias (struct acpi_device *adev, +int __acpi_device_uevent_modalias (const struct acpi_device *adev,struct kobj_uevent_env *env) {int len;@@ -277,7 +277,7 @@ int __acpi_device_uevent_modalias(struct acpi_device *adev,* Because other buses do not support ACPI HIDs & CIDs, e.g. for a device with * hid:IBM0001 and cid:ACPI0001 you get: "acpi:IBM0001:ACPI0001". */ -int acpi_device_uevent_modalias (struct device *dev,struct kobj_uevent_env *env) +int acpi_device_uevent_modalias (const struct device *dev,struct kobj_uevent_env *env) {return __acpi_device_uevent_modalias (acpi_companion_match (dev), env); }drivers/acpi/internal.h +1
-1@@ -120,7 +120,7 @@ int acpi_bus_register_early_device(int type);Device Matching and Notification -------------------------------------------------------------------------- */ struct acpi_device *acpi_companion_match (const struct device *dev); -int __acpi_device_uevent_modalias (struct acpi_device *adev, +int __acpi_device_uevent_modalias (const struct acpi_device *adev,struct kobj_uevent_env *env);/* -------------------------------------------------------------------------- drivers/firewire/core-device.c +4
-4@@ -133,7 +133,7 @@ static void get_ids(const u32 *directory, int *id) } } -static void get_modalias_ids (struct fw_unit *unit,int *id) +static void get_modalias_ids (const struct fw_unit *unit,int *id) {get_ids (&fw_parent_device (unit)->config_rom[5 ], id);get_ids (unit->directory, id);@@ -195,7 +195,7 @@ static void fw_unit_remove(struct device *dev) driver->remove (fw_unit (dev)); } -static int get_modalias (struct fw_unit *unit,char *buffer,size_t buffer_size) +static int get_modalias (const struct fw_unit *unit,char *buffer,size_t buffer_size) {int id[] = {0 ,0 ,0 ,0 };@@ -206,9 +206,9 @@ static int get_modalias(struct fw_unit *unit, char *buffer, size_t buffer_size) id[0], id[1], id[2], id[3]); } -static int fw_unit_uevent (struct device *dev,struct kobj_uevent_env *env) +static int fw_unit_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct fw_unit *unit =fw_unit (dev); +const struct fw_unit *unit =fw_unit (dev);char modalias[64 ];get_modalias (unit, modalias,sizeof (modalias));drivers/gpu/drm/display/drm_dp_aux_bus.c +1
-1@@ -161,7 +161,7 @@ static void dp_aux_ep_dev_release(struct device *dev)kfree (aux_ep_with_data); } -static int dp_aux_ep_dev_modalias (struct device *dev,struct kobj_uevent_env *env) +static int dp_aux_ep_dev_modalias (const struct device *dev,struct kobj_uevent_env *env) {return of_device_uevent_modalias (dev, env); }drivers/i2c/i2c-core-base.c +2
-2@@ -136,9 +136,9 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int i2c_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int i2c_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct i2c_client *client =to_i2c_client (dev); +const struct i2c_client *client =to_i2c_client (dev);int rc; rc =of_device_uevent_modalias (dev, env);drivers/i3c/device.c +1
-1@@ -78,7 +78,7 @@ EXPORT_SYMBOL_GPL(i3c_device_do_setdasa);* * Retrieve I3C dev info. */ -void i3c_device_get_info (struct i3c_device *dev, +void i3c_device_get_info (const struct i3c_device *dev,struct i3c_device_info *info) {if (!info)drivers/i3c/master.c +2
-2@@ -273,9 +273,9 @@ static struct attribute *i3c_device_attrs[] = { };ATTRIBUTE_GROUPS (i3c_device); -static int i3c_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int i3c_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct i3c_device *i3cdev =dev_to_i3cdev (dev); +const struct i3c_device *i3cdev =dev_to_i3cdev (dev);struct i3c_device_info devinfo;u16 manuf, part, ext;drivers/input/input.c +8
-8@@ -1372,7 +1372,7 @@ INPUT_DEV_STRING_ATTR_SHOW(phys);INPUT_DEV_STRING_ATTR_SHOW (uniq);static int input_print_modalias_bits (char *buf,int size, -char name,unsigned long *bm, +char name,const unsigned long *bm,unsigned int min_bit,unsigned int max_bit) {int len =0 , i;@@ -1384,7 +1384,7 @@ static int input_print_modalias_bits(char *buf, int size,return len; } -static int input_print_modalias (char *buf,int size,struct input_dev *id, +static int input_print_modalias (char *buf,int size,const struct input_dev *id,int add_cr) {int len;@@ -1432,7 +1432,7 @@ static ssize_t input_dev_show_modalias(struct device *dev, } static DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); -static int input_print_bitmap (char *buf,int buf_size,unsigned long *bitmap, +static int input_print_bitmap (char *buf,int buf_size,const unsigned long *bitmap,int max,int add_cr); static ssize_t input_dev_show_properties(struct device *dev,@@ -1524,7 +1524,7 @@ static const struct attribute_group input_dev_id_attr_group = { .attrs = input_dev_id_attrs, }; -static int input_print_bitmap (char *buf,int buf_size,unsigned long *bitmap, +static int input_print_bitmap (char *buf,int buf_size,const unsigned long *bitmap,int max,int add_cr) {int i;@@ -1621,7 +1621,7 @@ static void input_dev_release(struct device *device)* device bitfields. */ static int input_add_uevent_bm_var (struct kobj_uevent_env *env, -const char *name,unsigned long *bitmap,int max) +const char *name,const unsigned long *bitmap,int max) {int len;@@ -1639,7 +1639,7 @@ static int input_add_uevent_bm_var(struct kobj_uevent_env *env, }static int input_add_uevent_modalias_var (struct kobj_uevent_env *env, -struct input_dev *dev) +const struct input_dev *dev) {int len;@@ -1677,9 +1677,9 @@ static int input_add_uevent_modalias_var(struct kobj_uevent_env *env,return err; \ }while (0 ) -static int input_dev_uevent(struct device *device, struct kobj_uevent_env *env) +static int input_dev_uevent(const struct device *device, struct kobj_uevent_env *env) { -struct input_dev *dev =to_input_dev (device); +const struct input_dev *dev =to_input_dev (device); INPUT_ADD_HOTPLUG_VAR("PRODUCT=%x/%x/%x/%x", dev->id.bustype, dev->id.vendor,drivers/media/rc/rc-main.c +1
-1@@ -1614,7 +1614,7 @@ static void rc_dev_release(struct device *device)kfree (dev); } -static int rc_dev_uevent (struct device *device,struct kobj_uevent_env *env) +static int rc_dev_uevent (const struct device *device,struct kobj_uevent_env *env) {struct rc_dev *dev =to_rc_dev (device);int ret =0 ;drivers/platform/surface/aggregator/bus.c +2
-2@@ -35,9 +35,9 @@ static struct attribute *ssam_device_attrs[] = { };ATTRIBUTE_GROUPS (ssam_device); -static int ssam_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ssam_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct ssam_device *sdev =to_ssam_device (dev); +const struct ssam_device *sdev =to_ssam_device (dev); return add_uevent_var(env, "MODALIAS=ssam:d%02Xc%02Xt%02Xi%02Xf%02X", sdev->uid.domain, sdev->uid.category,drivers/soundwire/bus_type.c +2
-2@@ -58,9 +58,9 @@ int sdw_slave_modalias(const struct sdw_slave *slave, char *buf, size_t size) slave->id.sdw_version, slave->id.class_id); } -int sdw_slave_uevent (struct device *dev,struct kobj_uevent_env *env) +int sdw_slave_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct sdw_slave *slave =dev_to_sdw_dev (dev); +const struct sdw_slave *slave =dev_to_sdw_dev (dev);char modalias[32 ];sdw_slave_modalias (slave, modalias,sizeof (modalias));drivers/thunderbolt/switch.c +2
-2@@ -2176,9 +2176,9 @@ static void tb_switch_release(struct device *dev)kfree (sw); } -static int tb_switch_uevent (struct device *dev,struct kobj_uevent_env *env) +static int tb_switch_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct tb_switch *sw =tb_to_switch (dev); +const struct tb_switch *sw =tb_to_switch (dev);const char *type;if (sw->config.thunderbolt_version ==USB4_VERSION_1_0 ) {drivers/thunderbolt/tb.h +1
-1@@ -815,7 +815,7 @@ static inline bool tb_is_switch(const struct device *dev)return dev->type == &tb_switch_type; } -static inline struct tb_switch *tb_to_switch (struct device *dev) +static inline struct tb_switch *tb_to_switch (const struct device *dev) {if (tb_is_switch (dev)) return container_of(dev, struct tb_switch, dev);drivers/thunderbolt/xdomain.c +3
-3@@ -881,7 +881,7 @@ static ssize_t key_show(struct device *dev, struct device_attribute *attr, }static DEVICE_ATTR_RO (key); -static int get_modalias (struct tb_service *svc,char *buf,size_t size) +static int get_modalias (const struct tb_service *svc,char *buf,size_t size) {return snprintf (buf, size,"tbsvc:k%sp%08Xv%08Xr%08X" , svc->key, svc->prtcid, svc->prtcvers, svc->prtcrevs);@@ -953,9 +953,9 @@ static const struct attribute_group *tb_service_attr_groups[] = { NULL, }; -static int tb_service_uevent (struct device *dev,struct kobj_uevent_env *env) +static int tb_service_uevent (const struct device *dev,struct kobj_uevent_env *env) { - struct tb_service *svc = container_of(dev, struct tb_service, dev); + const struct tb_service *svc = container_of_const(dev, struct tb_service, dev);char modalias[64 ];get_modalias (svc, modalias,sizeof (modalias));drivers/tty/serdev/core.c +1
-1@@ -42,7 +42,7 @@ static struct attribute *serdev_device_attrs[] = { };ATTRIBUTE_GROUPS (serdev_device); -static int serdev_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int serdev_device_uevent (const struct device *dev,struct kobj_uevent_env *env) {int rc;drivers/usb/core/message.c +4
-4@@ -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);drivers/usb/core/usb.c +2
-2@@ -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);drivers/usb/phy/phy.c +3
-3@@ -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;drivers/usb/roles/class.c +1
-2@@ -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;drivers/usb/typec/class.c +1
-1@@ -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;include/linux/acpi.h +2
-2@@ -723,7 +723,7 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,const void *acpi_device_get_match_data (const struct device *dev);extern bool acpi_driver_match_device (struct device *dev,const struct device_driver *drv); -int acpi_device_uevent_modalias (struct device *,struct kobj_uevent_env *); +int acpi_device_uevent_modalias (const struct device *,struct kobj_uevent_env *);int acpi_device_modalias (struct device *,char *,int ); struct platform_device *acpi_create_platform_device(struct acpi_device *,@@ -958,7 +958,7 @@ static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,return NULL ; } -static inline int acpi_device_uevent_modalias (struct device *dev, +static inline int acpi_device_uevent_modalias (const struct device *dev,struct kobj_uevent_env *env) {return -ENODEV ;include/linux/device.h +1
-1@@ -88,7 +88,7 @@ int subsys_virtual_register(struct bus_type *subsys,struct device_type {const char *name;const struct attribute_group **groups; -int (*uevent)(struct device *dev,struct kobj_uevent_env *env); +int (*uevent)(const struct device *dev,struct kobj_uevent_env *env);char *(*devnode)(struct device *dev,umode_t *mode,kuid_t *uid,kgid_t *gid);void (*release)(struct device *dev);include/linux/i3c/device.h +1
-1@@ -303,7 +303,7 @@ int i3c_device_do_priv_xfers(struct i3c_device *dev,int i3c_device_do_setdasa (struct i3c_device *dev); -void i3c_device_get_info (struct i3c_device *dev,struct i3c_device_info *info); +void i3c_device_get_info (const struct i3c_device *dev,struct i3c_device_info *info);struct i3c_ibi_payload {unsigned int len;include/linux/soundwire/sdw_type.h +1
-1@@ -21,7 +21,7 @@ static inline int is_sdw_slave(const struct device *dev)int __sdw_register_driver (struct sdw_driver *drv,struct module *owner);void sdw_unregister_driver (struct sdw_driver *drv); -int sdw_slave_uevent (struct device *dev,struct kobj_uevent_env *env); +int sdw_slave_uevent (const struct device *dev,struct kobj_uevent_env *env);/** * module_sdw_driver() - Helper macro for registering a Soundwire driver Signature · 1 line
2.39.0
Signature · 1 line
heikki
Greg Kroah-Hartman
maintainerPATCH v2 6/16 driver core: make struct device_type.devnode() take a const *
In reply to Greg Kroah-HartmanThe devnode() 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.
--- block/genhd.c | 2 +- drivers/cxl/core/memdev.c | 2 +- drivers/fsi/fsi-core.c | 6 +++--- drivers/hwtracing/intel_th/core.c | 6 +++--- drivers/hwtracing/intel_th/intel_th.h | 4 ++-- drivers/usb/core/usb.c | 4 ++-- include/linux/device.h | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-)
block/genhd.c +1 -1
@@ -1201,7 +1201,7 @@ struct class block_class = { .dev_uevent = block_uevent, }; -static char *block_devnode (struct device *dev,umode_t *mode, +static char *block_devnode (const struct device *dev,umode_t *mode,kuid_t *uid,kgid_t *gid) {struct gendisk *disk =dev_to_disk (dev);
drivers/cxl/core/memdev.c +1 -1
@@ -27,7 +27,7 @@ static void cxl_memdev_release(struct device *dev)kfree (cxlmd); } -static char *cxl_memdev_devnode (struct device *dev,umode_t *mode,kuid_t *uid, +static char *cxl_memdev_devnode (const struct device *dev,umode_t *mode,kuid_t *uid,kgid_t *gid) {return kasprintf (GFP_KERNEL ,"cxl/%s" ,dev_name (dev));
drivers/fsi/fsi-core.c +3 -3
@@ -897,10 +897,10 @@ static const struct attribute_group *cfam_attr_groups[] = { NULL, }; -static char *cfam_devnode (struct device *dev,umode_t *mode, +static char *cfam_devnode (const struct device *dev,umode_t *mode,kuid_t *uid,kgid_t *gid) { -struct fsi_slave *slave =to_fsi_slave (dev); +const struct fsi_slave *slave =to_fsi_slave (dev);#ifdef CONFIG_FSI_NEW_DEV_NODE return kasprintf (GFP_KERNEL ,"fsi/cfam%d" , slave->cdev_idx);
@@ -915,7 +915,7 @@ static const struct device_type cfam_type = { .groups = cfam_attr_groups }; -static char *fsi_cdev_devnode (struct device *dev,umode_t *mode, +static char *fsi_cdev_devnode (const struct device *dev,umode_t *mode,kuid_t *uid,kgid_t *gid) {#ifdef CONFIG_FSI_NEW_DEV_NODE
drivers/hwtracing/intel_th/core.c +3 -3
@@ -185,11 +185,11 @@ static struct device_type intel_th_source_device_type = { .release = intel_th_device_release, }; -static char *intel_th_output_devnode (struct device *dev,umode_t *mode, +static char *intel_th_output_devnode (const struct device *dev,umode_t *mode,kuid_t *uid,kgid_t *gid) { -struct intel_th_device *thdev =to_intel_th_device (dev); -struct intel_th *th =to_intel_th (thdev); +const struct intel_th_device *thdev =to_intel_th_device (dev); +const struct intel_th *th =to_intel_th (thdev);char *node;if (thdev->id >=0 )
drivers/hwtracing/intel_th/intel_th.h +2 -2
@@ -205,7 +205,7 @@ struct intel_th_driver {* INTEL_TH_SWITCH and INTEL_TH_SOURCE are children of the intel_th device. */ static inline struct intel_th_device * -to_intel_th_parent (struct intel_th_device *thdev) +to_intel_th_parent (const struct intel_th_device *thdev) {struct device *parent = thdev->dev.parent;
@@ -215,7 +215,7 @@ to_intel_th_parent(struct intel_th_device *thdev)return to_intel_th_device (parent); } -static inline struct intel_th *to_intel_th (struct intel_th_device *thdev) +static inline struct intel_th *to_intel_th (const struct intel_th_device *thdev) {if (thdev->type ==INTEL_TH_OUTPUT ) thdev =to_intel_th_parent (thdev);
drivers/usb/core/usb.c +2 -2
@@ -505,10 +505,10 @@ static const struct dev_pm_ops usb_device_pm_ops = {#endif /* CONFIG_PM */ -static char *usb_devnode (struct device *dev, +static char *usb_devnode (const struct device *dev,umode_t *mode,kuid_t *uid,kgid_t *gid) { -struct usb_device *usb_dev; +const struct usb_device *usb_dev; usb_dev =to_usb_device (dev); return kasprintf(GFP_KERNEL, "bus/usb/%03d/%03d",
include/linux/device.h +1 -1
@@ -89,7 +89,7 @@ struct device_type {const char *name;const struct attribute_group **groups;int (*uevent)(const struct device *dev,struct kobj_uevent_env *env); -char *(*devnode)(struct device *dev,umode_t *mode, +char *(*devnode)(const struct device *dev,umode_t *mode,kuid_t *uid,kgid_t *gid);void (*release)(struct device *dev);
Signature · 1 line
2.39.0
Re: [PATCH v2 06/16] driver core: make struct device_type.devnode() take a const *
Quoted 4 lines · Greg Kroah-Hartman
The
devnode()callback in structdevice_typeshould 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.
For the intel-th bit:
Thanks,
--
Alex
Greg Kroah-Hartman
maintainerPATCH v2 7/16 driver core: device_get_devnode() should take a const *
In reply to Greg Kroah-Hartmandevice_get_devnode() should take a constant * to struct device as it does not modify it in any way, so modify the function definition to do this and move it out of device.h as it does not need to be exposed to the whole kernel tree.
--- drivers/base/base.h | 2 ++ drivers/base/core.c | 2 +- include/linux/device.h | 2 -- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/base/base.h +2 -0
@@ -158,6 +158,8 @@ extern void device_block_probing(void);extern void device_unblock_probing (void );extern void deferred_probe_extend_timeout (void );extern void driver_deferred_probe_trigger (void ); +const char *device_get_devnode (const struct device *dev,umode_t *mode, +kuid_t *uid,kgid_t *gid,const char **tmp);/* /sys/devices directory */ extern struct kset *devices_kset;
drivers/base/core.c +1 -1
@@ -3739,7 +3739,7 @@ static struct device *next_device(struct klist_iter *i)* a name. This memory is returned in tmp and needs to be * freed by the caller. */ -const char *device_get_devnode (struct device *dev, +const char *device_get_devnode (const struct device *dev,umode_t *mode,kuid_t *uid,kgid_t *gid,const char **tmp) {
include/linux/device.h +0 -2
@@ -907,8 +907,6 @@ int device_rename(struct device *dev, const char *new_name);int device_move (struct device *dev,struct device *new_parent,enum dpm_order dpm_order);int device_change_owner (struct device *dev,kuid_t kuid,kgid_t kgid); -const char *device_get_devnode (struct device *dev,umode_t *mode,kuid_t *uid, -kgid_t *gid,const char **tmp);int device_is_dependent (struct device *dev,void *target);static inline bool device_supports_offline (struct device *dev)
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH v2 8/16 vio: move to_vio_dev() to use container_of_const()
In reply to Greg Kroah-HartmanThe driver core is changing to pass some pointers as const, so move to_vio_dev() to use container_of_const() to handle this change. to_vio_dev() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.
--- arch/powerpc/include/asm/vio.h | 5 +---- arch/sparc/include/asm/vio.h | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/vio.h +1 -4
@@ -161,10 +161,7 @@ static inline struct vio_driver *to_vio_driver(struct device_driver *drv) return container_of(drv, struct vio_driver, driver); } -static inline struct vio_dev *to_vio_dev (struct device *dev) -{ - return container_of(dev, struct vio_dev, dev); -} +#define to_vio_dev (__dev) container_of_const(__dev, struct vio_dev, dev)#endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_VIO_H */
arch/sparc/include/asm/vio.h +1 -4
@@ -488,10 +488,7 @@ static inline struct vio_driver *to_vio_driver(struct device_driver *drv) return container_of(drv, struct vio_driver, driver); } -static inline struct vio_dev *to_vio_dev (struct device *dev) -{ - return container_of(dev, struct vio_dev, dev); -} +#define to_vio_dev (__dev) container_of_const(__dev, struct vio_dev, dev)int vio_ldc_send (struct vio_driver_state *vio,void *data,int len);void vio_link_state_change (struct vio_driver_state *vio,int event);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH v2 9/16 platform/x86: wmi: move dev_to_wblock() and dev_to_wdev to use container_of_const()
In reply to Greg Kroah-HartmanThe driver core is changing to pass some pointers as const, so move the dev_to_wdev() and dev_to_wblock() functions to use container_of_const() to handle this change.
Both of these functions now properly keep the const-ness of the pointer passed into it, while as before it could be lost.
--- drivers/platform/x86/wmi.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/platform/x86/wmi.c +2 -9
@@ -693,15 +693,8 @@ char *wmi_get_acpi_device_uid(const char *guid_string) }EXPORT_SYMBOL_GPL (wmi_get_acpi_device_uid); -static struct wmi_block *dev_to_wblock (struct device *dev) -{ - return container_of(dev, struct wmi_block, dev.dev); -} - -static struct wmi_device *dev_to_wdev (struct device *dev) -{ - return container_of(dev, struct wmi_device, dev); -} +#define dev_to_wblock (__dev) container_of_const(__dev, struct wmi_block, dev.dev) +#define dev_to_wdev (__dev) container_of_const(__dev, struct wmi_device, dev)static inline struct wmi_driver *drv_to_wdrv (struct device_driver *drv) {
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH v2 10/16 drivers: hv: move device_to_hv_device to use container_of_const()
In reply to Greg Kroah-HartmanThe driver core is changing to pass some pointers as const, so move device_to_hv_device() to use container_of_const() to handle this change.
device_to_hv_device() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.
--- include/linux/hyperv.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
include/linux/hyperv.h +1 -4
@@ -1309,10 +1309,7 @@ struct hv_device { }; -static inline struct hv_device *device_to_hv_device (struct device *d) -{ - return container_of(d, struct hv_device, device); -} +#define device_to_hv_device (d) container_of_const(d, struct hv_device, device)static inline struct hv_driver *drv_to_hv_drv (struct device_driver *d) {
Signature · 1 line
2.39.0
Re: [PATCH v2 10/16] drivers: hv: move device_to_hv_device to use container_of_const()
Quoted 6 lines · Greg Kroah-Hartman
The driver core is changing to pass some pointers as const, so move
device_to_hv_device()to usecontainer_of_const()to handle this change.
device_to_hv_device()now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.
Quoted 7 lines
Cc "K. Y. Srinivasan" <[email protected]>Cc Haiyang Zhang <[email protected]>Cc Wei Liu <[email protected]>Cc Dexuan Cui <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Greg Kroah-Hartman
maintainerPATCH v2 11/16 virtio: move dev_to_virtio() to use container_of_const()
In reply to Greg Kroah-HartmanThe driver core is changing to pass some pointers as const, so move dev_to_virtio() to use container_of_const() to handle this change.
dev_to_virtio() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.
--- include/linux/virtio.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
include/linux/virtio.h +1 -4
@@ -127,10 +127,7 @@ struct virtio_device {void *priv; }; -static inline struct virtio_device *dev_to_virtio (struct device *_dev) -{ - return container_of(_dev, struct virtio_device, dev); -} +#define dev_to_virtio (_dev) container_of_const(_dev, struct virtio_device, dev)void virtio_add_status (struct virtio_device *dev,unsigned int status);int register_virtio_device (struct virtio_device *dev);
Signature · 6 lines
2.39.0 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Greg Kroah-Hartman
maintainerPATCH v2 12/16 drm/mipi-dsi: move to_mipi_dsi_device() to use container_of_const()
In reply to Greg Kroah-HartmanThe driver core is changing to pass some pointers as const, so move to_mipi_dsi_device() to use container_of_const() to handle this change.
to_mipi_dsi_device() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.
--- include/drm/drm_mipi_dsi.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
include/drm/drm_mipi_dsi.h +1 -4
@@ -197,10 +197,7 @@ struct mipi_dsi_device {#define MIPI_DSI_MODULE_PREFIX "mipi-dsi:" -static inline struct mipi_dsi_device *to_mipi_dsi_device (struct device *dev) -{ - return container_of(dev, struct mipi_dsi_device, dev); -} +#define to_mipi_dsi_device (__dev) container_of_const(__dev, struct mipi_dsi_device, dev)/** * mipi_dsi_pixel_format_to_bpp - obtain the number of bits per pixel for any
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH v2 13/16 mcb: move to_mcb_device() to use container_of_const()
In reply to Greg Kroah-HartmanThe driver core is changing to pass some pointers as const, so move to_mcb_device() to use container_of_const() to handle this change.
to_mcb_device() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.
--- include/linux/mcb.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
include/linux/mcb.h +1 -4
@@ -76,10 +76,7 @@ struct mcb_device {struct device *dma_dev; }; -static inline struct mcb_device *to_mcb_device (struct device *dev) -{ - return container_of(dev, struct mcb_device, dev); -} +#define to_mcb_device (__dev) container_of_const(__dev, struct mcb_device, dev)/** * struct mcb_driver - MEN Chameleon Bus device driver
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH v2 14/16 xen/xenbus: move to_xenbus_device() to use container_of_const()
In reply to Greg Kroah-HartmanThe driver core is changing to pass some pointers as const, so move to_xenbus_device() to use container_of_const() to handle this change.
to_xenbus_device() now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.
--- include/xen/xenbus.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
include/xen/xenbus.h +1 -4
@@ -96,10 +96,7 @@ struct xenbus_device {unsigned int spurious_threshold; }; -static inline struct xenbus_device *to_xenbus_device (struct device *dev) -{ - return container_of(dev, struct xenbus_device, dev); -} +#define to_xenbus_device (__dev) container_of_const(__dev, struct xenbus_device, dev)struct xenbus_device_id {
Signature · 1 line
2.39.0
Re: [PATCH v2 14/16] xen/xenbus: move to_xenbus_device() to use container_of_const()
Quoted 11 lines · Greg Kroah-Hartman
The driver core is changing to pass some pointers as const, so move
to_xenbus_device()to usecontainer_of_const()to handle this change.
to_xenbus_device()now properly keeps the const-ness of the pointer passed into it, while as before it could be lost.Cc Juergen Gross <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Oleksandr Tyshchenko <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Juergen
Greg Kroah-Hartman
maintainerPATCH v2 15/16 driver core: make struct bus_type.uevent() take a const *
In reply to Greg Kroah-HartmanThe uevent() callback in struct bus_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.
--- arch/mips/sgi-ip22/ip22-gio.c | 4 ++-- arch/parisc/kernel/drivers.c | 4 ++-- arch/powerpc/platforms/pseries/vio.c | 4 ++-- arch/sparc/kernel/vio.c | 2 +- drivers/acpi/bus.c | 2 +- drivers/amba/bus.c | 4 ++-- drivers/base/auxiliary.c | 2 +- drivers/base/cpu.c | 2 +- drivers/base/platform.c | 4 ++-- drivers/bcma/main.c | 6 +++--- drivers/bus/fsl-mc/fsl-mc-bus.c | 4 ++-- drivers/bus/mhi/ep/main.c | 4 ++-- drivers/bus/mhi/host/init.c | 4 ++-- drivers/bus/mips_cdmm.c | 4 ++-- drivers/bus/sunxi-rsb.c | 2 +- drivers/cxl/core/memdev.c | 2 +- drivers/cxl/core/port.c | 8 ++++---- drivers/cxl/cxl.h | 4 ++-- drivers/cxl/cxlmem.h | 2 +- drivers/dax/bus.c | 2 +- drivers/eisa/eisa-bus.c | 4 ++-- drivers/firmware/arm_ffa/bus.c | 4 ++-- drivers/fpga/dfl.c | 4 ++-- drivers/gpu/drm/drm_mipi_dsi.c | 4 ++-- drivers/gpu/host1x/bus.c | 2 +- drivers/greybus/core.c | 14 +++++++------- drivers/hid/hid-core.c | 4 ++-- drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +- drivers/hsi/hsi_core.c | 2 +- drivers/hv/vmbus_drv.c | 4 ++-- drivers/input/serio/serio.c | 4 ++-- drivers/ipack/ipack.c | 4 ++-- drivers/macintosh/macio_asic.c | 2 +- drivers/mcb/mcb-core.c | 4 ++-- drivers/memstick/core/memstick.c | 6 +++--- drivers/misc/mei/bus.c | 4 ++-- drivers/misc/tifm_core.c | 4 ++-- drivers/mmc/core/bus.c | 4 ++-- drivers/mmc/core/sdio_bus.c | 4 ++-- drivers/net/phy/mdio_bus.c | 2 +- drivers/net/xen-netback/xenbus.c | 2 +- drivers/nvdimm/bus.c | 4 ++-- drivers/nvdimm/dax_devs.c | 2 +- drivers/nvdimm/dimm_devs.c | 2 +- drivers/nvdimm/nd-core.h | 10 +++++----- drivers/nvdimm/nd.h | 4 ++-- drivers/nvdimm/region_devs.c | 4 ++-- drivers/pci/pci-driver.c | 4 ++-- drivers/pcmcia/ds.c | 4 ++-- drivers/platform/x86/wmi.c | 4 ++-- drivers/rapidio/rio-driver.c | 4 ++-- drivers/rpmsg/rpmsg_core.c | 4 ++-- drivers/s390/cio/css.c | 4 ++-- drivers/s390/cio/device.c | 8 ++++---- drivers/s390/cio/scm.c | 2 +- drivers/s390/crypto/ap_bus.c | 4 ++-- drivers/scsi/scsi_sysfs.c | 4 ++-- drivers/slimbus/core.c | 4 ++-- drivers/soc/qcom/apr.c | 4 ++-- drivers/spi/spi.c | 2 +- drivers/spmi/spmi.c | 2 +- drivers/ssb/main.c | 4 ++-- drivers/staging/greybus/gbphy.c | 14 +++++++------- drivers/tee/tee_core.c | 2 +- drivers/usb/common/ulpi.c | 4 ++-- drivers/usb/core/driver.c | 6 +++--- drivers/usb/typec/bus.c | 4 ++-- drivers/virtio/virtio.c | 4 ++-- drivers/w1/w1.c | 10 +++++----- drivers/xen/pvcalls-back.c | 2 +- drivers/xen/xenbus/xenbus_probe_backend.c | 8 ++++---- drivers/xen/xenbus/xenbus_probe_frontend.c | 4 ++-- drivers/zorro/zorro-driver.c | 4 ++-- include/linux/device/bus.h | 2 +- include/linux/spi/spi.h | 2 +- include/linux/ssb/ssb.h | 2 +- include/sound/hdaudio.h | 2 +- include/xen/xenbus.h | 2 +- sound/aoa/soundbus/core.c | 6 +++--- sound/hda/hda_bus_type.c | 2 +- sound/hda/hdac_device.c | 2 +- 81 files changed, 160 insertions(+), 160 deletions(-)
arch/mips/sgi-ip22/ip22-gio.c +2 -2
@@ -199,9 +199,9 @@ static struct attribute *gio_dev_attrs[] = { };ATTRIBUTE_GROUPS (gio_dev); -static int gio_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int gio_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct gio_device *gio_dev =to_gio_device (dev); +const struct gio_device *gio_dev =to_gio_device (dev);add_uevent_var (env,"MODALIAS=gio:%x" , gio_dev->id.id);return 0 ;
arch/parisc/kernel/drivers.c +2 -2
@@ -552,7 +552,7 @@ static int parisc_generic_match(struct device *dev, struct device_driver *drv)return match_device (to_parisc_driver (drv),to_parisc_device (dev)); } -static ssize_t make_modalias (struct device *dev,char *buf) +static ssize_t make_modalias (const struct device *dev,char *buf) {const struct parisc_device *padev =to_parisc_device (dev);const struct parisc_device_id *id = &padev->id;
@@ -562,7 +562,7 @@ static ssize_t make_modalias(struct device *dev, char *buf) (u32)id->sversion); } -static int parisc_uevent (struct device *dev,struct kobj_uevent_env *env) +static int parisc_uevent (const struct device *dev,struct kobj_uevent_env *env) {const struct parisc_device *padev;char modalias[40 ];
arch/powerpc/platforms/pseries/vio.c +2 -2
@@ -1609,10 +1609,10 @@ static int vio_bus_match(struct device *dev, struct device_driver *drv)return (ids !=NULL ) && (vio_match_device (ids, vio_dev) !=NULL ); } -static int vio_hotplug (struct device *dev,struct kobj_uevent_env *env) +static int vio_hotplug (const struct device *dev,struct kobj_uevent_env *env) {const struct vio_dev *vio_dev =to_vio_dev (dev); -struct device_node *dn; +const struct device_node *dn;const char *cp; dn = dev->of_node;
arch/sparc/kernel/vio.c +1 -1
@@ -46,7 +46,7 @@ static const struct vio_device_id *vio_match_device(return NULL ; } -static int vio_hotplug (struct device *dev,struct kobj_uevent_env *env) +static int vio_hotplug (const struct device *dev,struct kobj_uevent_env *env) {const struct vio_dev *vio_dev =to_vio_dev (dev);
drivers/acpi/bus.c +1 -1
@@ -1014,7 +1014,7 @@ static int acpi_bus_match(struct device *dev, struct device_driver *drv) && !acpi_match_device_ids (acpi_dev, acpi_drv->ids); } -static int acpi_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int acpi_device_uevent (const struct device *dev,struct kobj_uevent_env *env) {return __acpi_device_uevent_modalias (to_acpi_device (dev), env); }
drivers/amba/bus.c +2 -2
@@ -235,9 +235,9 @@ static int amba_match(struct device *dev, struct device_driver *drv)return amba_lookup (pcdrv->id_table, pcdev) !=NULL ; } -static int amba_uevent (struct device *dev,struct kobj_uevent_env *env) +static int amba_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct amba_device *pcdev =to_amba_device (dev); +const struct amba_device *pcdev =to_amba_device (dev);int retval =0 ; retval =add_uevent_var (env,"AMBA_ID=%08x" , pcdev->periphid);
drivers/base/auxiliary.c +1 -1
@@ -185,7 +185,7 @@ static int auxiliary_match(struct device *dev, struct device_driver *drv)return !!auxiliary_match_id (auxdrv->id_table, auxdev); } -static int auxiliary_uevent (struct device *dev,struct kobj_uevent_env *env) +static int auxiliary_uevent (const struct device *dev,struct kobj_uevent_env *env) {const char *name, *p;
drivers/base/cpu.c +1 -1
@@ -336,7 +336,7 @@ static ssize_t print_cpu_modalias(struct device *dev,return len; } -static int cpu_uevent (struct device *dev,struct kobj_uevent_env *env) +static int cpu_uevent (const struct device *dev,struct kobj_uevent_env *env) {char *buf =kzalloc (PAGE_SIZE ,GFP_KERNEL );if (buf) {
drivers/base/platform.c +2 -2
@@ -1353,9 +1353,9 @@ static int platform_match(struct device *dev, struct device_driver *drv)return (strcmp (pdev->name, drv->name) ==0 ); } -static int platform_uevent (struct device *dev,struct kobj_uevent_env *env) +static int platform_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct platform_device *pdev =to_platform_device (dev); +const struct platform_device *pdev =to_platform_device (dev);int rc;/* Some devices have extra OF data and an OF-style MODALIAS */
drivers/bcma/main.c +3 -3
@@ -28,7 +28,7 @@ static DEFINE_MUTEX(bcma_buses_mutex);static int bcma_bus_match (struct device *dev,struct device_driver *drv);static int bcma_device_probe (struct device *dev);static void bcma_device_remove (struct device *dev); -static int bcma_device_uevent (struct device *dev,struct kobj_uevent_env *env); +static int bcma_device_uevent (const struct device *dev,struct kobj_uevent_env *env);static ssize_t manuf_show (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -627,9 +627,9 @@ static void bcma_device_remove(struct device *dev)put_device (dev); } -static int bcma_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int bcma_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { - struct bcma_device *core = container_of(dev, struct bcma_device, dev); + const struct bcma_device *core = container_of_const(dev, struct bcma_device, dev); return add_uevent_var(env, "MODALIAS=bcma:m%04Xid%04Xrev%02Xcl%02X",
drivers/bus/fsl-mc/fsl-mc-bus.c +2 -2
@@ -124,9 +124,9 @@ static int fsl_mc_bus_match(struct device *dev, struct device_driver *drv)/* * fsl_mc_bus_uevent - callback invoked when a device is added */ -static int fsl_mc_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int fsl_mc_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct fsl_mc_device *mc_dev =to_fsl_mc_device (dev); +const struct fsl_mc_device *mc_dev =to_fsl_mc_device (dev); if (add_uevent_var(env, "MODALIAS=fsl-mc:v%08Xd%s", mc_dev->obj_desc.vendor,
drivers/bus/mhi/ep/main.c +2 -2
@@ -1543,9 +1543,9 @@ void mhi_ep_driver_unregister(struct mhi_ep_driver *mhi_drv) }EXPORT_SYMBOL_GPL (mhi_ep_driver_unregister); -static int mhi_ep_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mhi_ep_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mhi_ep_device *mhi_dev =to_mhi_ep_device (dev); +const struct mhi_ep_device *mhi_dev =to_mhi_ep_device (dev);return add_uevent_var (env,"MODALIAS=" MHI_EP_DEVICE_MODALIAS_FMT , mhi_dev->name);
drivers/bus/mhi/host/init.c +2 -2
@@ -1395,9 +1395,9 @@ void mhi_driver_unregister(struct mhi_driver *mhi_drv) }EXPORT_SYMBOL_GPL (mhi_driver_unregister); -static int mhi_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mhi_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mhi_device *mhi_dev =to_mhi_device (dev); +const struct mhi_device *mhi_dev =to_mhi_device (dev);return add_uevent_var (env,"MODALIAS=" MHI_DEVICE_MODALIAS_FMT , mhi_dev->name);
drivers/bus/mips_cdmm.c +2 -2
@@ -67,9 +67,9 @@ static int mips_cdmm_match(struct device *dev, struct device_driver *drv)return mips_cdmm_lookup (cdrv->id_table, cdev) !=NULL ; } -static int mips_cdmm_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mips_cdmm_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mips_cdmm_device *cdev =to_mips_cdmm_device (dev); +const struct mips_cdmm_device *cdev =to_mips_cdmm_device (dev);int retval =0 ; retval =add_uevent_var (env,"CDMM_CPU=%u" , cdev->cpu);
drivers/bus/sunxi-rsb.c +1 -1
@@ -172,7 +172,7 @@ static void sunxi_rsb_device_remove(struct device *dev) drv->remove (to_sunxi_rsb_device (dev)); } -static int sunxi_rsb_device_modalias (struct device *dev,struct kobj_uevent_env *env) +static int sunxi_rsb_device_modalias (const struct device *dev,struct kobj_uevent_env *env) {return of_device_uevent_modalias (dev, env); }
drivers/cxl/core/memdev.c +1 -1
@@ -162,7 +162,7 @@ static const struct device_type cxl_memdev_type = { .groups = cxl_memdev_attribute_groups, }; -bool is_cxl_memdev (struct device *dev) +bool is_cxl_memdev (const struct device *dev) {return dev->type == &cxl_memdev_type; }
drivers/cxl/core/port.c +4 -4
@@ -38,7 +38,7 @@ static ssize_t devtype_show(struct device *dev, struct device_attribute *attr, }static DEVICE_ATTR_RO (devtype); -static int cxl_device_id (struct device *dev) +static int cxl_device_id (const struct device *dev) {if (dev->type == &cxl_nvdimm_bridge_type)return CXL_DEVICE_NVDIMM_BRIDGE ;
@@ -523,13 +523,13 @@ static const struct device_type cxl_port_type = { .groups = cxl_port_attribute_groups, }; -bool is_cxl_port (struct device *dev) +bool is_cxl_port (const struct device *dev) {return dev->type == &cxl_port_type; }EXPORT_SYMBOL_NS_GPL (is_cxl_port,CXL ); -struct cxl_port *to_cxl_port (struct device *dev) +struct cxl_port *to_cxl_port (const struct device *dev) {if (dev_WARN_ONCE (dev, dev->type != &cxl_port_type,"not a cxl_port device\n" ))
@@ -1826,7 +1826,7 @@ void cxl_driver_unregister(struct cxl_driver *cxl_drv) }EXPORT_SYMBOL_NS_GPL (cxl_driver_unregister,CXL ); -static int cxl_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int cxl_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) {return add_uevent_var (env,"MODALIAS=" CXL_MODALIAS_FMT ,cxl_device_id (dev));
drivers/cxl/cxl.h +2 -2
@@ -588,8 +588,8 @@ static inline bool is_cxl_root(struct cxl_port *port)return port->uport == port->dev.parent; } -bool is_cxl_port (struct device *dev); -struct cxl_port *to_cxl_port (struct device *dev); +bool is_cxl_port (const struct device *dev); +struct cxl_port *to_cxl_port (const struct device *dev);struct pci_bus ;int devm_cxl_register_pci_bus (struct device *host,struct device *uport,struct pci_bus *bus);
drivers/cxl/cxlmem.h +1 -1
@@ -72,7 +72,7 @@ cxled_to_memdev(struct cxl_endpoint_decoder *cxled)return to_cxl_memdev (port->uport); } -bool is_cxl_memdev (struct device *dev); +bool is_cxl_memdev (const struct device *dev);static inline bool is_cxl_endpoint (struct cxl_port *port) {return is_cxl_memdev (port->uport);
drivers/dax/bus.c +1 -1
@@ -18,7 +18,7 @@ struct dax_id {char dev_name[DAX_NAME_LEN ]; }; -static int dax_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int dax_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) {/* * We only ever expect to handle device-dax instances, i.e. the
drivers/eisa/eisa-bus.c +2 -2
@@ -127,9 +127,9 @@ static int eisa_bus_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int eisa_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int eisa_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct eisa_device *edev =to_eisa_device (dev); +const struct eisa_device *edev =to_eisa_device (dev);add_uevent_var (env,"MODALIAS=" EISA_DEVICE_MODALIAS_FMT , edev->id.sig);return 0 ;
drivers/firmware/arm_ffa/bus.c +2 -2
@@ -56,9 +56,9 @@ static void ffa_device_remove(struct device *dev) ffa_drv->remove (to_ffa_dev (dev)); } -static int ffa_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ffa_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct ffa_device *ffa_dev =to_ffa_dev (dev); +const struct ffa_device *ffa_dev =to_ffa_dev (dev);return add_uevent_var (env,"MODALIAS=arm_ffa:%04x:%pUb" , ffa_dev->vm_id, &ffa_dev->uuid);
drivers/fpga/dfl.c +2 -2
@@ -293,9 +293,9 @@ static void dfl_bus_remove(struct device *dev) ddrv->remove (ddev); } -static int dfl_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int dfl_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct dfl_device *ddev =to_dfl_dev (dev); +const struct dfl_device *ddev =to_dfl_dev (dev);return add_uevent_var (env,"MODALIAS=dfl:t%04Xf%04X" , ddev->type, ddev->feature_id);
drivers/gpu/drm/drm_mipi_dsi.c +2 -2
@@ -62,9 +62,9 @@ static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int mipi_dsi_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mipi_dsi_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mipi_dsi_device *dsi =to_mipi_dsi_device (dev); +const struct mipi_dsi_device *dsi =to_mipi_dsi_device (dev);int err; err =of_device_uevent_modalias (dev, env);
drivers/gpu/host1x/bus.c +1 -1
@@ -338,7 +338,7 @@ static int host1x_device_match(struct device *dev, struct device_driver *drv)return strcmp (dev_name (dev), drv->name) ==0 ; } -static int host1x_device_uevent (struct device *dev, +static int host1x_device_uevent (const struct device *dev,struct kobj_uevent_env *env) {struct device_node *np = dev->parent->of_node;
drivers/greybus/core.c +7 -7
@@ -78,14 +78,14 @@ static int greybus_match_device(struct device *dev, struct device_driver *drv)return 0 ; } -static int greybus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int greybus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct gb_host_device *hd; -struct gb_module *module =NULL ; -struct gb_interface *intf =NULL ; -struct gb_control *control =NULL ; -struct gb_bundle *bundle =NULL ; -struct gb_svc *svc =NULL ; +const struct gb_host_device *hd; +const struct gb_module *module =NULL ; +const struct gb_interface *intf =NULL ; +const struct gb_control *control =NULL ; +const struct gb_bundle *bundle =NULL ; +const struct gb_svc *svc =NULL ;if (is_gb_host_device (dev)) { hd =to_gb_host_device (dev);
drivers/hid/hid-core.c +2 -2
@@ -2664,9 +2664,9 @@ static const struct attribute_group hid_dev_group = { };__ATTRIBUTE_GROUPS (hid_dev); -static int hid_uevent (struct device *dev,struct kobj_uevent_env *env) +static int hid_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct hid_device *hdev =to_hid_device (dev); +const struct hid_device *hdev =to_hid_device (dev);if (add_uevent_var (env,"HID_ID=%04X:%08X:%08X" , hdev->bus, hdev->vendor, hdev->product))
drivers/hid/intel-ish-hid/ishtp/bus.c +1 -1
@@ -361,7 +361,7 @@ static struct attribute *ishtp_cl_dev_attrs[] = { };ATTRIBUTE_GROUPS (ishtp_cl_dev); -static int ishtp_cl_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ishtp_cl_uevent (const struct device *dev,struct kobj_uevent_env *env) {if (add_uevent_var (env,"MODALIAS=" ISHTP_MODULE_PREFIX "%s" ,dev_name (dev)))return -ENOMEM ;
drivers/hsi/hsi_core.c +1 -1
@@ -30,7 +30,7 @@ static struct attribute *hsi_bus_dev_attrs[] = { };ATTRIBUTE_GROUPS (hsi_bus_dev); -static int hsi_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int hsi_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) {add_uevent_var (env,"MODALIAS=hsi:%s" ,dev_name (dev));
drivers/hv/vmbus_drv.c +2 -2
@@ -711,9 +711,9 @@ __ATTRIBUTE_GROUPS(vmbus_bus);* representation of the device guid (each byte of the guid will be * represented with two hex characters. */ -static int vmbus_uevent (struct device *device,struct kobj_uevent_env *env) +static int vmbus_uevent (const struct device *device,struct kobj_uevent_env *env) { -struct hv_device *dev =device_to_hv_device (device); +const struct hv_device *dev =device_to_hv_device (device);const char *format ="MODALIAS=vmbus:%*phN" ;return add_uevent_var (env, format,UUID_SIZE , &dev->dev_type);
drivers/input/serio/serio.c +2 -2
@@ -895,9 +895,9 @@ static int serio_bus_match(struct device *dev, struct device_driver *drv)return err; \ }while (0 ) -static int serio_uevent(struct device *dev, struct kobj_uevent_env *env) +static int serio_uevent(const struct device *dev, struct kobj_uevent_env *env) { -struct serio *serio; +const struct serio *serio;if (!dev)return -ENODEV ;
drivers/ipack/ipack.c +2 -2
@@ -76,9 +76,9 @@ static void ipack_bus_remove(struct device *device) drv->ops->remove (dev); } -static int ipack_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ipack_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct ipack_device *idev; +const struct ipack_device *idev;if (!dev)return -ENODEV ;
drivers/macintosh/macio_asic.c +1 -1
@@ -128,7 +128,7 @@ static int macio_device_resume(struct device * dev)return 0 ; } -static int macio_device_modalias (struct device *dev,struct kobj_uevent_env *env) +static int macio_device_modalias (const struct device *dev,struct kobj_uevent_env *env) {return of_device_uevent_modalias (dev, env); }
drivers/mcb/mcb-core.c +2 -2
@@ -41,9 +41,9 @@ static int mcb_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int mcb_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mcb_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mcb_device *mdev =to_mcb_device (dev); +const struct mcb_device *mdev =to_mcb_device (dev);int ret; ret =add_uevent_var (env,"MODALIAS=mcb:16z%03d" , mdev->id);
drivers/memstick/core/memstick.c +3 -3
@@ -57,10 +57,10 @@ static int memstick_bus_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int memstick_uevent (struct device *dev,struct kobj_uevent_env *env) +static int memstick_uevent (const struct device *dev,struct kobj_uevent_env *env) { - struct memstick_dev *card = container_of(dev, struct memstick_dev, - dev); + const struct memstick_dev *card = container_of_const(dev, struct memstick_dev, + dev);if (add_uevent_var (env,"MEMSTICK_TYPE=%02X" , card->id.type))return -ENOMEM ;
drivers/misc/mei/bus.c +2 -2
@@ -1222,9 +1222,9 @@ ATTRIBUTE_GROUPS(mei_cldev);* * Return: 0 on success -ENOMEM on when add_uevent_var fails */ -static int mei_cl_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mei_cl_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mei_cl_device *cldev =to_mei_cl_device (dev); +const struct mei_cl_device *cldev =to_mei_cl_device (dev);const uuid_le *uuid =mei_me_cl_uuid (cldev->me_cl);u8 version =mei_me_cl_ver (cldev->me_cl);
drivers/misc/tifm_core.c +2 -2
@@ -55,9 +55,9 @@ static int tifm_bus_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int tifm_uevent (struct device *dev,struct kobj_uevent_env *env) +static int tifm_uevent (const struct device *dev,struct kobj_uevent_env *env) { - struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev); + const struct tifm_dev *sock = container_of_const(dev, struct tifm_dev, dev);if (add_uevent_var (env,"TIFM_CARD_TYPE=%s" ,tifm_media_type_name (sock->type,1 )))return -ENOMEM ;
drivers/mmc/core/bus.c +2 -2
@@ -55,9 +55,9 @@ static struct attribute *mmc_dev_attrs[] = {ATTRIBUTE_GROUPS (mmc_dev);static int -mmc_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +mmc_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mmc_card *card =mmc_dev_to_card (dev); +const struct mmc_card *card =mmc_dev_to_card (dev);const char *type;unsigned int i;int retval =0 ;
drivers/mmc/core/sdio_bus.c +2 -2
@@ -120,9 +120,9 @@ static int sdio_bus_match(struct device *dev, struct device_driver *drv) }static int -sdio_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +sdio_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct sdio_func *func =dev_to_sdio_func (dev); +const struct sdio_func *func =dev_to_sdio_func (dev);unsigned int i; if (add_uevent_var(env,
drivers/net/phy/mdio_bus.c +1 -1
@@ -995,7 +995,7 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int mdio_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mdio_uevent (const struct device *dev,struct kobj_uevent_env *env) {int rc;
drivers/net/xen-netback/xenbus.c +1 -1
@@ -200,7 +200,7 @@ static void xenvif_debugfs_delif(struct xenvif *vif)* and vif variables to the environment, for the benefit of the vif-* hotplug * scripts. */ -static int netback_uevent (struct xenbus_device *xdev, +static int netback_uevent (const struct xenbus_device *xdev,struct kobj_uevent_env *env) {struct backend_info *be =dev_get_drvdata (&xdev->dev);
drivers/nvdimm/bus.c +2 -2
@@ -28,7 +28,7 @@ static int nvdimm_bus_major;struct class *nd_class;static DEFINE_IDA (nd_ida); -static int to_nd_device_type (struct device *dev) +static int to_nd_device_type (const struct device *dev) {if (is_nvdimm (dev))return ND_DEVICE_DIMM ;
@@ -42,7 +42,7 @@ static int to_nd_device_type(struct device *dev)return 0 ; } -static int nvdimm_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int nvdimm_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) {return add_uevent_var (env,"MODALIAS=" ND_DEVICE_MODALIAS_FMT ,to_nd_device_type (dev));
drivers/nvdimm/dax_devs.c +1 -1
@@ -38,7 +38,7 @@ static const struct device_type nd_dax_device_type = { .groups = nd_pfn_attribute_groups, }; -bool is_nd_dax (struct device *dev) +bool is_nd_dax (const struct device *dev) {return dev ? dev->type == &nd_dax_device_type : false; }
drivers/nvdimm/dimm_devs.c +1 -1
@@ -572,7 +572,7 @@ static const struct device_type nvdimm_device_type = { .groups = nvdimm_attribute_groups, }; -bool is_nvdimm (struct device *dev) +bool is_nvdimm (const struct device *dev) {return dev->type == &nvdimm_device_type; }
drivers/nvdimm/nd-core.h +5 -5
@@ -82,14 +82,14 @@ static inline void nvdimm_security_overwrite_query(struct work_struct *work) }#endif -bool is_nvdimm (struct device *dev); -bool is_nd_pmem (struct device *dev); -bool is_nd_volatile (struct device *dev); -static inline bool is_nd_region (struct device *dev) +bool is_nvdimm (const struct device *dev); +bool is_nd_pmem (const struct device *dev); +bool is_nd_volatile (const struct device *dev); +static inline bool is_nd_region (const struct device *dev) {return is_nd_pmem (dev) ||is_nd_volatile (dev); } -static inline bool is_memory (struct device *dev) +static inline bool is_memory (const struct device *dev) {return is_nd_pmem (dev) ||is_nd_volatile (dev); }
drivers/nvdimm/nd.h +2 -2
@@ -599,7 +599,7 @@ static inline int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)struct nd_dax *to_nd_dax (struct device *dev);#if IS_ENABLED (CONFIG_NVDIMM_DAX )int nd_dax_probe (struct device *dev,struct nd_namespace_common *ndns); -bool is_nd_dax (struct device *dev); +bool is_nd_dax (const struct device *dev);struct device *nd_dax_create (struct nd_region *nd_region);#else static inline int nd_dax_probe(struct device *dev,
@@ -608,7 +608,7 @@ static inline int nd_dax_probe(struct device *dev,return -ENODEV ; } -static inline bool is_nd_dax (struct device *dev) +static inline bool is_nd_dax (const struct device *dev) {return false; }
drivers/nvdimm/region_devs.c +2 -2
@@ -839,12 +839,12 @@ static const struct device_type nd_volatile_device_type = { .groups = nd_region_attribute_groups, }; -bool is_nd_pmem (struct device *dev) +bool is_nd_pmem (const struct device *dev) {return dev ? dev->type == &nd_pmem_device_type : false; } -bool is_nd_volatile (struct device *dev) +bool is_nd_volatile (const struct device *dev) {return dev ? dev->type == &nd_volatile_device_type : false; }
drivers/pci/pci-driver.c +2 -2
@@ -1545,9 +1545,9 @@ void pci_dev_put(struct pci_dev *dev) }EXPORT_SYMBOL (pci_dev_put); -static int pci_uevent (struct device *dev,struct kobj_uevent_env *env) +static int pci_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct pci_dev *pdev; +const struct pci_dev *pdev;if (!dev)return -ENODEV ;
drivers/pcmcia/ds.c +2 -2
@@ -927,9 +927,9 @@ static int pcmcia_bus_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int pcmcia_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int pcmcia_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct pcmcia_device *p_dev; +const struct pcmcia_device *p_dev;int i;u32 hash[4 ] = {0 ,0 ,0 ,0 };
drivers/platform/x86/wmi.c +2 -2
@@ -797,9 +797,9 @@ static struct attribute *wmi_method_attrs[] = { };ATTRIBUTE_GROUPS (wmi_method); -static int wmi_dev_uevent (struct device *dev,struct kobj_uevent_env *env) +static int wmi_dev_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct wmi_block *wblock =dev_to_wblock (dev); +const struct wmi_block *wblock =dev_to_wblock (dev);if (add_uevent_var (env,"MODALIAS=wmi:%pUL" , &wblock->gblock.guid))return -ENOMEM ;
drivers/rapidio/rio-driver.c +2 -2
@@ -204,9 +204,9 @@ static int rio_match_bus(struct device *dev, struct device_driver *drv) out:return 0 ; } -static int rio_uevent (struct device *dev,struct kobj_uevent_env *env) +static int rio_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct rio_dev *rdev; +const struct rio_dev *rdev;if (!dev)return -ENODEV ;
drivers/rpmsg/rpmsg_core.c +2 -2
@@ -492,9 +492,9 @@ static int rpmsg_dev_match(struct device *dev, struct device_driver *drv)return of_driver_match_device (dev, drv); } -static int rpmsg_uevent (struct device *dev,struct kobj_uevent_env *env) +static int rpmsg_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct rpmsg_device *rpdev =to_rpmsg_device (dev); +const struct rpmsg_device *rpdev =to_rpmsg_device (dev);int ret; ret =of_device_uevent_modalias (dev, env);
drivers/s390/cio/css.c +2 -2
@@ -1402,9 +1402,9 @@ static void css_shutdown(struct device *dev) sch->driver->shutdown (sch); } -static int css_uevent (struct device *dev,struct kobj_uevent_env *env) +static int css_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct subchannel *sch =to_subchannel (dev); +const struct subchannel *sch =to_subchannel (dev);int ret; ret =add_uevent_var (env,"ST=%01X" , sch->st);
drivers/s390/cio/device.c +4 -4
@@ -80,7 +80,7 @@ ccw_bus_match (struct device * dev, struct device_driver * drv)* specified size. Return length of resulting string (excluding trailing '\0') * even if string doesn't fit buffer (snprintf semantics). */ static int snprint_alias (char *buf,size_t size, -struct ccw_device_id *id,const char *suffix) +const struct ccw_device_id *id,const char *suffix) {int len;
@@ -101,10 +101,10 @@ static int snprint_alias(char *buf, size_t size,/* Set up environment variables for ccw device uevent. Return 0 on success, * non-zero otherwise. */ -static int ccw_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ccw_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct ccw_device *cdev =to_ccwdev (dev); -struct ccw_device_id *id = &(cdev->id); +const struct ccw_device *cdev =to_ccwdev (dev); +const struct ccw_device_id *id = &(cdev->id);int ret;char modalias_buf[30 ];
drivers/s390/cio/scm.c +1 -1
@@ -37,7 +37,7 @@ static void scmdev_remove(struct device *dev) scmdrv->remove (scmdev); } -static int scmdev_uevent (struct device *dev,struct kobj_uevent_env *env) +static int scmdev_uevent (const struct device *dev,struct kobj_uevent_env *env) {return add_uevent_var (env,"MODALIAS=scm:scmdev" ); }
drivers/s390/crypto/ap_bus.c +2 -2
@@ -613,10 +613,10 @@ static int ap_bus_match(struct device *dev, struct device_driver *drv)* It sets up a single environment variable DEV_TYPE which contains the * hardware device type. */ -static int ap_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ap_uevent (const struct device *dev,struct kobj_uevent_env *env) {int rc =0 ; -struct ap_device *ap_dev =to_ap_dev (dev); +const struct ap_device *ap_dev =to_ap_dev (dev);/* Uevents from ap bus core don't need extensions to the env */ if (dev == ap_root_device)
drivers/scsi/scsi_sysfs.c +2 -2
@@ -534,9 +534,9 @@ static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)return (sdp->inq_periph_qual ==SCSI_INQ_PQ_CON )?1 :0 ; } -static int scsi_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int scsi_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct scsi_device *sdev; +const struct scsi_device *sdev;if (dev->type != &scsi_dev_type)return 0 ;
drivers/slimbus/core.c +2 -2
@@ -93,9 +93,9 @@ static void slim_device_remove(struct device *dev) } } -static int slim_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int slim_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct slim_device *sbdev =to_slim_device (dev); +const struct slim_device *sbdev =to_slim_device (dev);return add_uevent_var (env,"MODALIAS=slim:%s" ,dev_name (&sbdev->dev)); }
drivers/soc/qcom/apr.c +2 -2
@@ -387,9 +387,9 @@ static void apr_device_remove(struct device *dev)spin_unlock (&apr->svcs_lock); } -static int apr_uevent (struct device *dev,struct kobj_uevent_env *env) +static int apr_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct apr_device *adev =to_apr_device (dev); +const struct apr_device *adev =to_apr_device (dev);int ret; ret =of_device_uevent_modalias (dev, env);
drivers/spi/spi.c +1 -1
@@ -395,7 +395,7 @@ static int spi_match_device(struct device *dev, struct device_driver *drv)return strcmp (spi->modalias, drv->name) ==0 ; } -static int spi_uevent (struct device *dev,struct kobj_uevent_env *env) +static int spi_uevent (const struct device *dev,struct kobj_uevent_env *env) {const struct spi_device *spi =to_spi_device (dev);int rc;
drivers/spmi/spmi.c +1 -1
@@ -366,7 +366,7 @@ static void spmi_drv_shutdown(struct device *dev) sdrv->shutdown (to_spmi_device (dev)); } -static int spmi_drv_uevent (struct device *dev,struct kobj_uevent_env *env) +static int spmi_drv_uevent (const struct device *dev,struct kobj_uevent_env *env) {int ret;
drivers/ssb/main.c +2 -2
@@ -339,9 +339,9 @@ static int ssb_bus_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int ssb_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ssb_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct ssb_device *ssb_dev =dev_to_ssb_dev (dev); +const struct ssb_device *ssb_dev =dev_to_ssb_dev (dev);if (!dev)return -ENODEV ;
drivers/staging/greybus/gbphy.c +7 -7
@@ -71,14 +71,14 @@ static const struct device_type greybus_gbphy_dev_type = { .pm = &gb_gbphy_pm_ops, }; -static int gbphy_dev_uevent (struct device *dev,struct kobj_uevent_env *env) +static int gbphy_dev_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct gbphy_device *gbphy_dev =to_gbphy_dev (dev); -struct greybus_descriptor_cport *cport_desc = gbphy_dev->cport_desc; -struct gb_bundle *bundle = gbphy_dev->bundle; -struct gb_interface *intf = bundle->intf; -struct gb_module *module = intf->module; -struct gb_host_device *hd = intf->hd; +const struct gbphy_device *gbphy_dev =to_gbphy_dev (dev); +const struct greybus_descriptor_cport *cport_desc = gbphy_dev->cport_desc; +const struct gb_bundle *bundle = gbphy_dev->bundle; +const struct gb_interface *intf = bundle->intf; +const struct gb_module *module = intf->module; +const struct gb_host_device *hd = intf->hd;if (add_uevent_var (env,"BUS=%u" , hd->bus_id))return -ENOMEM ;
drivers/tee/tee_core.c +1 -1
@@ -1207,7 +1207,7 @@ static int tee_client_device_match(struct device *dev,return 0 ; } -static int tee_client_device_uevent (struct device *dev, +static int tee_client_device_uevent (const struct device *dev,struct kobj_uevent_env *env) {uuid_t *dev_id = &to_tee_client_device (dev)->id.uuid;
drivers/usb/common/ulpi.c +2 -2
@@ -55,9 +55,9 @@ static int ulpi_match(struct device *dev, struct device_driver *driver)return 0 ; } -static int ulpi_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ulpi_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct ulpi *ulpi =to_ulpi_dev (dev); +const struct ulpi *ulpi =to_ulpi_dev (dev);int ret; ret =of_device_uevent_modalias (dev, env);
drivers/usb/core/driver.c +3 -3
@@ -899,14 +899,14 @@ static int usb_device_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int usb_uevent (struct device *dev,struct kobj_uevent_env *env) +static int usb_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct usb_device *usb_dev; +const struct usb_device *usb_dev;if (is_usb_device (dev)) { usb_dev =to_usb_device (dev); }else if (is_usb_interface (dev)) { -struct usb_interface *intf =to_usb_interface (dev); +const struct usb_interface *intf =to_usb_interface (dev); usb_dev =interface_to_usbdev (intf); }else {
drivers/usb/typec/bus.c +2 -2
@@ -321,9 +321,9 @@ static int typec_match(struct device *dev, struct device_driver *driver)return 0 ; } -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) { -struct typec_altmode *altmode =to_typec_altmode (dev); +const struct typec_altmode *altmode =to_typec_altmode (dev);if (add_uevent_var (env,"SVID=%04X" , altmode->svid))return -ENOMEM ;
drivers/virtio/virtio.c +2 -2
@@ -95,9 +95,9 @@ static int virtio_dev_match(struct device *_dv, struct device_driver *_dr)return 0 ; } -static int virtio_uevent (struct device *_dv,struct kobj_uevent_env *env) +static int virtio_uevent (const struct device *_dv,struct kobj_uevent_env *env) { -struct virtio_device *dev =dev_to_virtio (_dv); +const struct virtio_device *dev =dev_to_virtio (_dv);return add_uevent_var (env,"MODALIAS=virtio:d%08Xv%08X" , dev->id.device, dev->id.vendor);
drivers/w1/w1.c +5 -5
@@ -170,7 +170,7 @@ static struct w1_family w1_default_family = { .fops = &w1_default_fops, }; -static int w1_uevent (struct device *dev,struct kobj_uevent_env *env); +static int w1_uevent (const struct device *dev,struct kobj_uevent_env *env);static struct bus_type w1_bus_type = { .name ="w1" ,
@@ -577,11 +577,11 @@ void w1_destroy_master_attributes(struct w1_master *master)sysfs_remove_group (&master->dev.kobj, &w1_master_defattr_group); } -static int w1_uevent (struct device *dev,struct kobj_uevent_env *env) +static int w1_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct w1_master *md =NULL ; -struct w1_slave *sl =NULL ; -char *event_owner, *name; +const struct w1_master *md =NULL ; +const struct w1_slave *sl =NULL ; +const char *event_owner, *name;int err =0 ;if (dev->driver == &w1_master_driver) {
drivers/xen/pvcalls-back.c +1 -1
@@ -1186,7 +1186,7 @@ static int pvcalls_back_remove(struct xenbus_device *dev)return 0 ; } -static int pvcalls_back_uevent (struct xenbus_device *xdev, +static int pvcalls_back_uevent (const struct xenbus_device *xdev,struct kobj_uevent_env *env) {return 0 ;
drivers/xen/xenbus/xenbus_probe_backend.c +4 -4
@@ -92,12 +92,12 @@ static int backend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename)return 0 ; } -static int xenbus_uevent_backend (struct device *dev, +static int xenbus_uevent_backend (const struct device *dev,struct kobj_uevent_env *env) { -struct xenbus_device *xdev; -struct xenbus_driver *drv; -struct xen_bus_type *bus; +const struct xenbus_device *xdev; +const struct xenbus_driver *drv; +const struct xen_bus_type *bus;DPRINTK ("" );
drivers/xen/xenbus/xenbus_probe_frontend.c +2 -2
@@ -73,10 +73,10 @@ static int xenbus_probe_frontend(struct xen_bus_type *bus, const char *type,return err; } -static int xenbus_uevent_frontend (struct device *_dev, +static int xenbus_uevent_frontend (const struct device *_dev,struct kobj_uevent_env *env) { -struct xenbus_device *dev =to_xenbus_device (_dev); +const struct xenbus_device *dev =to_xenbus_device (_dev);if (add_uevent_var (env,"MODALIAS=xen:%s" , dev->devicetype))return -ENOMEM ;
drivers/zorro/zorro-driver.c +2 -2
@@ -130,9 +130,9 @@ static int zorro_bus_match(struct device *dev, struct device_driver *drv)return !!zorro_match_device (ids, z); } -static int zorro_uevent (struct device *dev,struct kobj_uevent_env *env) +static int zorro_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct zorro_dev *z; +const struct zorro_dev *z;if (!dev)return -ENODEV ;
include/linux/device/bus.h +1 -1
@@ -90,7 +90,7 @@ struct bus_type {const struct attribute_group **drv_groups;int (*match)(struct device *dev,struct device_driver *drv); -int (*uevent)(struct device *dev,struct kobj_uevent_env *env); +int (*uevent)(const struct device *dev,struct kobj_uevent_env *env);int (*probe)(struct device *dev);void (*sync_state)(struct device *dev);void (*remove)(struct device *dev);
include/linux/spi/spi.h +1 -1
@@ -223,7 +223,7 @@ struct spi_device {static_assert ((SPI_MODE_KERNEL_MASK &SPI_MODE_USER_MASK ) ==0 ,"SPI_MODE_USER_MASK & SPI_MODE_KERNEL_MASK must not overlap" ); -static inline struct spi_device *to_spi_device (struct device *dev) +static inline struct spi_device *to_spi_device (const struct device *dev) { return dev ? container_of(dev, struct spi_device, dev) : NULL; }
include/linux/ssb/ssb.h +1 -1
@@ -285,7 +285,7 @@ struct ssb_device {/* Go from struct device to struct ssb_device. */ static inline -struct ssb_device *dev_to_ssb_dev (struct device *dev) +struct ssb_device *dev_to_ssb_dev (const struct device *dev) {struct __ssb_dev_wrapper *wrap; wrap = container_of(dev, struct __ssb_dev_wrapper, dev);
include/sound/hdaudio.h +1 -1
@@ -123,7 +123,7 @@ void snd_hdac_device_exit(struct hdac_device *dev);int snd_hdac_device_register (struct hdac_device *codec);void snd_hdac_device_unregister (struct hdac_device *codec);int snd_hdac_device_set_chip_name (struct hdac_device *codec,const char *name); -int snd_hdac_codec_modalias (struct hdac_device *hdac,char *buf,size_t size); +int snd_hdac_codec_modalias (const struct hdac_device *hdac,char *buf,size_t size);int snd_hdac_refresh_widgets (struct hdac_device *codec);
include/xen/xenbus.h +1 -1
@@ -117,7 +117,7 @@ struct xenbus_driver {int (*remove)(struct xenbus_device *dev);int (*suspend)(struct xenbus_device *dev);int (*resume)(struct xenbus_device *dev); -int (*uevent)(struct xenbus_device *,struct kobj_uevent_env *); +int (*uevent)(const struct xenbus_device *,struct kobj_uevent_env *);struct device_driver driver;int (*read_otherend_details)(struct xenbus_device *dev);int (*is_ready)(struct xenbus_device *dev);
sound/aoa/soundbus/core.c +3 -3
@@ -55,10 +55,10 @@ static int soundbus_probe(struct device *dev) } -static int soundbus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int soundbus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct soundbus_dev * soundbus_dev; -struct platform_device * of; +const struct soundbus_dev * soundbus_dev; +const struct platform_device * of;const char *compat;int retval =0 ;int cplen, seen =0 ;
sound/hda/hda_bus_type.c +1 -1
@@ -65,7 +65,7 @@ static int hda_bus_match(struct device *dev, struct device_driver *drv)return 1 ; } -static int hda_uevent (struct device *dev,struct kobj_uevent_env *env) +static int hda_uevent (const struct device *dev,struct kobj_uevent_env *env) {char modalias[32 ];
sound/hda/hdac_device.c +1 -1
@@ -204,7 +204,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_set_chip_name);* * Returns the size of string, like snprintf(), or a negative error code. */ -int snd_hdac_codec_modalias (struct hdac_device *codec,char *buf,size_t size) +int snd_hdac_codec_modalias (const struct hdac_device *codec,char *buf,size_t size) {return scnprintf (buf, size,"hdaudio:v%08Xr%08Xa%02X\n" , codec->vendor_id, codec->revision_id, codec->type);
Signature · 1 line
2.39.0
Re: [PATCH v2 15/16] driver core: make struct bus_type.uevent() take a const *
Quoted 8 lines · Greg Kroah-Hartman
The
uevent()callback in structbus_typeshould 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 "Rafael J. Wysocki" <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 1,420 lines
--- arch/mips/sgi-ip22/ip22-gio.c | 4 ++-- arch/parisc/kernel/drivers.c | 4 ++-- arch/powerpc/platforms/pseries/vio.c | 4 ++-- arch/sparc/kernel/vio.c | 2 +- drivers/acpi/bus.c | 2 +- drivers/amba/bus.c | 4 ++-- drivers/base/auxiliary.c | 2 +- drivers/base/cpu.c | 2 +- drivers/base/platform.c | 4 ++-- drivers/bcma/main.c | 6 +++--- drivers/bus/fsl-mc/fsl-mc-bus.c | 4 ++-- drivers/bus/mhi/ep/main.c | 4 ++-- drivers/bus/mhi/host/init.c | 4 ++-- drivers/bus/mips_cdmm.c | 4 ++-- drivers/bus/sunxi-rsb.c | 2 +- drivers/cxl/core/memdev.c | 2 +- drivers/cxl/core/port.c | 8 ++++---- drivers/cxl/cxl.h | 4 ++-- drivers/cxl/cxlmem.h | 2 +- drivers/dax/bus.c | 2 +- drivers/eisa/eisa-bus.c | 4 ++-- drivers/firmware/arm_ffa/bus.c | 4 ++-- drivers/fpga/dfl.c | 4 ++-- drivers/gpu/drm/drm_mipi_dsi.c | 4 ++-- drivers/gpu/host1x/bus.c | 2 +- drivers/greybus/core.c | 14 +++++++------- drivers/hid/hid-core.c | 4 ++-- drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +- drivers/hsi/hsi_core.c | 2 +- drivers/hv/vmbus_drv.c | 4 ++-- drivers/input/serio/serio.c | 4 ++-- drivers/ipack/ipack.c | 4 ++-- drivers/macintosh/macio_asic.c | 2 +- drivers/mcb/mcb-core.c | 4 ++-- drivers/memstick/core/memstick.c | 6 +++--- drivers/misc/mei/bus.c | 4 ++-- drivers/misc/tifm_core.c | 4 ++-- drivers/mmc/core/bus.c | 4 ++-- drivers/mmc/core/sdio_bus.c | 4 ++-- drivers/net/phy/mdio_bus.c | 2 +- drivers/net/xen-netback/xenbus.c | 2 +- drivers/nvdimm/bus.c | 4 ++-- drivers/nvdimm/dax_devs.c | 2 +- drivers/nvdimm/dimm_devs.c | 2 +- drivers/nvdimm/nd-core.h | 10 +++++----- drivers/nvdimm/nd.h | 4 ++-- drivers/nvdimm/region_devs.c | 4 ++-- drivers/pci/pci-driver.c | 4 ++-- drivers/pcmcia/ds.c | 4 ++-- drivers/platform/x86/wmi.c | 4 ++-- drivers/rapidio/rio-driver.c | 4 ++-- drivers/rpmsg/rpmsg_core.c | 4 ++-- drivers/s390/cio/css.c | 4 ++-- drivers/s390/cio/device.c | 8 ++++---- drivers/s390/cio/scm.c | 2 +- drivers/s390/crypto/ap_bus.c | 4 ++-- drivers/scsi/scsi_sysfs.c | 4 ++-- drivers/slimbus/core.c | 4 ++-- drivers/soc/qcom/apr.c | 4 ++-- drivers/spi/spi.c | 2 +- drivers/spmi/spmi.c | 2 +- drivers/ssb/main.c | 4 ++-- drivers/staging/greybus/gbphy.c | 14 +++++++------- drivers/tee/tee_core.c | 2 +- drivers/usb/common/ulpi.c | 4 ++-- drivers/usb/core/driver.c | 6 +++--- drivers/usb/typec/bus.c | 4 ++-- drivers/virtio/virtio.c | 4 ++-- drivers/w1/w1.c | 10 +++++----- drivers/xen/pvcalls-back.c | 2 +- drivers/xen/xenbus/xenbus_probe_backend.c | 8 ++++---- drivers/xen/xenbus/xenbus_probe_frontend.c | 4 ++-- drivers/zorro/zorro-driver.c | 4 ++-- include/linux/device/bus.h | 2 +- include/linux/spi/spi.h | 2 +- include/linux/ssb/ssb.h | 2 +- include/sound/hdaudio.h | 2 +- include/xen/xenbus.h | 2 +- sound/aoa/soundbus/core.c | 6 +++--- sound/hda/hda_bus_type.c | 2 +- sound/hda/hdac_device.c | 2 +- 81 files changed, 160 insertions(+), 160 deletions(-)arch/mips/sgi-ip22/ip22-gio.c +2
-2@@ -199,9 +199,9 @@ static struct attribute *gio_dev_attrs[] = { };ATTRIBUTE_GROUPS (gio_dev); -static int gio_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int gio_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct gio_device *gio_dev =to_gio_device (dev); +const struct gio_device *gio_dev =to_gio_device (dev);add_uevent_var (env,"MODALIAS=gio:%x" , gio_dev->id.id);return 0 ;arch/parisc/kernel/drivers.c +2
-2@@ -552,7 +552,7 @@ static int parisc_generic_match(struct device *dev, struct device_driver *drv)return match_device (to_parisc_driver (drv),to_parisc_device (dev)); } -static ssize_t make_modalias (struct device *dev,char *buf) +static ssize_t make_modalias (const struct device *dev,char *buf) {const struct parisc_device *padev =to_parisc_device (dev);const struct parisc_device_id *id = &padev->id;@@ -562,7 +562,7 @@ static ssize_t make_modalias(struct device *dev, char *buf) (u32)id->sversion); } -static int parisc_uevent (struct device *dev,struct kobj_uevent_env *env) +static int parisc_uevent (const struct device *dev,struct kobj_uevent_env *env) {const struct parisc_device *padev;char modalias[40 ];arch/powerpc/platforms/pseries/vio.c +2
-2@@ -1609,10 +1609,10 @@ static int vio_bus_match(struct device *dev, struct device_driver *drv)return (ids !=NULL ) && (vio_match_device (ids, vio_dev) !=NULL ); } -static int vio_hotplug (struct device *dev,struct kobj_uevent_env *env) +static int vio_hotplug (const struct device *dev,struct kobj_uevent_env *env) {const struct vio_dev *vio_dev =to_vio_dev (dev); -struct device_node *dn; +const struct device_node *dn;const char *cp; dn = dev->of_node;arch/sparc/kernel/vio.c +1
-1@@ -46,7 +46,7 @@ static const struct vio_device_id *vio_match_device(return NULL ; } -static int vio_hotplug (struct device *dev,struct kobj_uevent_env *env) +static int vio_hotplug (const struct device *dev,struct kobj_uevent_env *env) {const struct vio_dev *vio_dev =to_vio_dev (dev);drivers/acpi/bus.c +1
-1@@ -1014,7 +1014,7 @@ static int acpi_bus_match(struct device *dev, struct device_driver *drv) && !acpi_match_device_ids (acpi_dev, acpi_drv->ids); } -static int acpi_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int acpi_device_uevent (const struct device *dev,struct kobj_uevent_env *env) {return __acpi_device_uevent_modalias (to_acpi_device (dev), env); }drivers/amba/bus.c +2
-2@@ -235,9 +235,9 @@ static int amba_match(struct device *dev, struct device_driver *drv)return amba_lookup (pcdrv->id_table, pcdev) !=NULL ; } -static int amba_uevent (struct device *dev,struct kobj_uevent_env *env) +static int amba_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct amba_device *pcdev =to_amba_device (dev); +const struct amba_device *pcdev =to_amba_device (dev);int retval =0 ; retval =add_uevent_var (env,"AMBA_ID=%08x" , pcdev->periphid);drivers/base/auxiliary.c +1
-1@@ -185,7 +185,7 @@ static int auxiliary_match(struct device *dev, struct device_driver *drv)return !!auxiliary_match_id (auxdrv->id_table, auxdev); } -static int auxiliary_uevent (struct device *dev,struct kobj_uevent_env *env) +static int auxiliary_uevent (const struct device *dev,struct kobj_uevent_env *env) {const char *name, *p;drivers/base/cpu.c +1
-1@@ -336,7 +336,7 @@ static ssize_t print_cpu_modalias(struct device *dev,return len; } -static int cpu_uevent (struct device *dev,struct kobj_uevent_env *env) +static int cpu_uevent (const struct device *dev,struct kobj_uevent_env *env) {char *buf =kzalloc (PAGE_SIZE ,GFP_KERNEL );if (buf) {drivers/base/platform.c +2
-2@@ -1353,9 +1353,9 @@ static int platform_match(struct device *dev, struct device_driver *drv)return (strcmp (pdev->name, drv->name) ==0 ); } -static int platform_uevent (struct device *dev,struct kobj_uevent_env *env) +static int platform_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct platform_device *pdev =to_platform_device (dev); +const struct platform_device *pdev =to_platform_device (dev);int rc;/* Some devices have extra OF data and an OF-style MODALIAS */ drivers/bcma/main.c +3
-3@@ -28,7 +28,7 @@ static DEFINE_MUTEX(bcma_buses_mutex);static int bcma_bus_match (struct device *dev,struct device_driver *drv);static int bcma_device_probe (struct device *dev);static void bcma_device_remove (struct device *dev); -static int bcma_device_uevent (struct device *dev,struct kobj_uevent_env *env); +static int bcma_device_uevent (const struct device *dev,struct kobj_uevent_env *env);static ssize_t manuf_show (struct device *dev,struct device_attribute *attr,char *buf) {@@ -627,9 +627,9 @@ static void bcma_device_remove(struct device *dev)put_device (dev); } -static int bcma_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int bcma_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { - struct bcma_device *core = container_of(dev, struct bcma_device, dev); + const struct bcma_device *core = container_of_const(dev, struct bcma_device, dev); return add_uevent_var(env, "MODALIAS=bcma:m%04Xid%04Xrev%02Xcl%02X",drivers/bus/fsl-mc/fsl-mc-bus.c +2
-2@@ -124,9 +124,9 @@ static int fsl_mc_bus_match(struct device *dev, struct device_driver *drv)/* * fsl_mc_bus_uevent - callback invoked when a device is added */ -static int fsl_mc_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int fsl_mc_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct fsl_mc_device *mc_dev =to_fsl_mc_device (dev); +const struct fsl_mc_device *mc_dev =to_fsl_mc_device (dev); if (add_uevent_var(env, "MODALIAS=fsl-mc:v%08Xd%s", mc_dev->obj_desc.vendor,drivers/bus/mhi/ep/main.c +2
-2@@ -1543,9 +1543,9 @@ void mhi_ep_driver_unregister(struct mhi_ep_driver *mhi_drv) }EXPORT_SYMBOL_GPL (mhi_ep_driver_unregister); -static int mhi_ep_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mhi_ep_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mhi_ep_device *mhi_dev =to_mhi_ep_device (dev); +const struct mhi_ep_device *mhi_dev =to_mhi_ep_device (dev);return add_uevent_var (env,"MODALIAS=" MHI_EP_DEVICE_MODALIAS_FMT , mhi_dev->name);drivers/bus/mhi/host/init.c +2
-2@@ -1395,9 +1395,9 @@ void mhi_driver_unregister(struct mhi_driver *mhi_drv) }EXPORT_SYMBOL_GPL (mhi_driver_unregister); -static int mhi_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mhi_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mhi_device *mhi_dev =to_mhi_device (dev); +const struct mhi_device *mhi_dev =to_mhi_device (dev);return add_uevent_var (env,"MODALIAS=" MHI_DEVICE_MODALIAS_FMT , mhi_dev->name);drivers/bus/mips_cdmm.c +2
-2@@ -67,9 +67,9 @@ static int mips_cdmm_match(struct device *dev, struct device_driver *drv)return mips_cdmm_lookup (cdrv->id_table, cdev) !=NULL ; } -static int mips_cdmm_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mips_cdmm_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mips_cdmm_device *cdev =to_mips_cdmm_device (dev); +const struct mips_cdmm_device *cdev =to_mips_cdmm_device (dev);int retval =0 ; retval =add_uevent_var (env,"CDMM_CPU=%u" , cdev->cpu);drivers/bus/sunxi-rsb.c +1
-1@@ -172,7 +172,7 @@ static void sunxi_rsb_device_remove(struct device *dev) drv->remove (to_sunxi_rsb_device (dev)); } -static int sunxi_rsb_device_modalias (struct device *dev,struct kobj_uevent_env *env) +static int sunxi_rsb_device_modalias (const struct device *dev,struct kobj_uevent_env *env) {return of_device_uevent_modalias (dev, env); }drivers/cxl/core/memdev.c +1
-1@@ -162,7 +162,7 @@ static const struct device_type cxl_memdev_type = { .groups = cxl_memdev_attribute_groups, }; -bool is_cxl_memdev (struct device *dev) +bool is_cxl_memdev (const struct device *dev) {return dev->type == &cxl_memdev_type; }drivers/cxl/core/port.c +4
-4@@ -38,7 +38,7 @@ static ssize_t devtype_show(struct device *dev, struct device_attribute *attr, }static DEVICE_ATTR_RO (devtype); -static int cxl_device_id (struct device *dev) +static int cxl_device_id (const struct device *dev) {if (dev->type == &cxl_nvdimm_bridge_type)return CXL_DEVICE_NVDIMM_BRIDGE ;@@ -523,13 +523,13 @@ static const struct device_type cxl_port_type = { .groups = cxl_port_attribute_groups, }; -bool is_cxl_port (struct device *dev) +bool is_cxl_port (const struct device *dev) {return dev->type == &cxl_port_type; }EXPORT_SYMBOL_NS_GPL (is_cxl_port,CXL ); -struct cxl_port *to_cxl_port (struct device *dev) +struct cxl_port *to_cxl_port (const struct device *dev) {if (dev_WARN_ONCE (dev, dev->type != &cxl_port_type,"not a cxl_port device\n" ))@@ -1826,7 +1826,7 @@ void cxl_driver_unregister(struct cxl_driver *cxl_drv) }EXPORT_SYMBOL_NS_GPL (cxl_driver_unregister,CXL ); -static int cxl_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int cxl_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) {return add_uevent_var (env,"MODALIAS=" CXL_MODALIAS_FMT ,cxl_device_id (dev));drivers/cxl/cxl.h +2
-2@@ -588,8 +588,8 @@ static inline bool is_cxl_root(struct cxl_port *port)return port->uport == port->dev.parent; } -bool is_cxl_port (struct device *dev); -struct cxl_port *to_cxl_port (struct device *dev); +bool is_cxl_port (const struct device *dev); +struct cxl_port *to_cxl_port (const struct device *dev);struct pci_bus ;int devm_cxl_register_pci_bus (struct device *host,struct device *uport,struct pci_bus *bus);drivers/cxl/cxlmem.h +1
-1@@ -72,7 +72,7 @@ cxled_to_memdev(struct cxl_endpoint_decoder *cxled)return to_cxl_memdev (port->uport); } -bool is_cxl_memdev (struct device *dev); +bool is_cxl_memdev (const struct device *dev);static inline bool is_cxl_endpoint (struct cxl_port *port) {return is_cxl_memdev (port->uport);drivers/dax/bus.c +1
-1@@ -18,7 +18,7 @@ struct dax_id {char dev_name[DAX_NAME_LEN ]; }; -static int dax_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int dax_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) {/* * We only ever expect to handle device-dax instances, i.e. the drivers/eisa/eisa-bus.c +2
-2@@ -127,9 +127,9 @@ static int eisa_bus_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int eisa_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int eisa_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct eisa_device *edev =to_eisa_device (dev); +const struct eisa_device *edev =to_eisa_device (dev);add_uevent_var (env,"MODALIAS=" EISA_DEVICE_MODALIAS_FMT , edev->id.sig);return 0 ;drivers/firmware/arm_ffa/bus.c +2
-2@@ -56,9 +56,9 @@ static void ffa_device_remove(struct device *dev) ffa_drv->remove (to_ffa_dev (dev)); } -static int ffa_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ffa_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct ffa_device *ffa_dev =to_ffa_dev (dev); +const struct ffa_device *ffa_dev =to_ffa_dev (dev);return add_uevent_var (env,"MODALIAS=arm_ffa:%04x:%pUb" , ffa_dev->vm_id, &ffa_dev->uuid);drivers/fpga/dfl.c +2
-2@@ -293,9 +293,9 @@ static void dfl_bus_remove(struct device *dev) ddrv->remove (ddev); } -static int dfl_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int dfl_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct dfl_device *ddev =to_dfl_dev (dev); +const struct dfl_device *ddev =to_dfl_dev (dev);return add_uevent_var (env,"MODALIAS=dfl:t%04Xf%04X" , ddev->type, ddev->feature_id);drivers/gpu/drm/drm_mipi_dsi.c +2
-2@@ -62,9 +62,9 @@ static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int mipi_dsi_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mipi_dsi_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mipi_dsi_device *dsi =to_mipi_dsi_device (dev); +const struct mipi_dsi_device *dsi =to_mipi_dsi_device (dev);int err; err =of_device_uevent_modalias (dev, env);drivers/gpu/host1x/bus.c +1
-1@@ -338,7 +338,7 @@ static int host1x_device_match(struct device *dev, struct device_driver *drv)return strcmp (dev_name (dev), drv->name) ==0 ; } -static int host1x_device_uevent (struct device *dev, +static int host1x_device_uevent (const struct device *dev,struct kobj_uevent_env *env) {struct device_node *np = dev->parent->of_node;drivers/greybus/core.c +7
-7@@ -78,14 +78,14 @@ static int greybus_match_device(struct device *dev, struct device_driver *drv)return 0 ; } -static int greybus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int greybus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct gb_host_device *hd; -struct gb_module *module =NULL ; -struct gb_interface *intf =NULL ; -struct gb_control *control =NULL ; -struct gb_bundle *bundle =NULL ; -struct gb_svc *svc =NULL ; +const struct gb_host_device *hd; +const struct gb_module *module =NULL ; +const struct gb_interface *intf =NULL ; +const struct gb_control *control =NULL ; +const struct gb_bundle *bundle =NULL ; +const struct gb_svc *svc =NULL ;if (is_gb_host_device (dev)) { hd =to_gb_host_device (dev);drivers/hid/hid-core.c +2
-2@@ -2664,9 +2664,9 @@ static const struct attribute_group hid_dev_group = { };__ATTRIBUTE_GROUPS (hid_dev); -static int hid_uevent (struct device *dev,struct kobj_uevent_env *env) +static int hid_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct hid_device *hdev =to_hid_device (dev); +const struct hid_device *hdev =to_hid_device (dev);if (add_uevent_var (env,"HID_ID=%04X:%08X:%08X" , hdev->bus, hdev->vendor, hdev->product))drivers/hid/intel-ish-hid/ishtp/bus.c +1
-1@@ -361,7 +361,7 @@ static struct attribute *ishtp_cl_dev_attrs[] = { };ATTRIBUTE_GROUPS (ishtp_cl_dev); -static int ishtp_cl_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ishtp_cl_uevent (const struct device *dev,struct kobj_uevent_env *env) {if (add_uevent_var (env,"MODALIAS=" ISHTP_MODULE_PREFIX "%s" ,dev_name (dev)))return -ENOMEM ;drivers/hsi/hsi_core.c +1
-1@@ -30,7 +30,7 @@ static struct attribute *hsi_bus_dev_attrs[] = { };ATTRIBUTE_GROUPS (hsi_bus_dev); -static int hsi_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int hsi_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) {add_uevent_var (env,"MODALIAS=hsi:%s" ,dev_name (dev));drivers/hv/vmbus_drv.c +2
-2@@ -711,9 +711,9 @@ __ATTRIBUTE_GROUPS(vmbus_bus);* representation of the device guid (each byte of the guid will be * represented with two hex characters. */ -static int vmbus_uevent (struct device *device,struct kobj_uevent_env *env) +static int vmbus_uevent (const struct device *device,struct kobj_uevent_env *env) { -struct hv_device *dev =device_to_hv_device (device); +const struct hv_device *dev =device_to_hv_device (device);const char *format ="MODALIAS=vmbus:%*phN" ;return add_uevent_var (env, format,UUID_SIZE , &dev->dev_type);drivers/input/serio/serio.c +2
-2@@ -895,9 +895,9 @@ static int serio_bus_match(struct device *dev, struct device_driver *drv)return err; \ }while (0 ) -static int serio_uevent(struct device *dev, struct kobj_uevent_env *env) +static int serio_uevent(const struct device *dev, struct kobj_uevent_env *env) { -struct serio *serio; +const struct serio *serio;if (!dev)return -ENODEV ;drivers/ipack/ipack.c +2
-2@@ -76,9 +76,9 @@ static void ipack_bus_remove(struct device *device) drv->ops->remove (dev); } -static int ipack_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ipack_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct ipack_device *idev; +const struct ipack_device *idev;if (!dev)return -ENODEV ;drivers/macintosh/macio_asic.c +1
-1@@ -128,7 +128,7 @@ static int macio_device_resume(struct device * dev)return 0 ; } -static int macio_device_modalias (struct device *dev,struct kobj_uevent_env *env) +static int macio_device_modalias (const struct device *dev,struct kobj_uevent_env *env) {return of_device_uevent_modalias (dev, env); }drivers/mcb/mcb-core.c +2
-2@@ -41,9 +41,9 @@ static int mcb_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int mcb_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mcb_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mcb_device *mdev =to_mcb_device (dev); +const struct mcb_device *mdev =to_mcb_device (dev);int ret; ret =add_uevent_var (env,"MODALIAS=mcb:16z%03d" , mdev->id);drivers/memstick/core/memstick.c +3
-3@@ -57,10 +57,10 @@ static int memstick_bus_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int memstick_uevent (struct device *dev,struct kobj_uevent_env *env) +static int memstick_uevent (const struct device *dev,struct kobj_uevent_env *env) { - struct memstick_dev *card = container_of(dev, struct memstick_dev, - dev); + const struct memstick_dev *card = container_of_const(dev, struct memstick_dev, + dev);if (add_uevent_var (env,"MEMSTICK_TYPE=%02X" , card->id.type))return -ENOMEM ;drivers/misc/mei/bus.c +2
-2@@ -1222,9 +1222,9 @@ ATTRIBUTE_GROUPS(mei_cldev);* * Return: 0 on success -ENOMEM on when add_uevent_var fails */ -static int mei_cl_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mei_cl_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mei_cl_device *cldev =to_mei_cl_device (dev); +const struct mei_cl_device *cldev =to_mei_cl_device (dev);const uuid_le *uuid =mei_me_cl_uuid (cldev->me_cl);u8 version =mei_me_cl_ver (cldev->me_cl);drivers/misc/tifm_core.c +2
-2@@ -55,9 +55,9 @@ static int tifm_bus_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int tifm_uevent (struct device *dev,struct kobj_uevent_env *env) +static int tifm_uevent (const struct device *dev,struct kobj_uevent_env *env) { - struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev); + const struct tifm_dev *sock = container_of_const(dev, struct tifm_dev, dev);if (add_uevent_var (env,"TIFM_CARD_TYPE=%s" ,tifm_media_type_name (sock->type,1 )))return -ENOMEM ;drivers/mmc/core/bus.c +2
-2@@ -55,9 +55,9 @@ static struct attribute *mmc_dev_attrs[] = {ATTRIBUTE_GROUPS (mmc_dev);static int -mmc_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +mmc_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct mmc_card *card =mmc_dev_to_card (dev); +const struct mmc_card *card =mmc_dev_to_card (dev);const char *type;unsigned int i;int retval =0 ;drivers/mmc/core/sdio_bus.c +2
-2@@ -120,9 +120,9 @@ static int sdio_bus_match(struct device *dev, struct device_driver *drv) }static int -sdio_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +sdio_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct sdio_func *func =dev_to_sdio_func (dev); +const struct sdio_func *func =dev_to_sdio_func (dev);unsigned int i; if (add_uevent_var(env,drivers/net/phy/mdio_bus.c +1
-1@@ -995,7 +995,7 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int mdio_uevent (struct device *dev,struct kobj_uevent_env *env) +static int mdio_uevent (const struct device *dev,struct kobj_uevent_env *env) {int rc;drivers/net/xen-netback/xenbus.c +1
-1@@ -200,7 +200,7 @@ static void xenvif_debugfs_delif(struct xenvif *vif)* and vif variables to the environment, for the benefit of the vif-* hotplug * scripts. */ -static int netback_uevent (struct xenbus_device *xdev, +static int netback_uevent (const struct xenbus_device *xdev,struct kobj_uevent_env *env) {struct backend_info *be =dev_get_drvdata (&xdev->dev);drivers/nvdimm/bus.c +2
-2@@ -28,7 +28,7 @@ static int nvdimm_bus_major;struct class *nd_class;static DEFINE_IDA (nd_ida); -static int to_nd_device_type (struct device *dev) +static int to_nd_device_type (const struct device *dev) {if (is_nvdimm (dev))return ND_DEVICE_DIMM ;@@ -42,7 +42,7 @@ static int to_nd_device_type(struct device *dev)return 0 ; } -static int nvdimm_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int nvdimm_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) {return add_uevent_var (env,"MODALIAS=" ND_DEVICE_MODALIAS_FMT ,to_nd_device_type (dev));drivers/nvdimm/dax_devs.c +1
-1@@ -38,7 +38,7 @@ static const struct device_type nd_dax_device_type = { .groups = nd_pfn_attribute_groups, }; -bool is_nd_dax (struct device *dev) +bool is_nd_dax (const struct device *dev) {return dev ? dev->type == &nd_dax_device_type : false; }drivers/nvdimm/dimm_devs.c +1
-1@@ -572,7 +572,7 @@ static const struct device_type nvdimm_device_type = { .groups = nvdimm_attribute_groups, }; -bool is_nvdimm (struct device *dev) +bool is_nvdimm (const struct device *dev) {return dev->type == &nvdimm_device_type; }drivers/nvdimm/nd-core.h +5
-5@@ -82,14 +82,14 @@ static inline void nvdimm_security_overwrite_query(struct work_struct *work) }#endif -bool is_nvdimm (struct device *dev); -bool is_nd_pmem (struct device *dev); -bool is_nd_volatile (struct device *dev); -static inline bool is_nd_region (struct device *dev) +bool is_nvdimm (const struct device *dev); +bool is_nd_pmem (const struct device *dev); +bool is_nd_volatile (const struct device *dev); +static inline bool is_nd_region (const struct device *dev) {return is_nd_pmem (dev) ||is_nd_volatile (dev); } -static inline bool is_memory (struct device *dev) +static inline bool is_memory (const struct device *dev) {return is_nd_pmem (dev) ||is_nd_volatile (dev); }drivers/nvdimm/nd.h +2
-2@@ -599,7 +599,7 @@ static inline int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)struct nd_dax *to_nd_dax (struct device *dev);#if IS_ENABLED (CONFIG_NVDIMM_DAX )int nd_dax_probe (struct device *dev,struct nd_namespace_common *ndns); -bool is_nd_dax (struct device *dev); +bool is_nd_dax (const struct device *dev);struct device *nd_dax_create (struct nd_region *nd_region);#else static inline int nd_dax_probe(struct device *dev,@@ -608,7 +608,7 @@ static inline int nd_dax_probe(struct device *dev,return -ENODEV ; } -static inline bool is_nd_dax (struct device *dev) +static inline bool is_nd_dax (const struct device *dev) {return false; }drivers/nvdimm/region_devs.c +2
-2@@ -839,12 +839,12 @@ static const struct device_type nd_volatile_device_type = { .groups = nd_region_attribute_groups, }; -bool is_nd_pmem (struct device *dev) +bool is_nd_pmem (const struct device *dev) {return dev ? dev->type == &nd_pmem_device_type : false; } -bool is_nd_volatile (struct device *dev) +bool is_nd_volatile (const struct device *dev) {return dev ? dev->type == &nd_volatile_device_type : false; }drivers/pci/pci-driver.c +2
-2@@ -1545,9 +1545,9 @@ void pci_dev_put(struct pci_dev *dev) }EXPORT_SYMBOL (pci_dev_put); -static int pci_uevent (struct device *dev,struct kobj_uevent_env *env) +static int pci_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct pci_dev *pdev; +const struct pci_dev *pdev;if (!dev)return -ENODEV ;drivers/pcmcia/ds.c +2
-2@@ -927,9 +927,9 @@ static int pcmcia_bus_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int pcmcia_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int pcmcia_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct pcmcia_device *p_dev; +const struct pcmcia_device *p_dev;int i;u32 hash[4 ] = {0 ,0 ,0 ,0 };drivers/platform/x86/wmi.c +2
-2@@ -797,9 +797,9 @@ static struct attribute *wmi_method_attrs[] = { };ATTRIBUTE_GROUPS (wmi_method); -static int wmi_dev_uevent (struct device *dev,struct kobj_uevent_env *env) +static int wmi_dev_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct wmi_block *wblock =dev_to_wblock (dev); +const struct wmi_block *wblock =dev_to_wblock (dev);if (add_uevent_var (env,"MODALIAS=wmi:%pUL" , &wblock->gblock.guid))return -ENOMEM ;drivers/rapidio/rio-driver.c +2
-2@@ -204,9 +204,9 @@ static int rio_match_bus(struct device *dev, struct device_driver *drv) out:return 0 ; } -static int rio_uevent (struct device *dev,struct kobj_uevent_env *env) +static int rio_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct rio_dev *rdev; +const struct rio_dev *rdev;if (!dev)return -ENODEV ;drivers/rpmsg/rpmsg_core.c +2
-2@@ -492,9 +492,9 @@ static int rpmsg_dev_match(struct device *dev, struct device_driver *drv)return of_driver_match_device (dev, drv); } -static int rpmsg_uevent (struct device *dev,struct kobj_uevent_env *env) +static int rpmsg_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct rpmsg_device *rpdev =to_rpmsg_device (dev); +const struct rpmsg_device *rpdev =to_rpmsg_device (dev);int ret; ret =of_device_uevent_modalias (dev, env);drivers/s390/cio/css.c +2
-2@@ -1402,9 +1402,9 @@ static void css_shutdown(struct device *dev) sch->driver->shutdown (sch); } -static int css_uevent (struct device *dev,struct kobj_uevent_env *env) +static int css_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct subchannel *sch =to_subchannel (dev); +const struct subchannel *sch =to_subchannel (dev);int ret; ret =add_uevent_var (env,"ST=%01X" , sch->st);drivers/s390/cio/device.c +4
-4@@ -80,7 +80,7 @@ ccw_bus_match (struct device * dev, struct device_driver * drv)* specified size. Return length of resulting string (excluding trailing '\0') * even if string doesn't fit buffer (snprintf semantics). */ static int snprint_alias (char *buf,size_t size, -struct ccw_device_id *id,const char *suffix) +const struct ccw_device_id *id,const char *suffix) {int len;@@ -101,10 +101,10 @@ static int snprint_alias(char *buf, size_t size,/* Set up environment variables for ccw device uevent. Return 0 on success, * non-zero otherwise. */ -static int ccw_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ccw_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct ccw_device *cdev =to_ccwdev (dev); -struct ccw_device_id *id = &(cdev->id); +const struct ccw_device *cdev =to_ccwdev (dev); +const struct ccw_device_id *id = &(cdev->id);int ret;char modalias_buf[30 ];drivers/s390/cio/scm.c +1
-1@@ -37,7 +37,7 @@ static void scmdev_remove(struct device *dev) scmdrv->remove (scmdev); } -static int scmdev_uevent (struct device *dev,struct kobj_uevent_env *env) +static int scmdev_uevent (const struct device *dev,struct kobj_uevent_env *env) {return add_uevent_var (env,"MODALIAS=scm:scmdev" ); }drivers/s390/crypto/ap_bus.c +2
-2@@ -613,10 +613,10 @@ static int ap_bus_match(struct device *dev, struct device_driver *drv)* It sets up a single environment variable DEV_TYPE which contains the * hardware device type. */ -static int ap_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ap_uevent (const struct device *dev,struct kobj_uevent_env *env) {int rc =0 ; -struct ap_device *ap_dev =to_ap_dev (dev); +const struct ap_device *ap_dev =to_ap_dev (dev);/* Uevents from ap bus core don't need extensions to the env */ if (dev == ap_root_device)drivers/scsi/scsi_sysfs.c +2
-2@@ -534,9 +534,9 @@ static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)return (sdp->inq_periph_qual ==SCSI_INQ_PQ_CON )?1 :0 ; } -static int scsi_bus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int scsi_bus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct scsi_device *sdev; +const struct scsi_device *sdev;if (dev->type != &scsi_dev_type)return 0 ;drivers/slimbus/core.c +2
-2@@ -93,9 +93,9 @@ static void slim_device_remove(struct device *dev) } } -static int slim_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int slim_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct slim_device *sbdev =to_slim_device (dev); +const struct slim_device *sbdev =to_slim_device (dev);return add_uevent_var (env,"MODALIAS=slim:%s" ,dev_name (&sbdev->dev)); }drivers/soc/qcom/apr.c +2
-2@@ -387,9 +387,9 @@ static void apr_device_remove(struct device *dev)spin_unlock (&apr->svcs_lock); } -static int apr_uevent (struct device *dev,struct kobj_uevent_env *env) +static int apr_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct apr_device *adev =to_apr_device (dev); +const struct apr_device *adev =to_apr_device (dev);int ret; ret =of_device_uevent_modalias (dev, env);drivers/spi/spi.c +1
-1@@ -395,7 +395,7 @@ static int spi_match_device(struct device *dev, struct device_driver *drv)return strcmp (spi->modalias, drv->name) ==0 ; } -static int spi_uevent (struct device *dev,struct kobj_uevent_env *env) +static int spi_uevent (const struct device *dev,struct kobj_uevent_env *env) {const struct spi_device *spi =to_spi_device (dev);int rc;drivers/spmi/spmi.c +1
-1@@ -366,7 +366,7 @@ static void spmi_drv_shutdown(struct device *dev) sdrv->shutdown (to_spmi_device (dev)); } -static int spmi_drv_uevent (struct device *dev,struct kobj_uevent_env *env) +static int spmi_drv_uevent (const struct device *dev,struct kobj_uevent_env *env) {int ret;drivers/ssb/main.c +2
-2@@ -339,9 +339,9 @@ static int ssb_bus_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int ssb_device_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ssb_device_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct ssb_device *ssb_dev =dev_to_ssb_dev (dev); +const struct ssb_device *ssb_dev =dev_to_ssb_dev (dev);if (!dev)return -ENODEV ;drivers/staging/greybus/gbphy.c +7
-7@@ -71,14 +71,14 @@ static const struct device_type greybus_gbphy_dev_type = { .pm = &gb_gbphy_pm_ops, }; -static int gbphy_dev_uevent (struct device *dev,struct kobj_uevent_env *env) +static int gbphy_dev_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct gbphy_device *gbphy_dev =to_gbphy_dev (dev); -struct greybus_descriptor_cport *cport_desc = gbphy_dev->cport_desc; -struct gb_bundle *bundle = gbphy_dev->bundle; -struct gb_interface *intf = bundle->intf; -struct gb_module *module = intf->module; -struct gb_host_device *hd = intf->hd; +const struct gbphy_device *gbphy_dev =to_gbphy_dev (dev); +const struct greybus_descriptor_cport *cport_desc = gbphy_dev->cport_desc; +const struct gb_bundle *bundle = gbphy_dev->bundle; +const struct gb_interface *intf = bundle->intf; +const struct gb_module *module = intf->module; +const struct gb_host_device *hd = intf->hd;if (add_uevent_var (env,"BUS=%u" , hd->bus_id))return -ENOMEM ;drivers/tee/tee_core.c +1
-1@@ -1207,7 +1207,7 @@ static int tee_client_device_match(struct device *dev,return 0 ; } -static int tee_client_device_uevent (struct device *dev, +static int tee_client_device_uevent (const struct device *dev,struct kobj_uevent_env *env) {uuid_t *dev_id = &to_tee_client_device (dev)->id.uuid;drivers/usb/common/ulpi.c +2
-2@@ -55,9 +55,9 @@ static int ulpi_match(struct device *dev, struct device_driver *driver)return 0 ; } -static int ulpi_uevent (struct device *dev,struct kobj_uevent_env *env) +static int ulpi_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct ulpi *ulpi =to_ulpi_dev (dev); +const struct ulpi *ulpi =to_ulpi_dev (dev);int ret; ret =of_device_uevent_modalias (dev, env);drivers/usb/core/driver.c +3
-3@@ -899,14 +899,14 @@ static int usb_device_match(struct device *dev, struct device_driver *drv)return 0 ; } -static int usb_uevent (struct device *dev,struct kobj_uevent_env *env) +static int usb_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct usb_device *usb_dev; +const struct usb_device *usb_dev;if (is_usb_device (dev)) { usb_dev =to_usb_device (dev); }else if (is_usb_interface (dev)) { -struct usb_interface *intf =to_usb_interface (dev); +const struct usb_interface *intf =to_usb_interface (dev); usb_dev =interface_to_usbdev (intf); }else {drivers/usb/typec/bus.c +2
-2@@ -321,9 +321,9 @@ static int typec_match(struct device *dev, struct device_driver *driver)return 0 ; } -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) { -struct typec_altmode *altmode =to_typec_altmode (dev); +const struct typec_altmode *altmode =to_typec_altmode (dev);if (add_uevent_var (env,"SVID=%04X" , altmode->svid))return -ENOMEM ;drivers/virtio/virtio.c +2
-2@@ -95,9 +95,9 @@ static int virtio_dev_match(struct device *_dv, struct device_driver *_dr)return 0 ; } -static int virtio_uevent (struct device *_dv,struct kobj_uevent_env *env) +static int virtio_uevent (const struct device *_dv,struct kobj_uevent_env *env) { -struct virtio_device *dev =dev_to_virtio (_dv); +const struct virtio_device *dev =dev_to_virtio (_dv);return add_uevent_var (env,"MODALIAS=virtio:d%08Xv%08X" , dev->id.device, dev->id.vendor);drivers/w1/w1.c +5
-5@@ -170,7 +170,7 @@ static struct w1_family w1_default_family = { .fops = &w1_default_fops, }; -static int w1_uevent (struct device *dev,struct kobj_uevent_env *env); +static int w1_uevent (const struct device *dev,struct kobj_uevent_env *env);static struct bus_type w1_bus_type = { .name ="w1" ,@@ -577,11 +577,11 @@ void w1_destroy_master_attributes(struct w1_master *master)sysfs_remove_group (&master->dev.kobj, &w1_master_defattr_group); } -static int w1_uevent (struct device *dev,struct kobj_uevent_env *env) +static int w1_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct w1_master *md =NULL ; -struct w1_slave *sl =NULL ; -char *event_owner, *name; +const struct w1_master *md =NULL ; +const struct w1_slave *sl =NULL ; +const char *event_owner, *name;int err =0 ;if (dev->driver == &w1_master_driver) {drivers/xen/pvcalls-back.c +1
-1@@ -1186,7 +1186,7 @@ static int pvcalls_back_remove(struct xenbus_device *dev)return 0 ; } -static int pvcalls_back_uevent (struct xenbus_device *xdev, +static int pvcalls_back_uevent (const struct xenbus_device *xdev,struct kobj_uevent_env *env) {return 0 ;drivers/xen/xenbus/xenbus_probe_backend.c +4
-4@@ -92,12 +92,12 @@ static int backend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename)return 0 ; } -static int xenbus_uevent_backend (struct device *dev, +static int xenbus_uevent_backend (const struct device *dev,struct kobj_uevent_env *env) { -struct xenbus_device *xdev; -struct xenbus_driver *drv; -struct xen_bus_type *bus; +const struct xenbus_device *xdev; +const struct xenbus_driver *drv; +const struct xen_bus_type *bus;DPRINTK ("" );drivers/xen/xenbus/xenbus_probe_frontend.c +2
-2@@ -73,10 +73,10 @@ static int xenbus_probe_frontend(struct xen_bus_type *bus, const char *type,return err; } -static int xenbus_uevent_frontend (struct device *_dev, +static int xenbus_uevent_frontend (const struct device *_dev,struct kobj_uevent_env *env) { -struct xenbus_device *dev =to_xenbus_device (_dev); +const struct xenbus_device *dev =to_xenbus_device (_dev);if (add_uevent_var (env,"MODALIAS=xen:%s" , dev->devicetype))return -ENOMEM ;drivers/zorro/zorro-driver.c +2
-2@@ -130,9 +130,9 @@ static int zorro_bus_match(struct device *dev, struct device_driver *drv)return !!zorro_match_device (ids, z); } -static int zorro_uevent (struct device *dev,struct kobj_uevent_env *env) +static int zorro_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct zorro_dev *z; +const struct zorro_dev *z;if (!dev)return -ENODEV ;include/linux/device/bus.h +1
-1@@ -90,7 +90,7 @@ struct bus_type {const struct attribute_group **drv_groups;int (*match)(struct device *dev,struct device_driver *drv); -int (*uevent)(struct device *dev,struct kobj_uevent_env *env); +int (*uevent)(const struct device *dev,struct kobj_uevent_env *env);int (*probe)(struct device *dev);void (*sync_state)(struct device *dev);void (*remove)(struct device *dev);include/linux/spi/spi.h +1
-1@@ -223,7 +223,7 @@ struct spi_device {static_assert ((SPI_MODE_KERNEL_MASK &SPI_MODE_USER_MASK ) ==0 ,"SPI_MODE_USER_MASK & SPI_MODE_KERNEL_MASK must not overlap" ); -static inline struct spi_device *to_spi_device (struct device *dev) +static inline struct spi_device *to_spi_device (const struct device *dev) { return dev ? container_of(dev, struct spi_device, dev) : NULL; }include/linux/ssb/ssb.h +1
-1@@ -285,7 +285,7 @@ struct ssb_device {/* Go from struct device to struct ssb_device. */ static inline -struct ssb_device *dev_to_ssb_dev (struct device *dev) +struct ssb_device *dev_to_ssb_dev (const struct device *dev) {struct __ssb_dev_wrapper *wrap; wrap = container_of(dev, struct __ssb_dev_wrapper, dev);include/sound/hdaudio.h +1
-1@@ -123,7 +123,7 @@ void snd_hdac_device_exit(struct hdac_device *dev);int snd_hdac_device_register (struct hdac_device *codec);void snd_hdac_device_unregister (struct hdac_device *codec);int snd_hdac_device_set_chip_name (struct hdac_device *codec,const char *name); -int snd_hdac_codec_modalias (struct hdac_device *hdac,char *buf,size_t size); +int snd_hdac_codec_modalias (const struct hdac_device *hdac,char *buf,size_t size);int snd_hdac_refresh_widgets (struct hdac_device *codec);include/xen/xenbus.h +1
-1@@ -117,7 +117,7 @@ struct xenbus_driver {int (*remove)(struct xenbus_device *dev);int (*suspend)(struct xenbus_device *dev);int (*resume)(struct xenbus_device *dev); -int (*uevent)(struct xenbus_device *,struct kobj_uevent_env *); +int (*uevent)(const struct xenbus_device *,struct kobj_uevent_env *);struct device_driver driver;int (*read_otherend_details)(struct xenbus_device *dev);int (*is_ready)(struct xenbus_device *dev);sound/aoa/soundbus/core.c +3
-3@@ -55,10 +55,10 @@ static int soundbus_probe(struct device *dev) } -static int soundbus_uevent (struct device *dev,struct kobj_uevent_env *env) +static int soundbus_uevent (const struct device *dev,struct kobj_uevent_env *env) { -struct soundbus_dev * soundbus_dev; -struct platform_device * of; +const struct soundbus_dev * soundbus_dev; +const struct platform_device * of;const char *compat;int retval =0 ;int cplen, seen =0 ;sound/hda/hda_bus_type.c +1
-1@@ -65,7 +65,7 @@ static int hda_bus_match(struct device *dev, struct device_driver *drv)return 1 ; } -static int hda_uevent (struct device *dev,struct kobj_uevent_env *env) +static int hda_uevent (const struct device *dev,struct kobj_uevent_env *env) {char modalias[32 ];sound/hda/hdac_device.c +1
-2@@ -204,7 +204,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_set_chip_name);* * Returns the size of string, like snprintf(), or a negative error code. */ -int snd_hdac_codec_modalias (struct hdac_device *codec,char *buf,size_t size) +int snd_hdac_codec_modalias (const struct hdac_device *codec,char *buf,size_t size) {return scnprintf (buf, size,"hdaudio:v%08Xr%08Xa%02X\n" , codec->vendor_id, codec->revision_id, codec->type); --2.39.0
PATCH v2 15/16 driver core: make struct bus_type.uevent() take a const *
In reply to Greg Kroah-HartmanFollowing build regression started from next-20230130.
Regressions found on sh:
- build/gcc-11-dreamcast_defconfig
drivers/sh/maple/maple.c:785:19: error: initialization of 'int (*)(const struct device *, struct kobj_uevent_env *)' from incompatible pointer type 'int (*)(struct device *, struct kobj_uevent_env *)' [-Werror=incompatible-pointer-types]
785 | .uevent = maple_bus_uevent,
| ^~~~~~~~~~~~~~~~
The bisection pointed to this commit,
2a81ada32f0e ("driver core: make struct bus_type.uevent() take a const *")
--
Linaro LKFT
https://lkft.linaro.org
Greg KH
maintainerRe: [PATCH v2 15/16] driver core: make struct bus_type.uevent() take a const *
Quoted 10 lines · Naresh Kamboju
Following build regression started from next-20230130.
Regressions found on sh:
- build/gcc-11-dreamcast_defconfig
drivers/sh/maple/maple.c:785:19: error: initialization of 'int (*)(const struct device *, structkobj_uevent_env*)' from incompatible pointer type 'int (*)(struct device *, structkobj_uevent_env*)' [-Werror=incompatible-pointer-types]
785 | .uevent =maple_bus_uevent,| ^~~~~~~~~~~~~~~~
Quoted 7 lines
The bisection pointed to this commit,
2a81ada32f0e("driver core: make structbus_type.uevent()take a const *")
Odd that no other build system reported this (linux-next, 0-day, etc.) I guess no one really cares about sh and the dreamcast anymore? :)
Anyway, thanks, I'll fix this up.
greg k-h
Greg Kroah-Hartman
maintainerPATCH v2 16/16 kobject: kset_uevent_ops: make uevent() callback take a const *
In reply to Greg Kroah-HartmanThe uevent() callback in struct kset_uevent_ops does not modify the kobject passed into it, so make the pointer const to enforce this restriction. When doing so, fix up all existing uevent() callbacks to have the correct signature to preserve the build.
--- drivers/base/core.c | 4 ++-- fs/dlm/lockspace.c | 4 ++-- fs/gfs2/sys.c | 6 +++--- include/linux/kobject.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)
drivers/base/core.c +2 -2
@@ -2387,9 +2387,9 @@ static const char *dev_uevent_name(const struct kobject *kobj)return NULL ; } -static int dev_uevent (struct kobject *kobj,struct kobj_uevent_env *env) +static int dev_uevent (const struct kobject *kobj,struct kobj_uevent_env *env) { -struct device *dev =kobj_to_dev (kobj); +const struct device *dev =kobj_to_dev (kobj);int retval =0 ;/* add device node properties if present */
fs/dlm/lockspace.c +2 -2
@@ -215,9 +215,9 @@ static int do_uevent(struct dlm_ls *ls, int in)return ls->ls_uevent_result; } -static int dlm_uevent (struct kobject *kobj,struct kobj_uevent_env *env) +static int dlm_uevent (const struct kobject *kobj,struct kobj_uevent_env *env) { - struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj); + const struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj);add_uevent_var (env,"LOCKSPACE=%s" , ls->ls_name);return 0 ;
fs/gfs2/sys.c +3 -3
@@ -767,10 +767,10 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp)wait_for_completion (&sdp->sd_kobj_unregister); } -static int gfs2_uevent (struct kobject *kobj,struct kobj_uevent_env *env) +static int gfs2_uevent (const struct kobject *kobj,struct kobj_uevent_env *env) { - struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); -struct super_block *s = sdp->sd_vfs; + const struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); +const struct super_block *s = sdp->sd_vfs;add_uevent_var (env,"LOCKTABLE=%s" , sdp->sd_table_name);add_uevent_var (env,"LOCKPROTO=%s" , sdp->sd_proto_name);
include/linux/kobject.h +1 -1
@@ -137,7 +137,7 @@ struct kobj_uevent_env {struct kset_uevent_ops {int (*const filter)(const struct kobject *kobj);const char *(*const name)(const struct kobject *kobj); -int (*const uevent)(struct kobject *kobj,struct kobj_uevent_env *env); +int (*const uevent)(const struct kobject *kobj,struct kobj_uevent_env *env); };struct kobj_attribute {
Signature · 1 line
2.39.0
Re: [PATCH v2 16/16] kobject: kset_uevent_ops: make uevent() callback take a const *
Quoted 6 lines · Greg Kroah-Hartman
The
uevent()callback in structkset_uevent_opsdoes not modify the kobject passed into it, so make the pointer const to enforce this restriction. When doing so, fix up all existinguevent()callbacks to have the correct signature to preserve the build.
Quoted 7 lines
Cc "Rafael J. Wysocki" <[email protected]>Cc Christine Caulfield <[email protected]>Cc David Teigland <[email protected]>Cc Bob Peterson <[email protected]>Cc Andreas Gruenbacher <[email protected]>Cc cluster-devel at redhat.comSigned-off-by Greg Kroah-Hartman <[email protected]>
Quoted 73 lines
--- drivers/base/core.c | 4 ++-- fs/dlm/lockspace.c | 4 ++-- fs/gfs2/sys.c | 6 +++--- include/linux/kobject.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)drivers/base/core.c +2
-2@@ -2387,9 +2387,9 @@ static const char *dev_uevent_name(const struct kobject *kobj)return NULL ; } -static int dev_uevent (struct kobject *kobj,struct kobj_uevent_env *env) +static int dev_uevent (const struct kobject *kobj,struct kobj_uevent_env *env) { -struct device *dev =kobj_to_dev (kobj); +const struct device *dev =kobj_to_dev (kobj);int retval =0 ;/* add device node properties if present */ fs/dlm/lockspace.c +2
-2@@ -215,9 +215,9 @@ static int do_uevent(struct dlm_ls *ls, int in)return ls->ls_uevent_result; } -static int dlm_uevent (struct kobject *kobj,struct kobj_uevent_env *env) +static int dlm_uevent (const struct kobject *kobj,struct kobj_uevent_env *env) { - struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj); + const struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj);add_uevent_var (env,"LOCKSPACE=%s" , ls->ls_name);return 0 ;fs/gfs2/sys.c +3
-3@@ -767,10 +767,10 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp)wait_for_completion (&sdp->sd_kobj_unregister); } -static int gfs2_uevent (struct kobject *kobj,struct kobj_uevent_env *env) +static int gfs2_uevent (const struct kobject *kobj,struct kobj_uevent_env *env) { - struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); -struct super_block *s = sdp->sd_vfs; + const struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); +const struct super_block *s = sdp->sd_vfs;add_uevent_var (env,"LOCKTABLE=%s" , sdp->sd_table_name);add_uevent_var (env,"LOCKPROTO=%s" , sdp->sd_proto_name);include/linux/kobject.h +1
-2@@ -137,7 +137,7 @@ struct kobj_uevent_env {struct kset_uevent_ops {int (*const filter)(const struct kobject *kobj);const char *(*const name)(const struct kobject *kobj); -int (*const uevent)(struct kobject *kobj,struct kobj_uevent_env *env); +int (*const uevent)(const struct kobject *kobj,struct kobj_uevent_env *env); };struct kobj_attribute { --2.39.0
Hi,
Quoted 16 lines · Greg Kroah-Hartman
Here's an updated version of this original series:
https://lore.kernel.org/all/[email protected]/that has the goal of making more functions in the driver core take const pointers as they do not actually modify anything. This work is an outgrowth of some conversations I had with the Linux Rust developers talking about the mutability of many of the driver model pointers.
A small subset of the original submission is now in 6.2-rc1 and this series is an outgrown of the original submission in that many things are now changed and a bit more explicit than before.
I can take all of these through the driver-core git tree as they depend on each other. 0-day has been passing on this series for quite a while, so all should be good unless some subsystem trees have added new busses without me noticing.
Quoted 4 lines
Bonus for all of this work, the overall code size of the kernel actually decreased a tiny bit:
126 files changed, 283 insertions(+), 309 deletions(-)while adding a lot more type-safeness to the system.
Other then a small remark on "[PATCH v2 03/16] platform/surface: aggregator:
move to_ssam_device() to use container_of_const()" the platform/surface and platform/x86/wmi.c changes look good to me:
Regards,
Hans
Quoted 161 lines
Changes from v1:
- rebased on 6.2-rc1 and dropped accepted patches already in there.
-container_of_const()is now in 6.2-rc1 so use that in many individual subsystems to make the follow-on changes in the driver core more obvious.
- collected some Reviewed-by
-of_device_uevent_modaliaswas being "abused" by many different subsystems in using it instead of a local bus function which played havoc when enabling stricter type-checking. Move that out into a new function for the busses that were doing this to make it more obvious what they need here.Greg Kroah-Hartman (16):
of: device: makeof_device_uevent_modalias()take a const device *
i3c: movedev_to_i3cdev()to usecontainer_of_const()platform/surface: aggregator: moveto_ssam_device()to use
container_of_const()
firewire: movefw_device()andfw_unit()to usecontainer_of_const()driver core: make structdevice_type.uevent()take a const * driver core: make structdevice_type.devnode()take a const * driver core:device_get_devnode()should take a const *
vio: moveto_vio_dev()to usecontainer_of_const()platform/x86: wmi: movedev_to_wblock()anddev_to_wdevto use
container_of_const()
drivers: hv: movedevice_to_hv_deviceto usecontainer_of_const()
virtio: movedev_to_virtio()to usecontainer_of_const()drm/mipi-dsi: moveto_mipi_dsi_device()to usecontainer_of_const()
mcb: moveto_mcb_device()to usecontainer_of_const()xen/xenbus: moveto_xenbus_device()to usecontainer_of_const()driver core: make structbus_type.uevent()take a const *
kobject:kset_uevent_ops: makeuevent()callback take a const *arch/mips/sgi-ip22/ip22-gio.c | 4 ++-- arch/parisc/kernel/drivers.c | 4 ++-- arch/powerpc/include/asm/vio.h | 5 +---- arch/powerpc/platforms/pseries/ibmebus.c | 7 ++++++- arch/powerpc/platforms/pseries/vio.c | 4 ++-- arch/sparc/include/asm/vio.h | 5 +---- arch/sparc/kernel/vio.c | 2 +- block/genhd.c | 2 +- block/partitions/core.c | 4 ++-- drivers/acpi/bus.c | 2 +- drivers/acpi/device_sysfs.c | 8 ++++---- drivers/acpi/internal.h | 2 +- drivers/amba/bus.c | 4 ++-- drivers/base/auxiliary.c | 2 +- drivers/base/base.h | 2 ++ drivers/base/core.c | 6 +++--- drivers/base/cpu.c | 2 +- drivers/base/platform.c | 4 ++-- drivers/bcma/main.c | 6 +++--- drivers/bus/fsl-mc/fsl-mc-bus.c | 4 ++-- drivers/bus/mhi/ep/main.c | 4 ++-- drivers/bus/mhi/host/init.c | 4 ++-- drivers/bus/mips_cdmm.c | 4 ++-- drivers/bus/sunxi-rsb.c | 7 ++++++- drivers/cxl/core/memdev.c | 4 ++-- drivers/cxl/core/port.c | 8 ++++---- drivers/cxl/cxl.h | 4 ++-- drivers/cxl/cxlmem.h | 2 +- drivers/dax/bus.c | 2 +- drivers/eisa/eisa-bus.c | 4 ++-- drivers/firewire/core-device.c | 8 ++++---- drivers/firmware/arm_ffa/bus.c | 4 ++-- drivers/fpga/dfl.c | 4 ++-- drivers/fsi/fsi-core.c | 6 +++--- drivers/gpu/drm/display/drm_dp_aux_bus.c | 7 ++++++- drivers/gpu/drm/drm_mipi_dsi.c | 4 ++-- drivers/gpu/host1x/bus.c | 2 +- drivers/greybus/core.c | 14 +++++++------- drivers/hid/hid-core.c | 4 ++-- drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +- drivers/hsi/hsi_core.c | 2 +- drivers/hv/vmbus_drv.c | 4 ++-- drivers/hwtracing/intel_th/core.c | 6 +++--- drivers/hwtracing/intel_th/intel_th.h | 4 ++-- drivers/i2c/i2c-core-base.c | 4 ++-- drivers/i3c/device.c | 14 +------------- drivers/i3c/master.c | 4 ++-- drivers/input/input.c | 16 ++++++++-------- drivers/input/serio/serio.c | 4 ++-- drivers/ipack/ipack.c | 4 ++-- drivers/macintosh/macio_asic.c | 7 ++++++- drivers/mcb/mcb-core.c | 4 ++-- drivers/media/rc/rc-main.c | 2 +- drivers/memstick/core/memstick.c | 6 +++--- drivers/misc/mei/bus.c | 4 ++-- drivers/misc/tifm_core.c | 4 ++-- drivers/mmc/core/bus.c | 4 ++-- drivers/mmc/core/sdio_bus.c | 4 ++-- drivers/net/phy/mdio_bus.c | 2 +- drivers/net/xen-netback/xenbus.c | 2 +- drivers/nvdimm/bus.c | 4 ++-- drivers/nvdimm/dax_devs.c | 2 +- drivers/nvdimm/dimm_devs.c | 2 +- drivers/nvdimm/nd-core.h | 10 +++++----- drivers/nvdimm/nd.h | 4 ++-- drivers/nvdimm/region_devs.c | 4 ++-- drivers/of/device.c | 4 ++-- drivers/pci/pci-driver.c | 4 ++-- drivers/pcmcia/ds.c | 4 ++-- drivers/platform/surface/aggregator/bus.c | 4 ++-- drivers/platform/x86/wmi.c | 15 ++++----------- drivers/rapidio/rio-driver.c | 4 ++-- drivers/rpmsg/rpmsg_core.c | 4 ++-- drivers/s390/cio/css.c | 4 ++-- drivers/s390/cio/device.c | 8 ++++---- drivers/s390/cio/scm.c | 2 +- drivers/s390/crypto/ap_bus.c | 4 ++-- drivers/scsi/scsi_sysfs.c | 4 ++-- drivers/slimbus/core.c | 4 ++-- drivers/soc/qcom/apr.c | 4 ++-- drivers/soundwire/bus_type.c | 4 ++-- drivers/spi/spi.c | 2 +- drivers/spmi/spmi.c | 2 +- drivers/ssb/main.c | 4 ++-- drivers/staging/greybus/gbphy.c | 14 +++++++------- drivers/tee/tee_core.c | 2 +- drivers/thunderbolt/switch.c | 4 ++-- drivers/thunderbolt/tb.h | 2 +- drivers/thunderbolt/xdomain.c | 6 +++--- drivers/tty/serdev/core.c | 2 +- drivers/usb/common/ulpi.c | 4 ++-- drivers/usb/core/driver.c | 6 +++--- drivers/usb/core/message.c | 8 ++++---- drivers/usb/core/usb.c | 8 ++++---- drivers/usb/phy/phy.c | 6 +++--- drivers/usb/roles/class.c | 3 +-- drivers/usb/typec/bus.c | 4 ++-- drivers/usb/typec/class.c | 2 +- drivers/virtio/virtio.c | 4 ++-- drivers/w1/w1.c | 10 +++++----- drivers/xen/pvcalls-back.c | 2 +- drivers/xen/xenbus/xenbus_probe_backend.c | 8 ++++---- drivers/xen/xenbus/xenbus_probe_frontend.c | 4 ++-- drivers/zorro/zorro-driver.c | 4 ++-- fs/dlm/lockspace.c | 4 ++-- fs/gfs2/sys.c | 6 +++--- include/drm/drm_mipi_dsi.h | 5 +---- include/linux/acpi.h | 4 ++-- include/linux/device.h | 6 ++---- include/linux/device/bus.h | 2 +- include/linux/firewire.h | 15 +++------------ include/linux/hyperv.h | 5 +---- include/linux/i3c/device.h | 11 +++++++++-- include/linux/kobject.h | 2 +- include/linux/mcb.h | 5 +---- include/linux/of_device.h | 4 ++-- include/linux/soundwire/sdw_type.h | 2 +- include/linux/spi/spi.h | 2 +- include/linux/ssb/ssb.h | 2 +- include/linux/surface_aggregator/device.h | 5 +---- include/linux/virtio.h | 5 +---- include/sound/hdaudio.h | 2 +- include/xen/xenbus.h | 7 ++----- sound/aoa/soundbus/core.c | 6 +++--- sound/hda/hda_bus_type.c | 2 +- sound/hda/hdac_device.c | 2 +- 126 files changed, 283 insertions(+), 309 deletions(-)