driver core: make kobj_to_dev() take a const pointer
Greg Kroah-Hartman
maintainerPATCH 1/1 driver core: make kobj_to_dev() take a const pointer
Doing pointer math does not modify the pointer itself, so it is safe to say that the kobject passed into kobj_to_dev() is const. Now the pointer passed out of it does loose the const capability, but for now that's ok, we are allowing this so that const kobjects can call this function successfully.
Signed-off-by Greg Kroah-Hartman <[email protected]>
--- include/linux/device.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/device.h +1 -1
@@ -680,7 +680,7 @@ struct device_link {bool supplier_preactivated;/* Owned by consumer probe. */ }; -static inline struct device *kobj_to_dev (struct kobject *kobj) +static inline struct device *kobj_to_dev (const struct kobject *kobj) { return container_of(kobj, struct device, kobj); }
Signature · 1 line
2.37.3