Skip to contentSkip to conversation

constify i2c_device_id

PATCH In review Arvind Yadav 1 participant 4 messages Aug 21, 2017 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

cover constify i2c_device_id

i2c_device_id are not supposed to change at runtime. All functions working with i2c_device_id provided by <linux/i2c.h> work with const i2c_device_id. So mark the non-const structs as const.

Arvind Yadav (4):
[PATCH 1/4] misc: apds9802als: constify i2c_device_id [PATCH 2/4] misc: hmc6352: constify i2c_device_id [PATCH 3/4] misc: isl29020: constify i2c_device_id [PATCH 4/4] staging: iio: tsl2x7x: constify i2c_device_id

 drivers/misc/apds9802als.c          | 2 +-
 drivers/misc/hmc6352.c              | 2 +-
 drivers/misc/isl29020.c             | 2 +-
 drivers/staging/iio/light/tsl2x7x.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/4 misc: apds9802als: constify i2c_device_id

i2c_device_id are not supposed to change at runtime. All functions working with i2c_device_id provided by <linux/i2c.h> work with const i2c_device_id. So mark the non-const structs as const.

---
 drivers/misc/apds9802als.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/apds9802als.c +1 -1
index c6cc3dc..944ac9d 100644
@@ -298,7 +298,7 @@ static UNIVERSAL_DEV_PM_OPS(apds9802als_pm_ops, apds9802als_suspend,
 #define APDS9802ALS_PM_OPS NULL
 #endif	/* CONFIG_PM */
 
-static struct i2c_device_id apds9802als_id[] = {
+static const struct i2c_device_id apds9802als_id[] = {
 	{ DRIVER_NAME, 0 },
 	{ }
 };
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/4 misc: isl29020: constify i2c_device_id

In reply to Arvind Yadav

i2c_device_id are not supposed to change at runtime. All functions working with i2c_device_id provided by <linux/i2c.h> work with const i2c_device_id. So mark the non-const structs as const.

---
 drivers/misc/isl29020.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/isl29020.c +1 -1
index 4a9c50a..02fac5b 100644
@@ -188,7 +188,7 @@ static int isl29020_remove(struct i2c_client *client)
 	return 0;
 }
 
-static struct i2c_device_id isl29020_id[] = {
+static const struct i2c_device_id isl29020_id[] = {
 	{ "isl29020", 0 },
 	{ }
 };
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/4 misc: hmc6352: constify i2c_device_id

In reply to Arvind Yadav

i2c_device_id are not supposed to change at runtime. All functions working with i2c_device_id provided by <linux/i2c.h> work with const i2c_device_id. So mark the non-const structs as const.

---
 drivers/misc/hmc6352.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/hmc6352.c +1 -1
index 90520d7..eeb7eef 100644
@@ -132,7 +132,7 @@ static int hmc6352_remove(struct i2c_client *client)
 	return 0;
 }
 
-static struct i2c_device_id hmc6352_id[] = {
+static const struct i2c_device_id hmc6352_id[] = {
 	{ "hmc6352", 0 },
 	{ }
 };
Signature · 1 line
2.7.4