aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-06-24 13:06:31 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-15 12:50:47 -0400
commita4dbd6740df0872cdf0a86841f75beec8381964d (patch)
tree1093687845d89f8397d61e7df1ad8546a5a25225 /drivers
parent5b2ea2f10dbb2fa91d8033993000f8664309395f (diff)
driver model: constify attribute groups
Let attribute group vectors be declared "const". We'd like to let most attribute metadata live in read-only sections... this is a start. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/core.c4
-rw-r--r--drivers/base/driver.c4
-rw-r--r--drivers/block/cciss.c2
-rw-r--r--drivers/firewire/core-device.c2
-rw-r--r--drivers/firmware/dmi-id.c2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_sysfs.c2
-rw-r--r--drivers/input/input.c2
-rw-r--r--drivers/misc/enclosure.c4
-rw-r--r--drivers/mmc/core/mmc.c2
-rw-r--r--drivers/mmc/core/sd.c2
-rw-r--r--drivers/mtd/mtdcore.c2
-rw-r--r--drivers/s390/cio/css.c2
-rw-r--r--drivers/s390/cio/device.c2
-rw-r--r--drivers/s390/net/netiucv.c2
-rw-r--r--drivers/scsi/scsi_priv.h2
-rw-r--r--drivers/scsi/scsi_sysfs.c4
-rw-r--r--drivers/usb/core/endpoint.c2
-rw-r--r--drivers/usb/core/sysfs.c4
-rw-r--r--drivers/usb/core/usb.h4
-rw-r--r--drivers/uwb/lc-dev.c2
22 files changed, 28 insertions, 28 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 99dfe96fffcb..a992985d1fab 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -341,7 +341,7 @@ static void device_remove_attributes(struct device *dev,
341} 341}
342 342
343static int device_add_groups(struct device *dev, 343static int device_add_groups(struct device *dev,
344 struct attribute_group **groups) 344 const struct attribute_group **groups)
345{ 345{
346 int error = 0; 346 int error = 0;
347 int i; 347 int i;
@@ -361,7 +361,7 @@ static int device_add_groups(struct device *dev,
361} 361}
362 362
363static void device_remove_groups(struct device *dev, 363static void device_remove_groups(struct device *dev,
364 struct attribute_group **groups) 364 const struct attribute_group **groups)
365{ 365{
366 int i; 366 int i;
367 367
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 8ae0f63602e0..ed2ebd3c287d 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -181,7 +181,7 @@ void put_driver(struct device_driver *drv)
181EXPORT_SYMBOL_GPL(put_driver); 181EXPORT_SYMBOL_GPL(put_driver);
182 182
183static int driver_add_groups(struct device_driver *drv, 183static int driver_add_groups(struct device_driver *drv,
184 struct attribute_group **groups) 184 const struct attribute_group **groups)
185{ 185{
186 int error = 0; 186 int error = 0;
187 int i; 187 int i;
@@ -201,7 +201,7 @@ static int driver_add_groups(struct device_driver *drv,
201} 201}
202 202
203static void driver_remove_groups(struct device_driver *drv, 203static void driver_remove_groups(struct device_driver *drv,
204 struct attribute_group **groups) 204 const struct attribute_group **groups)
205{ 205{
206 int i; 206 int i;
207 207
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 0589dfbbd7db..d8372b432826 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -572,7 +572,7 @@ static struct attribute_group cciss_dev_attr_group = {
572 .attrs = cciss_dev_attrs, 572 .attrs = cciss_dev_attrs,
573}; 573};
574 574
575static struct attribute_group *cciss_dev_attr_groups[] = { 575static const struct attribute_group *cciss_dev_attr_groups[] = {
576 &cciss_dev_attr_group, 576 &cciss_dev_attr_group,
577 NULL 577 NULL
578}; 578};
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index 97e656af2d22..9d0dfcbe2c1c 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -312,7 +312,7 @@ static void init_fw_attribute_group(struct device *dev,
312 group->groups[0] = &group->group; 312 group->groups[0] = &group->group;
313 group->groups[1] = NULL; 313 group->groups[1] = NULL;
314 group->group.attrs = group->attrs; 314 group->group.attrs = group->attrs;
315 dev->groups = group->groups; 315 dev->groups = (const struct attribute_group **) group->groups;
316} 316}
317 317
318static ssize_t modalias_show(struct device *dev, 318static ssize_t modalias_show(struct device *dev,
diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
index 5a76d056b9d0..dbdf6fadfc79 100644
--- a/drivers/firmware/dmi-id.c
+++ b/drivers/firmware/dmi-id.c
@@ -139,7 +139,7 @@ static struct attribute_group sys_dmi_attribute_group = {
139 .attrs = sys_dmi_attributes, 139 .attrs = sys_dmi_attributes,
140}; 140};
141 141
142static struct attribute_group* sys_dmi_attribute_groups[] = { 142static const struct attribute_group* sys_dmi_attribute_groups[] = {
143 &sys_dmi_attribute_group, 143 &sys_dmi_attribute_group,
144 NULL 144 NULL
145}; 145};
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index 5b635aa5947e..fb2d83c5bf01 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -623,7 +623,7 @@ static struct attribute_group ehca_drv_attr_grp = {
623 .attrs = ehca_drv_attrs 623 .attrs = ehca_drv_attrs
624}; 624};
625 625
626static struct attribute_group *ehca_drv_attr_groups[] = { 626static const struct attribute_group *ehca_drv_attr_groups[] = {
627 &ehca_drv_attr_grp, 627 &ehca_drv_attr_grp,
628 NULL, 628 NULL,
629}; 629};
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 6ba4861dd6ac..b3d7efcdf021 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -1286,7 +1286,7 @@ struct device_driver;
1286 1286
1287extern const char ib_ipath_version[]; 1287extern const char ib_ipath_version[];
1288 1288
1289extern struct attribute_group *ipath_driver_attr_groups[]; 1289extern const struct attribute_group *ipath_driver_attr_groups[];
1290 1290
1291int ipath_device_create_group(struct device *, struct ipath_devdata *); 1291int ipath_device_create_group(struct device *, struct ipath_devdata *);
1292void ipath_device_remove_group(struct device *, struct ipath_devdata *); 1292void ipath_device_remove_group(struct device *, struct ipath_devdata *);
diff --git a/drivers/infiniband/hw/ipath/ipath_sysfs.c b/drivers/infiniband/hw/ipath/ipath_sysfs.c
index a6c8efbdc0c9..b8cb2f145ae4 100644
--- a/drivers/infiniband/hw/ipath/ipath_sysfs.c
+++ b/drivers/infiniband/hw/ipath/ipath_sysfs.c
@@ -1069,7 +1069,7 @@ static ssize_t show_tempsense(struct device *dev,
1069 return ret; 1069 return ret;
1070} 1070}
1071 1071
1072struct attribute_group *ipath_driver_attr_groups[] = { 1072const struct attribute_group *ipath_driver_attr_groups[] = {
1073 &driver_attr_group, 1073 &driver_attr_group,
1074 NULL, 1074 NULL,
1075}; 1075};
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 7c237e6ac711..851791d955f3 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1144,7 +1144,7 @@ static struct attribute_group input_dev_caps_attr_group = {
1144 .attrs = input_dev_caps_attrs, 1144 .attrs = input_dev_caps_attrs,
1145}; 1145};
1146 1146
1147static struct attribute_group *input_dev_attr_groups[] = { 1147static const struct attribute_group *input_dev_attr_groups[] = {
1148 &input_dev_attr_group, 1148 &input_dev_attr_group,
1149 &input_dev_id_attr_group, 1149 &input_dev_id_attr_group,
1150 &input_dev_caps_attr_group, 1150 &input_dev_caps_attr_group,
diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
index 7b039306037f..e9eae4a78402 100644
--- a/drivers/misc/enclosure.c
+++ b/drivers/misc/enclosure.c
@@ -238,7 +238,7 @@ static void enclosure_component_release(struct device *dev)
238 put_device(dev->parent); 238 put_device(dev->parent);
239} 239}
240 240
241static struct attribute_group *enclosure_groups[]; 241static const struct attribute_group *enclosure_groups[];
242 242
243/** 243/**
244 * enclosure_component_register - add a particular component to an enclosure 244 * enclosure_component_register - add a particular component to an enclosure
@@ -536,7 +536,7 @@ static struct attribute_group enclosure_group = {
536 .attrs = enclosure_component_attrs, 536 .attrs = enclosure_component_attrs,
537}; 537};
538 538
539static struct attribute_group *enclosure_groups[] = { 539static const struct attribute_group *enclosure_groups[] = {
540 &enclosure_group, 540 &enclosure_group,
541 NULL 541 NULL
542}; 542};
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 06084dbf1277..2fb9d5f271ea 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -276,7 +276,7 @@ static struct attribute_group mmc_std_attr_group = {
276 .attrs = mmc_std_attrs, 276 .attrs = mmc_std_attrs,
277}; 277};
278 278
279static struct attribute_group *mmc_attr_groups[] = { 279static const struct attribute_group *mmc_attr_groups[] = {
280 &mmc_std_attr_group, 280 &mmc_std_attr_group,
281 NULL, 281 NULL,
282}; 282};
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index cd81c395e164..7ad646fe077e 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -314,7 +314,7 @@ static struct attribute_group sd_std_attr_group = {
314 .attrs = sd_std_attrs, 314 .attrs = sd_std_attrs,
315}; 315};
316 316
317static struct attribute_group *sd_attr_groups[] = { 317static const struct attribute_group *sd_attr_groups[] = {
318 &sd_std_attr_group, 318 &sd_std_attr_group,
319 NULL, 319 NULL,
320}; 320};
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 00ebf7af7467..69007a6eff50 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -217,7 +217,7 @@ struct attribute_group mtd_group = {
217 .attrs = mtd_attrs, 217 .attrs = mtd_attrs,
218}; 218};
219 219
220struct attribute_group *mtd_groups[] = { 220const struct attribute_group *mtd_groups[] = {
221 &mtd_group, 221 &mtd_group,
222 NULL, 222 NULL,
223}; 223};
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index e995123fd805..393c73c47f87 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -266,7 +266,7 @@ static struct attribute_group subch_attr_group = {
266 .attrs = subch_attrs, 266 .attrs = subch_attrs,
267}; 267};
268 268
269static struct attribute_group *default_subch_attr_groups[] = { 269static const struct attribute_group *default_subch_attr_groups[] = {
270 &subch_attr_group, 270 &subch_attr_group,
271 NULL, 271 NULL,
272}; 272};
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 0f95405c2c5e..6527f3f34493 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -656,7 +656,7 @@ static struct attribute_group ccwdev_attr_group = {
656 .attrs = ccwdev_attrs, 656 .attrs = ccwdev_attrs,
657}; 657};
658 658
659static struct attribute_group *ccwdev_attr_groups[] = { 659static const struct attribute_group *ccwdev_attr_groups[] = {
660 &ccwdev_attr_group, 660 &ccwdev_attr_group,
661 NULL, 661 NULL,
662}; 662};
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index 9215fbbccc08..a4b2c576144b 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -2159,7 +2159,7 @@ static struct attribute_group netiucv_drv_attr_group = {
2159 .attrs = netiucv_drv_attrs, 2159 .attrs = netiucv_drv_attrs,
2160}; 2160};
2161 2161
2162static struct attribute_group *netiucv_drv_attr_groups[] = { 2162static const struct attribute_group *netiucv_drv_attr_groups[] = {
2163 &netiucv_drv_attr_group, 2163 &netiucv_drv_attr_group,
2164 NULL, 2164 NULL,
2165}; 2165};
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index 021e503c8c44..1fbf7c78bba0 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -132,7 +132,7 @@ extern struct scsi_transport_template blank_transport_template;
132extern void __scsi_remove_device(struct scsi_device *); 132extern void __scsi_remove_device(struct scsi_device *);
133 133
134extern struct bus_type scsi_bus_type; 134extern struct bus_type scsi_bus_type;
135extern struct attribute_group *scsi_sysfs_shost_attr_groups[]; 135extern const struct attribute_group *scsi_sysfs_shost_attr_groups[];
136 136
137/* scsi_netlink.c */ 137/* scsi_netlink.c */
138#ifdef CONFIG_SCSI_NETLINK 138#ifdef CONFIG_SCSI_NETLINK
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 91482f2dcc50..fde54537d715 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -275,7 +275,7 @@ struct attribute_group scsi_shost_attr_group = {
275 .attrs = scsi_sysfs_shost_attrs, 275 .attrs = scsi_sysfs_shost_attrs,
276}; 276};
277 277
278struct attribute_group *scsi_sysfs_shost_attr_groups[] = { 278const struct attribute_group *scsi_sysfs_shost_attr_groups[] = {
279 &scsi_shost_attr_group, 279 &scsi_shost_attr_group,
280 NULL 280 NULL
281}; 281};
@@ -745,7 +745,7 @@ static struct attribute_group scsi_sdev_attr_group = {
745 .attrs = scsi_sdev_attrs, 745 .attrs = scsi_sdev_attrs,
746}; 746};
747 747
748static struct attribute_group *scsi_sdev_attr_groups[] = { 748static const struct attribute_group *scsi_sdev_attr_groups[] = {
749 &scsi_sdev_attr_group, 749 &scsi_sdev_attr_group,
750 NULL 750 NULL
751}; 751};
diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
index bc39fc40bbde..fdfaa7885515 100644
--- a/drivers/usb/core/endpoint.c
+++ b/drivers/usb/core/endpoint.c
@@ -154,7 +154,7 @@ static struct attribute *ep_dev_attrs[] = {
154static struct attribute_group ep_dev_attr_grp = { 154static struct attribute_group ep_dev_attr_grp = {
155 .attrs = ep_dev_attrs, 155 .attrs = ep_dev_attrs,
156}; 156};
157static struct attribute_group *ep_dev_groups[] = { 157static const struct attribute_group *ep_dev_groups[] = {
158 &ep_dev_attr_grp, 158 &ep_dev_attr_grp,
159 NULL 159 NULL
160}; 160};
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index b5c72e458943..7ec3041ae79e 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -573,7 +573,7 @@ static struct attribute_group dev_string_attr_grp = {
573 .is_visible = dev_string_attrs_are_visible, 573 .is_visible = dev_string_attrs_are_visible,
574}; 574};
575 575
576struct attribute_group *usb_device_groups[] = { 576const struct attribute_group *usb_device_groups[] = {
577 &dev_attr_grp, 577 &dev_attr_grp,
578 &dev_string_attr_grp, 578 &dev_string_attr_grp,
579 NULL 579 NULL
@@ -799,7 +799,7 @@ static struct attribute_group intf_assoc_attr_grp = {
799 .is_visible = intf_assoc_attrs_are_visible, 799 .is_visible = intf_assoc_attrs_are_visible,
800}; 800};
801 801
802struct attribute_group *usb_interface_groups[] = { 802const struct attribute_group *usb_interface_groups[] = {
803 &intf_attr_grp, 803 &intf_attr_grp,
804 &intf_assoc_attr_grp, 804 &intf_assoc_attr_grp,
805 NULL 805 NULL
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index e2a8cfaade1d..c0e0ae2bb8e7 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -152,8 +152,8 @@ static inline int is_active(const struct usb_interface *f)
152extern const char *usbcore_name; 152extern const char *usbcore_name;
153 153
154/* sysfs stuff */ 154/* sysfs stuff */
155extern struct attribute_group *usb_device_groups[]; 155extern const struct attribute_group *usb_device_groups[];
156extern struct attribute_group *usb_interface_groups[]; 156extern const struct attribute_group *usb_interface_groups[];
157 157
158/* usbfs stuff */ 158/* usbfs stuff */
159extern struct mutex usbfs_mutex; 159extern struct mutex usbfs_mutex;
diff --git a/drivers/uwb/lc-dev.c b/drivers/uwb/lc-dev.c
index e9fe1bb7eb23..1097e81b56d0 100644
--- a/drivers/uwb/lc-dev.c
+++ b/drivers/uwb/lc-dev.c
@@ -255,7 +255,7 @@ static struct attribute_group dev_attr_group = {
255 .attrs = dev_attrs, 255 .attrs = dev_attrs,
256}; 256};
257 257
258static struct attribute_group *groups[] = { 258static const struct attribute_group *groups[] = {
259 &dev_attr_group, 259 &dev_attr_group,
260 NULL, 260 NULL,
261}; 261};