Skip to contentSkip to conversation

iio: industrialio-trigger: constify device_type structures

PATCH In review Bhumika Goyal 2 participants 2 messages Jan 21, 2017 – Jan 22, 2017 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: industrialio-trigger: constify device_type structures

Declare device_type structure as const as it is only stored in the type field of a device structure. This field is of type const, so add const to declaration of device_type structure.

File size before:
text data bss dec hex filename
5389 208 48 5645 160d iio/industrialio-trigger.o

File size after:
text data bss dec hex filename
5453 176 48 5677 162d iio/industrialio-trigger.o

---
 drivers/iio/industrialio-trigger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/industrialio-trigger.c +1 -1
index 978729f..3257f0e 100644
@@ -487,7 +487,7 @@ static void iio_trig_release(struct device *device)
 	kfree(trig);
 }
 
-static struct device_type iio_trig_type = {
+static const struct device_type iio_trig_type = {
 	.release = iio_trig_release,
 	.groups = iio_trig_dev_groups,
 };
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 8 lines · Bhumika Goyal

Declare device_type structure as const as it is only stored in the type field of a device structure. This field is of type const, so add const to declaration of device_type structure.

File size before:
text data bss dec hex filename
5389 208 48 5645 160d iio/industrialio-trigger.o

Quoted 5 lines

File size after:
text data bss dec hex filename
5453 176 48 5677 162d iio/industrialio-trigger.o

Makes sense.

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

Quoted 18 lines
---
 drivers/iio/industrialio-trigger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/industrialio-trigger.c +1 -1
index 978729f..3257f0e 100644
@@ -487,7 +487,7 @@ static void iio_trig_release(struct device *device)
 	kfree(trig);
 }
 
-static struct device_type iio_trig_type = {
+static const struct device_type iio_trig_type = {
 	.release = iio_trig_release,
 	.groups = iio_trig_dev_groups,
 };