Skip to contentSkip to conversation

HID: intel-ish-hid: constify device_type structure

PATCH Applied Bhumika Goyal 3 participants 3 messages Feb 11, 2017 – Feb 14, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: intel-ish-hid: constify device_type structure

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 the declaration of device_type structure.

File size before: drivers/hid/intel-ish-hid/ishtp/bus.o
text data bss dec hex filename
4260 336 16 4612 1204 hid/intel-ish-hid/ishtp/bus.o

File size after: drivers/hid/intel-ish-hid/ishtp/bus.o
text data bss dec hex filename
4324 272 16 4612 1204 hid/intel-ish-hid/ishtp/bus.o

---
 drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/intel-ish-hid/ishtp/bus.c +1 -1
index f4cbc74..5f382fe 100644
@@ -358,7 +358,7 @@ static void ishtp_cl_dev_release(struct device *dev)
 	kfree(to_ishtp_cl_device(dev));
 }
 
-static struct device_type ishtp_cl_device_type = {
+static const struct device_type ishtp_cl_device_type = {
 	.release	= ishtp_cl_dev_release,
 };
 
Signature · 1 line
1.9.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 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 the declaration of device_type structure.

File size before: drivers/hid/intel-ish-hid/ishtp/bus.o
   text    data     bss     dec     hex
filename
   4260     336      16    4612    1204
hid/intel-ish-hid/ishtp/bus.o

Quoted 7 lines

File size after: drivers/hid/intel-ish-hid/ishtp/bus.o
   text    data     bss     dec     hex
filename
   4324     272      16    4612    1204
hid/intel-ish-hid/ishtp/bus.o

Quoted 19 lines

---
 drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/intel-ish-hid/ishtp/bus.c +0 -0
index f4cbc74..5f382fe 100644
@@ -358,7 +358,7 @@ static void ishtp_cl_dev_release(struct device
 *dev)
  	kfree(to_ishtp_cl_device(dev));
  }

drivers/hid/intel-ish-hid/ishtp/bus.c +1 -1
-static struct device_type ishtp_cl_device_type = {
+static const struct device_type ishtp_cl_device_type = {

  .release = ishtp_cl_dev_release,
 };

maintainer Applied
#2 lore raw
In reply to Bhumika Goyal
Quoted 22 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 the declaration of device_type structure.

File size before: drivers/hid/intel-ish-hid/ishtp/bus.o
text data bss dec hex filename
4260 336 16 4612 1204 hid/intel-ish-hid/ishtp/bus.o

File size after: drivers/hid/intel-ish-hid/ishtp/bus.o
text data bss dec hex filename
4324 272 16 4612 1204 hid/intel-ish-hid/ishtp/bus.o

---
 drivers/hid/intel-ish-hid/ishtp/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/intel-ish-hid/ishtp/bus.c +0 -0
index f4cbc74..5f382fe 100644

drivers/hid/intel-ish-hid/ishtp/bus.c static void ishtp_cl_dev_release(struct device *dev) · line 363

Quoted 7 lines
drivers/hid/intel-ish-hid/ishtp/bus.c +1 -1
@@ -358,7 +358,7 @@ static void ishtp_cl_dev_release(struct device *dev)
 	kfree(to_ishtp_cl_device(dev));
 }
 
-static struct device_type ishtp_cl_device_type = {
+static const struct device_type ishtp_cl_device_type = {
 	.release	= ishtp_cl_dev_release,
 };

Applied to hid.git#for-4.11/intel-ish, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs