Message ID | 20221121094649.1556002-5-gregkh@linuxfoundation.org |
---|---|
State | Not Applicable, archived |
Headers | show |
Series | None | expand |
Context | Check | Description |
---|---|---|
robh/checkpatch | success | |
robh/patch-applied | fail | build log |
On Mon, Nov 21, 2022 at 10:46:49AM +0100, Greg Kroah-Hartman wrote: > of_device_uevent() does not modify the struct device * passed into it, > so make it a const * to enforce this. Also the documentation for the > function was really wrong so fix that up at the same time. > > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Frank Rowand <frowand.list@gmail.com> > Cc: devicetree@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > --- > drivers/of/device.c | 6 +++--- > include/linux/of_device.h | 4 ++-- > 2 files changed, 5 insertions(+), 5 deletions(-) Looks like I can take this one? The same could be done for several other functions in of/device.c.
On Tue, Nov 22, 2022 at 03:22:09PM -0600, Rob Herring wrote: > On Mon, Nov 21, 2022 at 10:46:49AM +0100, Greg Kroah-Hartman wrote: > > of_device_uevent() does not modify the struct device * passed into it, > > so make it a const * to enforce this. Also the documentation for the > > function was really wrong so fix that up at the same time. > > > > Cc: Rob Herring <robh+dt@kernel.org> > > Cc: Frank Rowand <frowand.list@gmail.com> > > Cc: devicetree@vger.kernel.org > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > --- > > drivers/of/device.c | 6 +++--- > > include/linux/of_device.h | 4 ++-- > > 2 files changed, 5 insertions(+), 5 deletions(-) > > Looks like I can take this one? I need it for later patches I have coming that clean this up more. But you can take it in your tree as well if you want to build on top of it. > The same could be done for several other functions in of/device.c. That would be good! thanks, greg k-h
diff --git a/drivers/of/device.c b/drivers/of/device.c index 8cefe5a7d04e..c674a13c3055 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -332,10 +332,10 @@ EXPORT_SYMBOL_GPL(of_device_modalias); /** * of_device_uevent - Display OF related uevent information - * @dev: Device to apply DMA configuration - * @env: Kernel object's userspace event reference + * @dev: Device to display the uevent information for + * @env: Kernel object's userspace event reference to fill up */ -void of_device_uevent(struct device *dev, struct kobj_uevent_env *env) +void of_device_uevent(const struct device *dev, struct kobj_uevent_env *env) { const char *compat, *type; struct alias_prop *app; diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 1a803e4335d3..ab7d557d541d 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -35,7 +35,7 @@ extern const void *of_device_get_match_data(const struct device *dev); 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(struct device *dev, struct kobj_uevent_env *env); +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); static inline struct device_node *of_cpu_device_node_get(int cpu) @@ -64,7 +64,7 @@ static inline int of_driver_match_device(struct device *dev, return 0; } -static inline void of_device_uevent(struct device *dev, +static inline void of_device_uevent(const struct device *dev, struct kobj_uevent_env *env) { } static inline const void *of_device_get_match_data(const struct device *dev)
of_device_uevent() does not modify the struct device * passed into it, so make it a const * to enforce this. Also the documentation for the function was really wrong so fix that up at the same time. Cc: Rob Herring <robh+dt@kernel.org> Cc: Frank Rowand <frowand.list@gmail.com> Cc: devicetree@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/of/device.c | 6 +++--- include/linux/of_device.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)