Skip to content

Commit

Permalink
drivers: make device_type const
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Hemminger authored and gregkh committed Apr 19, 2011
1 parent 695cca8 commit aed65af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ static void device_remove_groups(struct device *dev,
static int device_add_attrs(struct device *dev)
{
struct class *class = dev->class;
struct device_type *type = dev->type;
const struct device_type *type = dev->type;
int error;

if (class) {
Expand Down Expand Up @@ -440,7 +440,7 @@ static int device_add_attrs(struct device *dev)
static void device_remove_attrs(struct device *dev)
{
struct class *class = dev->class;
struct device_type *type = dev->type;
const struct device_type *type = dev->type;

device_remove_groups(dev, dev->groups);

Expand Down
2 changes: 1 addition & 1 deletion include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ struct device {

struct kobject kobj;
const char *init_name; /* initial name of the device */
struct device_type *type;
const struct device_type *type;

struct mutex mutex; /* mutex to synchronize calls to
* its driver.
Expand Down

0 comments on commit aed65af

Please sign in to comment.