Skip to content

Commit ab7a880

Browse files
committed
driver core: make driver_[create|remove]_file take a const *
The functions driver_create_file() and driver_remove_file() do not modify the struct device_driver structure directly, so they are safe to be marked as a constant pointer type. Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/2024070844-volley-hatchling-c812@gregkh Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a23b018 commit ab7a880

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

drivers/base/driver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ EXPORT_SYMBOL_GPL(driver_find_device);
173173
* @drv: driver.
174174
* @attr: driver attribute descriptor.
175175
*/
176-
int driver_create_file(struct device_driver *drv,
176+
int driver_create_file(const struct device_driver *drv,
177177
const struct driver_attribute *attr)
178178
{
179179
int error;
@@ -191,7 +191,7 @@ EXPORT_SYMBOL_GPL(driver_create_file);
191191
* @drv: driver.
192192
* @attr: driver attribute descriptor.
193193
*/
194-
void driver_remove_file(struct device_driver *drv,
194+
void driver_remove_file(const struct device_driver *drv,
195195
const struct driver_attribute *attr)
196196
{
197197
if (drv)

include/linux/device/driver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ struct driver_attribute {
146146
#define DRIVER_ATTR_WO(_name) \
147147
struct driver_attribute driver_attr_##_name = __ATTR_WO(_name)
148148

149-
int __must_check driver_create_file(struct device_driver *driver,
149+
int __must_check driver_create_file(const struct device_driver *driver,
150150
const struct driver_attribute *attr);
151-
void driver_remove_file(struct device_driver *driver,
151+
void driver_remove_file(const struct device_driver *driver,
152152
const struct driver_attribute *attr);
153153

154154
int driver_set_override(struct device *dev, const char **override,

0 commit comments

Comments
 (0)