Skip to content

Commit

Permalink
i2c: Drop I2C_CLIENT_INSMOD_2 to 8
Browse files Browse the repository at this point in the history
These macros simply declare an enum, so drivers might as well declare
it themselves. This puts an end to the arbitrary limit of 8 chip types
per i2c driver.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
  • Loading branch information
Jean Delvare committed Dec 14, 2009
1 parent 1f86df4 commit e5e9f44
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 75 deletions.
5 changes: 2 additions & 3 deletions drivers/hwmon/adm1021.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@
static const unsigned short normal_i2c[] = {
0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };

/* Insmod parameters */
I2C_CLIENT_INSMOD_8(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm,
mc1066);
enum chips {
adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm, mc1066 };

/* adm1021 constants specified below */

Expand Down
6 changes: 1 addition & 5 deletions drivers/hwmon/adm1025.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,7 @@

static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };

/*
* Insmod parameters
*/

I2C_CLIENT_INSMOD_2(adm1025, ne1619);
enum chips { adm1025, ne1619 };

/*
* The ADM1025 registers
Expand Down
3 changes: 1 addition & 2 deletions drivers/hwmon/adm1031.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@
/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };

/* Insmod parameters */
I2C_CLIENT_INSMOD_2(adm1030, adm1031);
enum chips { adm1030, adm1031 };

typedef u8 auto_chan_table_t[8][2];

Expand Down
3 changes: 1 addition & 2 deletions drivers/hwmon/adm9240.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
I2C_CLIENT_END };

/* Insmod parameters */
I2C_CLIENT_INSMOD_3(adm9240, ds1780, lm81);
enum chips { adm9240, ds1780, lm81 };

/* ADM9240 registers */
#define ADM9240_REG_MAN_ID 0x3e
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/adt7475.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@

static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };

I2C_CLIENT_INSMOD_4(adt7473, adt7475, adt7476, adt7490);
enum chips { adt7473, adt7475, adt7476, adt7490 };

static const struct i2c_device_id adt7475_id[] = {
{ "adt7473", adt7473 },
Expand Down
6 changes: 1 addition & 5 deletions drivers/hwmon/dme1737.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ MODULE_PARM_DESC(probe_all_addr, "Include probing of non-standard LPC "
/* Addresses to scan */
static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END};

/* Insmod parameters */
I2C_CLIENT_INSMOD_2(dme1737, sch5027);

/* ISA chip types */
enum isa_chips { sch311x = sch5027 + 1 };
enum chips { dme1737, sch5027, sch311x };

/* ---------------------------------------------------------------------
* Registers
Expand Down
3 changes: 1 addition & 2 deletions drivers/hwmon/f75375s.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END };

/* Insmod parameters */
I2C_CLIENT_INSMOD_2(f75373, f75375);
enum chips { f75373, f75375 };

/* Fintek F75375 registers */
#define F75375_REG_CONFIG0 0x0
Expand Down
3 changes: 2 additions & 1 deletion drivers/hwmon/fschmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
I2C_CLIENT_INSMOD_7(fscpos, fscher, fscscy, fschrc, fschmd, fschds, fscsyl);

enum chips { fscpos, fscher, fscscy, fschrc, fschmd, fschds, fscsyl };

/*
* The FSCHMD registers and other defines
Expand Down
3 changes: 1 addition & 2 deletions drivers/hwmon/gl518sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };

/* Insmod parameters */
I2C_CLIENT_INSMOD_2(gl518sm_r00, gl518sm_r80);
enum chips { gl518sm_r00, gl518sm_r80 };

/* Many GL518 constants specified below */

Expand Down
3 changes: 1 addition & 2 deletions drivers/hwmon/lm78.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
0x2e, 0x2f, I2C_CLIENT_END };
static unsigned short isa_address = 0x290;

/* Insmod parameters */
I2C_CLIENT_INSMOD_2(lm78, lm79);
enum chips { lm78, lm79 };

/* Many LM78 constants specified below */

Expand Down
6 changes: 1 addition & 5 deletions drivers/hwmon/lm83.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@
static const unsigned short normal_i2c[] = {
0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };

/*
* Insmod parameters
*/

I2C_CLIENT_INSMOD_2(lm83, lm82);
enum chips { lm83, lm82 };

/*
* The LM83 registers
Expand Down
8 changes: 5 additions & 3 deletions drivers/hwmon/lm85.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@
/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };

/* Insmod parameters */
I2C_CLIENT_INSMOD_7(lm85b, lm85c, adm1027, adt7463, adt7468, emc6d100,
emc6d102);
enum chips {
any_chip, lm85b, lm85c,
adm1027, adt7463, adt7468,
emc6d100, emc6d102
};

/* The LM85 registers */

Expand Down
6 changes: 1 addition & 5 deletions drivers/hwmon/lm87.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@

static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };

/*
* Insmod parameters
*/

I2C_CLIENT_INSMOD_2(lm87, adm1024);
enum chips { lm87, adm1024 };

/*
* The LM87 registers
Expand Down
7 changes: 1 addition & 6 deletions drivers/hwmon/lm90.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,7 @@
static const unsigned short normal_i2c[] = {
0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };

/*
* Insmod parameters
*/

I2C_CLIENT_INSMOD_8(lm90, adm1032, lm99, lm86, max6657, adt7461, max6680,
max6646);
enum chips { lm90, adm1032, lm99, lm86, max6657, adt7461, max6680, max6646 };

/*
* The LM90 registers
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/thmc50.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ MODULE_LICENSE("GPL");
static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };

/* Insmod parameters */
I2C_CLIENT_INSMOD_2(thmc50, adm1022);
enum chips { thmc50, adm1022 };

static unsigned short adm1022_temp3[16];
static unsigned int adm1022_temp3_num;
Expand Down
3 changes: 1 addition & 2 deletions drivers/hwmon/tmp401.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END };

/* Insmod parameters */
I2C_CLIENT_INSMOD_2(tmp401, tmp411);
enum chips { tmp401, tmp411 };

/*
* The TMP401 registers, note some registers have different addresses for
Expand Down
3 changes: 1 addition & 2 deletions drivers/hwmon/tmp421.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
static unsigned short normal_i2c[] = { 0x2a, 0x4c, 0x4d, 0x4e, 0x4f,
I2C_CLIENT_END };

/* Insmod parameters */
I2C_CLIENT_INSMOD_3(tmp421, tmp422, tmp423);
enum chips { tmp421, tmp422, tmp423 };

/* The TMP421 registers */
#define TMP421_CONFIG_REG_1 0x09
Expand Down
5 changes: 3 additions & 2 deletions drivers/hwmon/w83781d.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@
/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
0x2e, 0x2f, I2C_CLIENT_END };
/* Insmod parameters */
I2C_CLIENT_INSMOD_4(w83781d, w83782d, w83783s, as99127f);

enum chips { w83781d, w83782d, w83783s, as99127f };

/* Insmod parameters */
static unsigned short force_subclients[4];
module_param_array(force_subclients, short, NULL, 0);
MODULE_PARM_DESC(force_subclients, "List of subclient addresses: "
Expand Down
24 changes: 0 additions & 24 deletions include/linux/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -602,29 +602,5 @@ union i2c_smbus_data {
module_param_array(var, short, &var##_num, 0); \
MODULE_PARM_DESC(var, desc)

/* 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_2(chip1, chip2) \
enum chips { any_chip, chip1, chip2 }

#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
enum chips { any_chip, chip1, chip2, chip3 }

#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
enum chips { any_chip, chip1, chip2, chip3, chip4 }

#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }

#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }

#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
chip7 }

#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 }
#endif /* __KERNEL__ */
#endif /* _LINUX_I2C_H */

0 comments on commit e5e9f44

Please sign in to comment.