Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers: make device_type const

The device_type structure does not contain data that changes
during usage and should be const. This allows devices to declare
the struct const.

I have patches to change all the subsystems, but need the infra
structure change first.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Stephen Hemminger and committed by
Greg Kroah-Hartman
aed65af1 695cca87

+3 -3
+2 -2
drivers/base/core.c
··· 400 400 static int device_add_attrs(struct device *dev) 401 401 { 402 402 struct class *class = dev->class; 403 - struct device_type *type = dev->type; 403 + const struct device_type *type = dev->type; 404 404 int error; 405 405 406 406 if (class) { ··· 440 440 static void device_remove_attrs(struct device *dev) 441 441 { 442 442 struct class *class = dev->class; 443 - struct device_type *type = dev->type; 443 + const struct device_type *type = dev->type; 444 444 445 445 device_remove_groups(dev, dev->groups); 446 446
+1 -1
include/linux/device.h
··· 408 408 409 409 struct kobject kobj; 410 410 const char *init_name; /* initial name of the device */ 411 - struct device_type *type; 411 + const struct device_type *type; 412 412 413 413 struct mutex mutex; /* mutex to synchronize calls to 414 414 * its driver.