Commit bf49ac84 authored by Patrick Mochel's avatar Patrick Mochel

[driver model] Change class functions to const arguments.

From Stephen Hemminger: 

Several of the class_device functions don't modify their arguments and can
take const pointers.
parent 24e56f5e
...@@ -59,7 +59,7 @@ static struct kobj_type ktype_class = { ...@@ -59,7 +59,7 @@ static struct kobj_type ktype_class = {
static decl_subsys(class,&ktype_class,NULL); static decl_subsys(class,&ktype_class,NULL);
int class_create_file(struct class * cls, struct class_attribute * attr) int class_create_file(struct class * cls, const struct class_attribute * attr)
{ {
int error; int error;
if (cls) { if (cls) {
...@@ -69,7 +69,7 @@ int class_create_file(struct class * cls, struct class_attribute * attr) ...@@ -69,7 +69,7 @@ int class_create_file(struct class * cls, struct class_attribute * attr)
return error; return error;
} }
void class_remove_file(struct class * cls, struct class_attribute * attr) void class_remove_file(struct class * cls, const struct class_attribute * attr)
{ {
if (cls) if (cls)
sysfs_remove_file(&cls->subsys.kset.kobj,&attr->attr); sysfs_remove_file(&cls->subsys.kset.kobj,&attr->attr);
...@@ -110,7 +110,7 @@ void class_unregister(struct class * cls) ...@@ -110,7 +110,7 @@ void class_unregister(struct class * cls)
/* Class Device Stuff */ /* Class Device Stuff */
int class_device_create_file(struct class_device * class_dev, int class_device_create_file(struct class_device * class_dev,
struct class_device_attribute * attr) const struct class_device_attribute * attr)
{ {
int error = -EINVAL; int error = -EINVAL;
if (class_dev) if (class_dev)
...@@ -119,7 +119,7 @@ int class_device_create_file(struct class_device * class_dev, ...@@ -119,7 +119,7 @@ int class_device_create_file(struct class_device * class_dev,
} }
void class_device_remove_file(struct class_device * class_dev, void class_device_remove_file(struct class_device * class_dev,
struct class_device_attribute * attr) const struct class_device_attribute * attr)
{ {
if (class_dev) if (class_dev)
sysfs_remove_file(&class_dev->kobj, &attr->attr); sysfs_remove_file(&class_dev->kobj, &attr->attr);
......
...@@ -182,8 +182,8 @@ struct class_attribute class_attr_##_name = { \ ...@@ -182,8 +182,8 @@ struct class_attribute class_attr_##_name = { \
.store = _store, \ .store = _store, \
}; };
extern int class_create_file(struct class *, struct class_attribute *); extern int class_create_file(struct class *, const struct class_attribute *);
extern void class_remove_file(struct class *, struct class_attribute *); extern void class_remove_file(struct class *, const struct class_attribute *);
struct class_device { struct class_device {
...@@ -234,8 +234,10 @@ struct class_device_attribute class_device_attr_##_name = { \ ...@@ -234,8 +234,10 @@ struct class_device_attribute class_device_attr_##_name = { \
.store = _store, \ .store = _store, \
}; };
extern int class_device_create_file(struct class_device *, struct class_device_attribute *); extern int class_device_create_file(struct class_device *,
extern void class_device_remove_file(struct class_device *, struct class_device_attribute *); const struct class_device_attribute *);
extern void class_device_remove_file(struct class_device *,
const struct class_device_attribute *);
struct class_interface { struct class_interface {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment