提交 bfb6df24 编写于 作者: M Mark M. Hoffman 提交者: 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: NMark M. Hoffman <mhoffman@lightlink.com>
Signed-off-by: NJean Delvare <khali@linux-fr.org>
上级 6408a833
......@@ -978,7 +978,7 @@ static int i2c_probe_address(struct i2c_adapter *adapter, int addr, int kind,
}
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 i, err;
......@@ -987,7 +987,7 @@ int i2c_probe(struct i2c_adapter *adapter,
/* Force entries are done first, and are not affected by ignore
entries */
if (address_data->forces) {
unsigned short **forces = address_data->forces;
const unsigned short * const *forces = address_data->forces;
int kind;
for (kind = 0; forces[kind]; kind++) {
......
......@@ -357,10 +357,10 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
* command line
*/
struct i2c_client_address_data {
unsigned short *normal_i2c;
unsigned short *probe;
unsigned short *ignore;
unsigned short **forces;
const unsigned short *normal_i2c;
const unsigned short *probe;
const unsigned short *ignore;
const unsigned short * const *forces;
};
/* Internal numbers to terminate lists */
......@@ -405,7 +405,7 @@ extern void i2c_clients_command(struct i2c_adapter *adap,
* specific address (unless a 'force' matched);
*/
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));
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 " \
"additionally"); \
I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \
"scan"); \
static struct i2c_client_address_data addr_data = { \
const static struct i2c_client_address_data addr_data = { \
.normal_i2c = normal_i2c, \
.probe = probe, \
.ignore = ignore, \
.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
which matches the number of devices the driver differenciates between. */
#define I2C_CLIENT_INSMOD \
I2C_CLIENT_MODULE_PARM(force, \
"List of adapter,address pairs to boldly assume " \
"to be present"); \
static unsigned short *forces[] = { \
force, \
NULL \
}; \
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
static const unsigned short * const forces[] = { force, NULL }; \
I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_1(chip1) \
enum chips { any_chip, chip1 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
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
#define I2C_CLIENT_INSMOD_2(chip1, chip2) \
enum chips { any_chip, chip1, chip2 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
static unsigned short *forces[] = { force, force_##chip1, \
force_##chip2, NULL }; \
static const unsigned short * const forces[] = { force, \
force_##chip1, force_##chip2, NULL }; \
I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
enum chips { any_chip, chip1, chip2, chip3 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
static unsigned short *forces[] = { force, force_##chip1, \
force_##chip2, force_##chip3, \
NULL }; \
static const unsigned short * const forces[] = { force, \
force_##chip1, force_##chip2, force_##chip3, NULL }; \
I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
static unsigned short *forces[] = { force, force_##chip1, \
force_##chip2, force_##chip3, \
static const unsigned short * const forces[] = { force, \
force_##chip1, force_##chip2, force_##chip3, \
force_##chip4, NULL}; \
I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_5(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 " \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
static unsigned short *forces[] = { force, force_##chip1, \
force_##chip2, force_##chip3, \
force_##chip4, force_##chip5, \
NULL }; \
static const unsigned short * const forces[] = { force, \
force_##chip1, force_##chip2, force_##chip3, \
force_##chip4, force_##chip5, NULL }; \
I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_6(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 " \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
static unsigned short *forces[] = { force, force_##chip1, \
force_##chip2, force_##chip3, \
force_##chip4, force_##chip5, \
force_##chip6, NULL }; \
static const unsigned short * const forces[] = { force, \
force_##chip1, force_##chip2, force_##chip3, \
force_##chip4, force_##chip5, force_##chip6, NULL }; \
I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
chip7 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
......@@ -703,18 +692,16 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
static unsigned short *forces[] = { force, force_##chip1, \
force_##chip2, force_##chip3, \
force_##chip4, force_##chip5, \
force_##chip6, force_##chip7, \
NULL }; \
static const unsigned short * const forces[] = { force, \
force_##chip1, force_##chip2, force_##chip3, \
force_##chip4, force_##chip5, force_##chip6, \
force_##chip7, NULL }; \
I2C_CLIENT_INSMOD_COMMON
#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
chip7, chip8 }; \
I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \
"boldly assume to be present"); \
I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
......@@ -723,11 +710,10 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
I2C_CLIENT_MODULE_PARM_FORCE(chip8); \
static unsigned short *forces[] = { force, force_##chip1, \
force_##chip2, force_##chip3, \
force_##chip4, force_##chip5, \
force_##chip6, force_##chip7, \
force_##chip8, NULL }; \
static const unsigned short * const forces[] = { force, \
force_##chip1, force_##chip2, force_##chip3, \
force_##chip4, force_##chip5, force_##chip6, \
force_##chip7, force_##chip8, NULL }; \
I2C_CLIENT_INSMOD_COMMON
#endif /* __KERNEL__ */
#endif /* _LINUX_I2C_H */
......@@ -34,7 +34,7 @@ struct v4l2_i2c_driver_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 char v4l2_i2c_drv_name_legacy[32];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册