Commit bfb6df24 authored by Mark M. Hoffman's avatar Mark M. Hoffman Committed by Jean Delvare

i2c: Constify client address data

This patch allows much of the I2C client address data to move from initdata
into text.
Signed-off-by: default avatarMark M. Hoffman <mhoffman@lightlink.com>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 6408a833
...@@ -978,7 +978,7 @@ static int i2c_probe_address(struct i2c_adapter *adapter, int addr, int kind, ...@@ -978,7 +978,7 @@ static int i2c_probe_address(struct i2c_adapter *adapter, int addr, int kind,
} }
int i2c_probe(struct i2c_adapter *adapter, int i2c_probe(struct i2c_adapter *adapter,
struct i2c_client_address_data *address_data, const struct i2c_client_address_data *address_data,
int (*found_proc) (struct i2c_adapter *, int, int)) int (*found_proc) (struct i2c_adapter *, int, int))
{ {
int i, err; int i, err;
...@@ -987,7 +987,7 @@ int i2c_probe(struct i2c_adapter *adapter, ...@@ -987,7 +987,7 @@ int i2c_probe(struct i2c_adapter *adapter,
/* Force entries are done first, and are not affected by ignore /* Force entries are done first, and are not affected by ignore
entries */ entries */
if (address_data->forces) { if (address_data->forces) {
unsigned short **forces = address_data->forces; const unsigned short * const *forces = address_data->forces;
int kind; int kind;
for (kind = 0; forces[kind]; kind++) { for (kind = 0; forces[kind]; kind++) {
......
...@@ -357,10 +357,10 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) ...@@ -357,10 +357,10 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
* command line * command line
*/ */
struct i2c_client_address_data { struct i2c_client_address_data {
unsigned short *normal_i2c; const unsigned short *normal_i2c;
unsigned short *probe; const unsigned short *probe;
unsigned short *ignore; const unsigned short *ignore;
unsigned short **forces; const unsigned short * const *forces;
}; };
/* Internal numbers to terminate lists */ /* Internal numbers to terminate lists */
...@@ -405,7 +405,7 @@ extern void i2c_clients_command(struct i2c_adapter *adap, ...@@ -405,7 +405,7 @@ extern void i2c_clients_command(struct i2c_adapter *adap,
* specific address (unless a 'force' matched); * specific address (unless a 'force' matched);
*/ */
extern int i2c_probe(struct i2c_adapter *adapter, extern int i2c_probe(struct i2c_adapter *adapter,
struct i2c_client_address_data *address_data, const struct i2c_client_address_data *address_data,
int (*found_proc) (struct i2c_adapter *, int, int)); int (*found_proc) (struct i2c_adapter *, int, int));
extern struct i2c_adapter* i2c_get_adapter(int id); extern struct i2c_adapter* i2c_get_adapter(int id);
...@@ -598,104 +598,93 @@ I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \ ...@@ -598,104 +598,93 @@ I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \
"additionally"); \ "additionally"); \
I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \ I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \
"scan"); \ "scan"); \
static struct i2c_client_address_data addr_data = { \ const static struct i2c_client_address_data addr_data = { \
.normal_i2c = normal_i2c, \ .normal_i2c = normal_i2c, \
.probe = probe, \ .probe = probe, \
.ignore = ignore, \ .ignore = ignore, \
.forces = forces, \ .forces = forces, \
} }
#define I2C_CLIENT_FORCE_TEXT \
"List of adapter,address pairs to boldly assume to be present"
/* These are the ones you want to use in your own drivers. Pick the one /* These are the ones you want to use in your own drivers. Pick the one
which matches the number of devices the driver differenciates between. */ which matches the number of devices the driver differenciates between. */
#define I2C_CLIENT_INSMOD \ #define I2C_CLIENT_INSMOD \
I2C_CLIENT_MODULE_PARM(force, \ I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
"List of adapter,address pairs to boldly assume " \ static const unsigned short * const forces[] = { force, NULL }; \
"to be present"); \
static unsigned short *forces[] = { \
force, \
NULL \
}; \
I2C_CLIENT_INSMOD_COMMON I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_1(chip1) \ #define I2C_CLIENT_INSMOD_1(chip1) \
enum chips { any_chip, chip1 }; \ enum chips { any_chip, chip1 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
static unsigned short *forces[] = { force, force_##chip1, NULL }; \ static const unsigned short * const forces[] = { force, \
force_##chip1, NULL }; \
I2C_CLIENT_INSMOD_COMMON I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_2(chip1, chip2) \ #define I2C_CLIENT_INSMOD_2(chip1, chip2) \
enum chips { any_chip, chip1, chip2 }; \ enum chips { any_chip, chip1, chip2 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
static unsigned short *forces[] = { force, force_##chip1, \ static const unsigned short * const forces[] = { force, \
force_##chip2, NULL }; \ force_##chip1, force_##chip2, NULL }; \
I2C_CLIENT_INSMOD_COMMON I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ #define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
enum chips { any_chip, chip1, chip2, chip3 }; \ enum chips { any_chip, chip1, chip2, chip3 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
static unsigned short *forces[] = { force, force_##chip1, \ static const unsigned short * const forces[] = { force, \
force_##chip2, force_##chip3, \ force_##chip1, force_##chip2, force_##chip3, NULL }; \
NULL }; \
I2C_CLIENT_INSMOD_COMMON I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \ #define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
static unsigned short *forces[] = { force, force_##chip1, \ static const unsigned short * const forces[] = { force, \
force_##chip2, force_##chip3, \ force_##chip1, force_##chip2, force_##chip3, \
force_##chip4, NULL}; \ force_##chip4, NULL}; \
I2C_CLIENT_INSMOD_COMMON I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \ #define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
static unsigned short *forces[] = { force, force_##chip1, \ static const unsigned short * const forces[] = { force, \
force_##chip2, force_##chip3, \ force_##chip1, force_##chip2, force_##chip3, \
force_##chip4, force_##chip5, \ force_##chip4, force_##chip5, NULL }; \
NULL }; \
I2C_CLIENT_INSMOD_COMMON I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \ #define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
static unsigned short *forces[] = { force, force_##chip1, \ static const unsigned short * const forces[] = { force, \
force_##chip2, force_##chip3, \ force_##chip1, force_##chip2, force_##chip3, \
force_##chip4, force_##chip5, \ force_##chip4, force_##chip5, force_##chip6, NULL }; \
force_##chip6, NULL }; \
I2C_CLIENT_INSMOD_COMMON I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \ #define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
chip7 }; \ chip7 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
...@@ -703,18 +692,16 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ ...@@ -703,18 +692,16 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
static unsigned short *forces[] = { force, force_##chip1, \ static const unsigned short * const forces[] = { force, \
force_##chip2, force_##chip3, \ force_##chip1, force_##chip2, force_##chip3, \
force_##chip4, force_##chip5, \ force_##chip4, force_##chip5, force_##chip6, \
force_##chip6, force_##chip7, \ force_##chip7, NULL }; \
NULL }; \
I2C_CLIENT_INSMOD_COMMON I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \ #define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
chip7, chip8 }; \ chip7, chip8 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
...@@ -723,11 +710,10 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ ...@@ -723,11 +710,10 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
I2C_CLIENT_MODULE_PARM_FORCE(chip8); \ I2C_CLIENT_MODULE_PARM_FORCE(chip8); \
static unsigned short *forces[] = { force, force_##chip1, \ static const unsigned short * const forces[] = { force, \
force_##chip2, force_##chip3, \ force_##chip1, force_##chip2, force_##chip3, \
force_##chip4, force_##chip5, \ force_##chip4, force_##chip5, force_##chip6, \
force_##chip6, force_##chip7, \ force_##chip7, force_##chip8, NULL }; \
force_##chip8, NULL }; \
I2C_CLIENT_INSMOD_COMMON I2C_CLIENT_INSMOD_COMMON
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _LINUX_I2C_H */ #endif /* _LINUX_I2C_H */
...@@ -34,7 +34,7 @@ struct v4l2_i2c_driver_data { ...@@ -34,7 +34,7 @@ struct v4l2_i2c_driver_data {
}; };
static struct v4l2_i2c_driver_data v4l2_i2c_data; static struct v4l2_i2c_driver_data v4l2_i2c_data;
static struct i2c_client_address_data addr_data; static const struct i2c_client_address_data addr_data;
static struct i2c_driver v4l2_i2c_driver_legacy; static struct i2c_driver v4l2_i2c_driver_legacy;
static char v4l2_i2c_drv_name_legacy[32]; static char v4l2_i2c_drv_name_legacy[32];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment