]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
driver model: constify attribute groups
authorDavid Brownell <dbrownell@users.sourceforge.net>
Wed, 24 Jun 2009 17:06:31 +0000 (10:06 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 15 Sep 2009 16:50:47 +0000 (09:50 -0700)
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>
30 files changed:
block/genhd.c
drivers/base/core.c
drivers/base/driver.c
drivers/block/cciss.c
drivers/firewire/core-device.c
drivers/firmware/dmi-id.c
drivers/infiniband/hw/ehca/ehca_main.c
drivers/infiniband/hw/ipath/ipath_kernel.h
drivers/infiniband/hw/ipath/ipath_sysfs.c
drivers/input/input.c
drivers/misc/enclosure.c
drivers/mmc/core/mmc.c
drivers/mmc/core/sd.c
drivers/mtd/mtdcore.c
drivers/s390/cio/css.c
drivers/s390/cio/device.c
drivers/s390/net/netiucv.c
drivers/scsi/scsi_priv.h
drivers/scsi/scsi_sysfs.c
drivers/usb/core/endpoint.c
drivers/usb/core/sysfs.c
drivers/usb/core/usb.h
drivers/uwb/lc-dev.c
fs/partitions/check.c
include/linux/attribute_container.h
include/linux/device.h
include/linux/netdevice.h
include/linux/transport_class.h
net/bluetooth/hci_sysfs.c
net/core/net-sysfs.c

index 5b76bf55d05c7b5b9bb9f0b269572d6b2eb5bc4b..2ad91ddad8e207631c1acf2153a1ded3d4766731 100644 (file)
@@ -903,7 +903,7 @@ static struct attribute_group disk_attr_group = {
        .attrs = disk_attrs,
 };
 
-static struct attribute_group *disk_attr_groups[] = {
+static const struct attribute_group *disk_attr_groups[] = {
        &disk_attr_group,
        NULL
 };
index 99dfe96fffcb9c1bcc38b89a2f7a8e0e96b3fc9f..a992985d1fabe0da754848e88817ff6f8726411e 100644 (file)
@@ -341,7 +341,7 @@ static void device_remove_attributes(struct device *dev,
 }
 
 static int device_add_groups(struct device *dev,
-                            struct attribute_group **groups)
+                            const struct attribute_group **groups)
 {
        int error = 0;
        int i;
@@ -361,7 +361,7 @@ static int device_add_groups(struct device *dev,
 }
 
 static void device_remove_groups(struct device *dev,
-                                struct attribute_group **groups)
+                                const struct attribute_group **groups)
 {
        int i;
 
index 8ae0f63602e0730a71647cb571cbf933d76ceec8..ed2ebd3c287d24917f6d48dd963a3b27d0a19305 100644 (file)
@@ -181,7 +181,7 @@ void put_driver(struct device_driver *drv)
 EXPORT_SYMBOL_GPL(put_driver);
 
 static int driver_add_groups(struct device_driver *drv,
-                            struct attribute_group **groups)
+                            const struct attribute_group **groups)
 {
        int error = 0;
        int i;
@@ -201,7 +201,7 @@ static int driver_add_groups(struct device_driver *drv,
 }
 
 static void driver_remove_groups(struct device_driver *drv,
-                                struct attribute_group **groups)
+                                const struct attribute_group **groups)
 {
        int i;
 
index 0589dfbbd7dbeb88806dbda2c1ebe6066ac9076e..d8372b432826dd49457c1df19691bc06dea7eb3c 100644 (file)
@@ -572,7 +572,7 @@ static struct attribute_group cciss_dev_attr_group = {
        .attrs = cciss_dev_attrs,
 };
 
-static struct attribute_group *cciss_dev_attr_groups[] = {
+static const struct attribute_group *cciss_dev_attr_groups[] = {
        &cciss_dev_attr_group,
        NULL
 };
index 97e656af2d22800e03d7c2302747ed7573ff71a7..9d0dfcbe2c1c82561bf1f026bac88f08324b3037 100644 (file)
@@ -312,7 +312,7 @@ static void init_fw_attribute_group(struct device *dev,
        group->groups[0] = &group->group;
        group->groups[1] = NULL;
        group->group.attrs = group->attrs;
-       dev->groups = group->groups;
+       dev->groups = (const struct attribute_group **) group->groups;
 }
 
 static ssize_t modalias_show(struct device *dev,
index 5a76d056b9d0d0b1fe9770d9d272413d054afb8b..dbdf6fadfc795f5378b71fa2dec7fa09521971fe 100644 (file)
@@ -139,7 +139,7 @@ static struct attribute_group sys_dmi_attribute_group = {
        .attrs = sys_dmi_attributes,
 };
 
-static struct attribute_group* sys_dmi_attribute_groups[] = {
+static const struct attribute_group* sys_dmi_attribute_groups[] = {
        &sys_dmi_attribute_group,
        NULL
 };
index 5b635aa5947e27822a5386cdc447f8b4a2693db3..fb2d83c5bf010f955fd0ee7cb440724a5a5336bd 100644 (file)
@@ -623,7 +623,7 @@ static struct attribute_group ehca_drv_attr_grp = {
        .attrs = ehca_drv_attrs
 };
 
-static struct attribute_group *ehca_drv_attr_groups[] = {
+static const struct attribute_group *ehca_drv_attr_groups[] = {
        &ehca_drv_attr_grp,
        NULL,
 };
index 6ba4861dd6ac683e4637ea86a14bac9101af7164..b3d7efcdf0214fca1d9ce5c95fa481b946d4407c 100644 (file)
@@ -1286,7 +1286,7 @@ struct device_driver;
 
 extern const char ib_ipath_version[];
 
-extern struct attribute_group *ipath_driver_attr_groups[];
+extern const struct attribute_group *ipath_driver_attr_groups[];
 
 int ipath_device_create_group(struct device *, struct ipath_devdata *);
 void ipath_device_remove_group(struct device *, struct ipath_devdata *);
index a6c8efbdc0c9b0e5a647c70875dd7f2d9edf8d71..b8cb2f145ae43fc90f9787368b57c9d3eb840c23 100644 (file)
@@ -1069,7 +1069,7 @@ static ssize_t show_tempsense(struct device *dev,
        return ret;
 }
 
-struct attribute_group *ipath_driver_attr_groups[] = {
+const struct attribute_group *ipath_driver_attr_groups[] = {
        &driver_attr_group,
        NULL,
 };
index 7c237e6ac7112f318c4a9fe941704948d612970e..851791d955f345e025b00f4504563233b0db1af6 100644 (file)
@@ -1144,7 +1144,7 @@ static struct attribute_group input_dev_caps_attr_group = {
        .attrs  = input_dev_caps_attrs,
 };
 
-static struct attribute_group *input_dev_attr_groups[] = {
+static const struct attribute_group *input_dev_attr_groups[] = {
        &input_dev_attr_group,
        &input_dev_id_attr_group,
        &input_dev_caps_attr_group,
index 7b039306037f6da26f72832d76bff7848f2e8d8f..e9eae4a784026303935d5f475e0ce938832d220d 100644 (file)
@@ -238,7 +238,7 @@ static void enclosure_component_release(struct device *dev)
        put_device(dev->parent);
 }
 
-static struct attribute_group *enclosure_groups[];
+static const struct attribute_group *enclosure_groups[];
 
 /**
  * enclosure_component_register - add a particular component to an enclosure
@@ -536,7 +536,7 @@ static struct attribute_group enclosure_group = {
        .attrs = enclosure_component_attrs,
 };
 
-static struct attribute_group *enclosure_groups[] = {
+static const struct attribute_group *enclosure_groups[] = {
        &enclosure_group,
        NULL
 };
index 06084dbf12772fcf1c1dcf98fd220d9dd41f7f54..2fb9d5f271ea4e2a3eabf4ebdd8dd65021a5025b 100644 (file)
@@ -276,7 +276,7 @@ static struct attribute_group mmc_std_attr_group = {
        .attrs = mmc_std_attrs,
 };
 
-static struct attribute_group *mmc_attr_groups[] = {
+static const struct attribute_group *mmc_attr_groups[] = {
        &mmc_std_attr_group,
        NULL,
 };
index cd81c395e1646056cd90a82200d09bff9e09a03f..7ad646fe077ec796da7a390c8a2a0dfe624f39b1 100644 (file)
@@ -314,7 +314,7 @@ static struct attribute_group sd_std_attr_group = {
        .attrs = sd_std_attrs,
 };
 
-static struct attribute_group *sd_attr_groups[] = {
+static const struct attribute_group *sd_attr_groups[] = {
        &sd_std_attr_group,
        NULL,
 };
index 00ebf7af7467b6b35dac1a2e2c32c432b11528ad..69007a6eff50c3014c10677af1aea8f84a9fde81 100644 (file)
@@ -217,7 +217,7 @@ struct attribute_group mtd_group = {
        .attrs          = mtd_attrs,
 };
 
-struct attribute_group *mtd_groups[] = {
+const struct attribute_group *mtd_groups[] = {
        &mtd_group,
        NULL,
 };
index e995123fd80585cbf4d07fe83ceadc5a5e48a3d3..393c73c47f87280678f4db2263c44b7f1fca2a66 100644 (file)
@@ -266,7 +266,7 @@ static struct attribute_group subch_attr_group = {
        .attrs = subch_attrs,
 };
 
-static struct attribute_group *default_subch_attr_groups[] = {
+static const struct attribute_group *default_subch_attr_groups[] = {
        &subch_attr_group,
        NULL,
 };
index 0f95405c2c5e0b05dec472dbae6c29aba6571d5f..6527f3f34493cfb74b4a3e58cdd529610e1ad01c 100644 (file)
@@ -656,7 +656,7 @@ static struct attribute_group ccwdev_attr_group = {
        .attrs = ccwdev_attrs,
 };
 
-static struct attribute_group *ccwdev_attr_groups[] = {
+static const struct attribute_group *ccwdev_attr_groups[] = {
        &ccwdev_attr_group,
        NULL,
 };
index 9215fbbccc0816ca83ab5901c95247c48bd93909..a4b2c576144bee8000be14bf42781b1d7bc0e512 100644 (file)
@@ -2159,7 +2159,7 @@ static struct attribute_group netiucv_drv_attr_group = {
        .attrs = netiucv_drv_attrs,
 };
 
-static struct attribute_group *netiucv_drv_attr_groups[] = {
+static const struct attribute_group *netiucv_drv_attr_groups[] = {
        &netiucv_drv_attr_group,
        NULL,
 };
index 021e503c8c447615e651d2635f0981752b4d5860..1fbf7c78bba0ab80947e9c46207b70bf2f04c75f 100644 (file)
@@ -132,7 +132,7 @@ extern struct scsi_transport_template blank_transport_template;
 extern void __scsi_remove_device(struct scsi_device *);
 
 extern struct bus_type scsi_bus_type;
-extern struct attribute_group *scsi_sysfs_shost_attr_groups[];
+extern const struct attribute_group *scsi_sysfs_shost_attr_groups[];
 
 /* scsi_netlink.c */
 #ifdef CONFIG_SCSI_NETLINK
index 91482f2dcc505ce61ff0b893448e5e717ecdd0c8..fde54537d715cf185f1d6edef655cee1136c2beb 100644 (file)
@@ -275,7 +275,7 @@ struct attribute_group scsi_shost_attr_group = {
        .attrs =        scsi_sysfs_shost_attrs,
 };
 
-struct attribute_group *scsi_sysfs_shost_attr_groups[] = {
+const struct attribute_group *scsi_sysfs_shost_attr_groups[] = {
        &scsi_shost_attr_group,
        NULL
 };
@@ -745,7 +745,7 @@ static struct attribute_group scsi_sdev_attr_group = {
        .attrs =        scsi_sdev_attrs,
 };
 
-static struct attribute_group *scsi_sdev_attr_groups[] = {
+static const struct attribute_group *scsi_sdev_attr_groups[] = {
        &scsi_sdev_attr_group,
        NULL
 };
index bc39fc40bbde20781d2467ec227ae48a9bdf46f0..fdfaa7885515d075330921d17442bbc80f1dcf06 100644 (file)
@@ -154,7 +154,7 @@ static struct attribute *ep_dev_attrs[] = {
 static struct attribute_group ep_dev_attr_grp = {
        .attrs = ep_dev_attrs,
 };
-static struct attribute_group *ep_dev_groups[] = {
+static const struct attribute_group *ep_dev_groups[] = {
        &ep_dev_attr_grp,
        NULL
 };
index b5c72e458943f753d5981c20596de1ffe376fb4a..7ec3041ae79ec7c2789193d44cdab5c83e904b0f 100644 (file)
@@ -573,7 +573,7 @@ static struct attribute_group dev_string_attr_grp = {
        .is_visible =   dev_string_attrs_are_visible,
 };
 
-struct attribute_group *usb_device_groups[] = {
+const struct attribute_group *usb_device_groups[] = {
        &dev_attr_grp,
        &dev_string_attr_grp,
        NULL
@@ -799,7 +799,7 @@ static struct attribute_group intf_assoc_attr_grp = {
        .is_visible =   intf_assoc_attrs_are_visible,
 };
 
-struct attribute_group *usb_interface_groups[] = {
+const struct attribute_group *usb_interface_groups[] = {
        &intf_attr_grp,
        &intf_assoc_attr_grp,
        NULL
index e2a8cfaade1ddbc7c5bb4c43c7d1f91f580c6230..c0e0ae2bb8e72e50e40fe62492cd37d4559ce4fb 100644 (file)
@@ -152,8 +152,8 @@ static inline int is_active(const struct usb_interface *f)
 extern const char *usbcore_name;
 
 /* sysfs stuff */
-extern struct attribute_group *usb_device_groups[];
-extern struct attribute_group *usb_interface_groups[];
+extern const struct attribute_group *usb_device_groups[];
+extern const struct attribute_group *usb_interface_groups[];
 
 /* usbfs stuff */
 extern struct mutex usbfs_mutex;
index e9fe1bb7eb232ccda5f3a4a48581bc3a8b6ef752..1097e81b56d01029f9ec8aac68fdb262c9874ed9 100644 (file)
@@ -255,7 +255,7 @@ static struct attribute_group dev_attr_group = {
        .attrs = dev_attrs,
 };
 
-static struct attribute_group *groups[] = {
+static const struct attribute_group *groups[] = {
        &dev_attr_group,
        NULL,
 };
index 619ba99dfe39dd05b0784231a12bd35038d5c61f..fbeaddf595d3ce8c456c4a58a9b31698f51b6506 100644 (file)
@@ -312,7 +312,7 @@ static struct attribute_group part_attr_group = {
        .attrs = part_attrs,
 };
 
-static struct attribute_group *part_attr_groups[] = {
+static const struct attribute_group *part_attr_groups[] = {
        &part_attr_group,
 #ifdef CONFIG_BLK_DEV_IO_TRACE
        &blk_trace_attr_group,
index 794ad74b1d61ec51e079e2864217a0dee07c7149..c3ab81428c6624ffaf7e93612f42654e7c570176 100644 (file)
@@ -17,7 +17,7 @@ struct attribute_container {
        struct list_head        node;
        struct klist            containers;
        struct class            *class;
-       struct attribute_group  *grp;
+       const struct attribute_group *grp;
        struct device_attribute **attrs;
        int (*match)(struct attribute_container *, struct device *);
 #define        ATTRIBUTE_CONTAINER_NO_CLASSDEVS        0x01
index 3f33f17f556c647743d436123ad863730185e011..e19e40a3dcbea05e0a33f3401f2ed608da61541f 100644 (file)
@@ -131,7 +131,7 @@ struct device_driver {
        void (*shutdown) (struct device *dev);
        int (*suspend) (struct device *dev, pm_message_t state);
        int (*resume) (struct device *dev);
-       struct attribute_group **groups;
+       const struct attribute_group **groups;
 
        const struct dev_pm_ops *pm;
 
@@ -288,7 +288,7 @@ extern void class_destroy(struct class *cls);
  */
 struct device_type {
        const char *name;
-       struct attribute_group **groups;
+       const struct attribute_group **groups;
        int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
        char *(*nodename)(struct device *dev);
        void (*release)(struct device *dev);
@@ -412,7 +412,7 @@ struct device {
 
        struct klist_node       knode_class;
        struct class            *class;
-       struct attribute_group  **groups;       /* optional groups */
+       const struct attribute_group **groups;  /* optional groups */
 
        void    (*release)(struct device *dev);
 };
index 65ee1929b2b1672a7cef0ca6b81af3ecca89a8bb..a9aa4b5917d792bc3d5e0a8d5e1cb9433ee19624 100644 (file)
@@ -895,7 +895,7 @@ struct net_device
        /* class/net/name entry */
        struct device           dev;
        /* space for optional statistics and wireless sysfs groups */
-       struct attribute_group  *sysfs_groups[3];
+       const struct attribute_group *sysfs_groups[3];
 
        /* rtnetlink link ops */
        const struct rtnl_link_ops *rtnl_link_ops;
index eaec1ea9558ee6aa8267050a212267f3394dcc4a..9ae8da3e6407bf5c71bff5c26a337d2e59411e30 100644 (file)
@@ -55,7 +55,7 @@ struct anon_transport_class cls = {                           \
 
 struct transport_container {
        struct attribute_container ac;
-       struct attribute_group *statistics;
+       const struct attribute_group *statistics;
 };
 
 #define attribute_container_to_transport_container(x) \
index 95f7a7a544b454db0dbb143227721d0a5f5e2349..7f939ce2980195f2aa219429014235c8fe8bcf78 100644 (file)
@@ -68,7 +68,7 @@ static struct attribute_group bt_link_group = {
        .attrs = bt_link_attrs,
 };
 
-static struct attribute_group *bt_link_groups[] = {
+static const struct attribute_group *bt_link_groups[] = {
        &bt_link_group,
        NULL
 };
@@ -392,7 +392,7 @@ static struct attribute_group bt_host_group = {
        .attrs = bt_host_attrs,
 };
 
-static struct attribute_group *bt_host_groups[] = {
+static const struct attribute_group *bt_host_groups[] = {
        &bt_host_group,
        NULL
 };
index ad91e9e5f475c10b592912678e9ef22d2591a6ca..7d4c57523b09b69e63abfb7583446ddeea057a80 100644 (file)
@@ -493,7 +493,7 @@ void netdev_unregister_kobject(struct net_device * net)
 int netdev_register_kobject(struct net_device *net)
 {
        struct device *dev = &(net->dev);
-       struct attribute_group **groups = net->sysfs_groups;
+       const struct attribute_group **groups = net->sysfs_groups;
 
        dev->class = &net_class;
        dev->platform_data = net;