Skip to content

Commit a4dbd67

Browse files
David Brownellgregkh
authored andcommitted
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>
1 parent 5b2ea2f commit a4dbd67

30 files changed

Lines changed: 39 additions & 39 deletions

File tree

‎block/genhd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ static struct attribute_group disk_attr_group = {
903903
.attrs = disk_attrs,
904904
};
905905

906-
static struct attribute_group *disk_attr_groups[] = {
906+
static const struct attribute_group *disk_attr_groups[] = {
907907
&disk_attr_group,
908908
NULL
909909
};

‎drivers/base/core.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ static void device_remove_attributes(struct device *dev,
341341
}
342342

343343
static int device_add_groups(struct device *dev,
344-
struct attribute_group **groups)
344+
const struct attribute_group **groups)
345345
{
346346
int error = 0;
347347
int i;
@@ -361,7 +361,7 @@ static int device_add_groups(struct device *dev,
361361
}
362362

363363
static void device_remove_groups(struct device *dev,
364-
struct attribute_group **groups)
364+
const struct attribute_group **groups)
365365
{
366366
int i;
367367

‎drivers/base/driver.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ void put_driver(struct device_driver *drv)
181181
EXPORT_SYMBOL_GPL(put_driver);
182182

183183
static int driver_add_groups(struct device_driver *drv,
184-
struct attribute_group **groups)
184+
const struct attribute_group **groups)
185185
{
186186
int error = 0;
187187
int i;
@@ -201,7 +201,7 @@ static int driver_add_groups(struct device_driver *drv,
201201
}
202202

203203
static void driver_remove_groups(struct device_driver *drv,
204-
struct attribute_group **groups)
204+
const struct attribute_group **groups)
205205
{
206206
int i;
207207

‎drivers/block/cciss.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ static struct attribute_group cciss_dev_attr_group = {
572572
.attrs = cciss_dev_attrs,
573573
};
574574

575-
static struct attribute_group *cciss_dev_attr_groups[] = {
575+
static const struct attribute_group *cciss_dev_attr_groups[] = {
576576
&cciss_dev_attr_group,
577577
NULL
578578
};

‎drivers/firewire/core-device.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ static void init_fw_attribute_group(struct device *dev,
312312
group->groups[0] = &group->group;
313313
group->groups[1] = NULL;
314314
group->group.attrs = group->attrs;
315-
dev->groups = group->groups;
315+
dev->groups = (const struct attribute_group **) group->groups;
316316
}
317317

318318
static ssize_t modalias_show(struct device *dev,

‎drivers/firmware/dmi-id.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static struct attribute_group sys_dmi_attribute_group = {
139139
.attrs = sys_dmi_attributes,
140140
};
141141

142-
static struct attribute_group* sys_dmi_attribute_groups[] = {
142+
static const struct attribute_group* sys_dmi_attribute_groups[] = {
143143
&sys_dmi_attribute_group,
144144
NULL
145145
};

‎drivers/infiniband/hw/ehca/ehca_main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ static struct attribute_group ehca_drv_attr_grp = {
623623
.attrs = ehca_drv_attrs
624624
};
625625

626-
static struct attribute_group *ehca_drv_attr_groups[] = {
626+
static const struct attribute_group *ehca_drv_attr_groups[] = {
627627
&ehca_drv_attr_grp,
628628
NULL,
629629
};

‎drivers/infiniband/hw/ipath/ipath_kernel.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@ struct device_driver;
12861286

12871287
extern const char ib_ipath_version[];
12881288

1289-
extern struct attribute_group *ipath_driver_attr_groups[];
1289+
extern const struct attribute_group *ipath_driver_attr_groups[];
12901290

12911291
int ipath_device_create_group(struct device *, struct ipath_devdata *);
12921292
void ipath_device_remove_group(struct device *, struct ipath_devdata *);

‎drivers/infiniband/hw/ipath/ipath_sysfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ static ssize_t show_tempsense(struct device *dev,
10691069
return ret;
10701070
}
10711071

1072-
struct attribute_group *ipath_driver_attr_groups[] = {
1072+
const struct attribute_group *ipath_driver_attr_groups[] = {
10731073
&driver_attr_group,
10741074
NULL,
10751075
};

‎drivers/input/input.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ static struct attribute_group input_dev_caps_attr_group = {
11441144
.attrs = input_dev_caps_attrs,
11451145
};
11461146

1147-
static struct attribute_group *input_dev_attr_groups[] = {
1147+
static const struct attribute_group *input_dev_attr_groups[] = {
11481148
&input_dev_attr_group,
11491149
&input_dev_id_attr_group,
11501150
&input_dev_caps_attr_group,

0 commit comments

Comments
 (0)