aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-12-14 15:17:27 -0500
committerJean Delvare <khali@linux-fr.org>2009-12-14 15:17:27 -0500
commite5e9f44c246fbafe723e579e9fe887677beb40e4 (patch)
tree53d65b38b6db7aa250400056091a760cced42cd7
parent1f86df49ddfd0067cce941187d57b2fd2f749a9e (diff)
i2c: Drop I2C_CLIENT_INSMOD_2 to 8
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>
-rw-r--r--drivers/hwmon/adm1021.c5
-rw-r--r--drivers/hwmon/adm1025.c6
-rw-r--r--drivers/hwmon/adm1031.c3
-rw-r--r--drivers/hwmon/adm9240.c3
-rw-r--r--drivers/hwmon/adt7475.c2
-rw-r--r--drivers/hwmon/dme1737.c6
-rw-r--r--drivers/hwmon/f75375s.c3
-rw-r--r--drivers/hwmon/fschmd.c3
-rw-r--r--drivers/hwmon/gl518sm.c3
-rw-r--r--drivers/hwmon/lm78.c3
-rw-r--r--drivers/hwmon/lm83.c6
-rw-r--r--drivers/hwmon/lm85.c8
-rw-r--r--drivers/hwmon/lm87.c6
-rw-r--r--drivers/hwmon/lm90.c7
-rw-r--r--drivers/hwmon/thmc50.c2
-rw-r--r--drivers/hwmon/tmp401.c3
-rw-r--r--drivers/hwmon/tmp421.c3
-rw-r--r--drivers/hwmon/w83781d.c5
-rw-r--r--include/linux/i2c.h24
19 files changed, 26 insertions, 75 deletions
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c
index d7af039a4d43..1ad0a885c5a5 100644
--- a/drivers/hwmon/adm1021.c
+++ b/drivers/hwmon/adm1021.c
@@ -34,9 +34,8 @@
34static const unsigned short normal_i2c[] = { 34static const unsigned short normal_i2c[] = {
35 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END }; 35 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
36 36
37/* Insmod parameters */ 37enum chips {
38I2C_CLIENT_INSMOD_8(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm, 38 adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm, mc1066 };
39 mc1066);
40 39
41/* adm1021 constants specified below */ 40/* adm1021 constants specified below */
42 41
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c
index e17651083b09..251b63165e2a 100644
--- a/drivers/hwmon/adm1025.c
+++ b/drivers/hwmon/adm1025.c
@@ -64,11 +64,7 @@
64 64
65static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 65static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
66 66
67/* 67enum chips { adm1025, ne1619 };
68 * Insmod parameters
69 */
70
71I2C_CLIENT_INSMOD_2(adm1025, ne1619);
72 68
73/* 69/*
74 * The ADM1025 registers 70 * The ADM1025 registers
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c
index 1e02799b870e..1644b92e7cc4 100644
--- a/drivers/hwmon/adm1031.c
+++ b/drivers/hwmon/adm1031.c
@@ -64,8 +64,7 @@
64/* Addresses to scan */ 64/* Addresses to scan */
65static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 65static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
66 66
67/* Insmod parameters */ 67enum chips { adm1030, adm1031 };
68I2C_CLIENT_INSMOD_2(adm1030, adm1031);
69 68
70typedef u8 auto_chan_table_t[8][2]; 69typedef u8 auto_chan_table_t[8][2];
71 70
diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c
index d9942e74ed4a..0727ad250793 100644
--- a/drivers/hwmon/adm9240.c
+++ b/drivers/hwmon/adm9240.c
@@ -55,8 +55,7 @@
55static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, 55static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f,
56 I2C_CLIENT_END }; 56 I2C_CLIENT_END };
57 57
58/* Insmod parameters */ 58enum chips { adm9240, ds1780, lm81 };
59I2C_CLIENT_INSMOD_3(adm9240, ds1780, lm81);
60 59
61/* ADM9240 registers */ 60/* ADM9240 registers */
62#define ADM9240_REG_MAN_ID 0x3e 61#define ADM9240_REG_MAN_ID 0x3e
diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
index 1fb8940428c6..a0c385145686 100644
--- a/drivers/hwmon/adt7475.c
+++ b/drivers/hwmon/adt7475.c
@@ -148,7 +148,7 @@
148 148
149static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 149static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
150 150
151I2C_CLIENT_INSMOD_4(adt7473, adt7475, adt7476, adt7490); 151enum chips { adt7473, adt7475, adt7476, adt7490 };
152 152
153static const struct i2c_device_id adt7475_id[] = { 153static const struct i2c_device_id adt7475_id[] = {
154 { "adt7473", adt7473 }, 154 { "adt7473", adt7473 },
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
index a3af09f9dbad..823dd28a902c 100644
--- a/drivers/hwmon/dme1737.c
+++ b/drivers/hwmon/dme1737.c
@@ -57,11 +57,7 @@ MODULE_PARM_DESC(probe_all_addr, "Include probing of non-standard LPC "
57/* Addresses to scan */ 57/* Addresses to scan */
58static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END}; 58static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END};
59 59
60/* Insmod parameters */ 60enum chips { dme1737, sch5027, sch311x };
61I2C_CLIENT_INSMOD_2(dme1737, sch5027);
62
63/* ISA chip types */
64enum isa_chips { sch311x = sch5027 + 1 };
65 61
66/* --------------------------------------------------------------------- 62/* ---------------------------------------------------------------------
67 * Registers 63 * Registers
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index f8992c935666..277398f9c938 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -39,8 +39,7 @@
39/* Addresses to scan */ 39/* Addresses to scan */
40static const unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END }; 40static const unsigned short normal_i2c[] = { 0x2d, 0x2e, I2C_CLIENT_END };
41 41
42/* Insmod parameters */ 42enum chips { f75373, f75375 };
43I2C_CLIENT_INSMOD_2(f75373, f75375);
44 43
45/* Fintek F75375 registers */ 44/* Fintek F75375 registers */
46#define F75375_REG_CONFIG0 0x0 45#define F75375_REG_CONFIG0 0x0
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c
index 4eebbbeba2d1..bd0fc67e804b 100644
--- a/drivers/hwmon/fschmd.c
+++ b/drivers/hwmon/fschmd.c
@@ -56,7 +56,8 @@ static int nowayout = WATCHDOG_NOWAYOUT;
56module_param(nowayout, int, 0); 56module_param(nowayout, int, 0);
57MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" 57MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
58 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); 58 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
59I2C_CLIENT_INSMOD_7(fscpos, fscher, fscscy, fschrc, fschmd, fschds, fscsyl); 59
60enum chips { fscpos, fscher, fscscy, fschrc, fschmd, fschds, fscsyl };
60 61
61/* 62/*
62 * The FSCHMD registers and other defines 63 * The FSCHMD registers and other defines
diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c
index e9407acd72cb..e7ae5743e181 100644
--- a/drivers/hwmon/gl518sm.c
+++ b/drivers/hwmon/gl518sm.c
@@ -46,8 +46,7 @@
46/* Addresses to scan */ 46/* Addresses to scan */
47static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; 47static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
48 48
49/* Insmod parameters */ 49enum chips { gl518sm_r00, gl518sm_r80 };
50I2C_CLIENT_INSMOD_2(gl518sm_r00, gl518sm_r80);
51 50
52/* Many GL518 constants specified below */ 51/* Many GL518 constants specified below */
53 52
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
index cd6a9ea921f6..cadcbd90ff3b 100644
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -41,8 +41,7 @@ static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
41 0x2e, 0x2f, I2C_CLIENT_END }; 41 0x2e, 0x2f, I2C_CLIENT_END };
42static unsigned short isa_address = 0x290; 42static unsigned short isa_address = 0x290;
43 43
44/* Insmod parameters */ 44enum chips { lm78, lm79 };
45I2C_CLIENT_INSMOD_2(lm78, lm79);
46 45
47/* Many LM78 constants specified below */ 46/* Many LM78 constants specified below */
48 47
diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c
index b80ae182f851..8290476aee4a 100644
--- a/drivers/hwmon/lm83.c
+++ b/drivers/hwmon/lm83.c
@@ -51,11 +51,7 @@
51static const unsigned short normal_i2c[] = { 51static const unsigned short normal_i2c[] = {
52 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END }; 52 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
53 53
54/* 54enum chips { lm83, lm82 };
55 * Insmod parameters
56 */
57
58I2C_CLIENT_INSMOD_2(lm83, lm82);
59 55
60/* 56/*
61 * The LM83 registers 57 * The LM83 registers
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
index d29bd34a265e..b3841a615595 100644
--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -38,9 +38,11 @@
38/* Addresses to scan */ 38/* Addresses to scan */
39static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 39static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
40 40
41/* Insmod parameters */ 41enum chips {
42I2C_CLIENT_INSMOD_7(lm85b, lm85c, adm1027, adt7463, adt7468, emc6d100, 42 any_chip, lm85b, lm85c,
43 emc6d102); 43 adm1027, adt7463, adt7468,
44 emc6d100, emc6d102
45};
44 46
45/* The LM85 registers */ 47/* The LM85 registers */
46 48
diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
index 60d34bc578cb..f1e6e7512ffa 100644
--- a/drivers/hwmon/lm87.c
+++ b/drivers/hwmon/lm87.c
@@ -74,11 +74,7 @@
74 74
75static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 75static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
76 76
77/* 77enum chips { lm87, adm1024 };
78 * Insmod parameters
79 */
80
81I2C_CLIENT_INSMOD_2(lm87, adm1024);
82 78
83/* 79/*
84 * The LM87 registers 80 * The LM87 registers
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 3e916ac97ea8..7c9bdc167426 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -93,12 +93,7 @@
93static const unsigned short normal_i2c[] = { 93static const unsigned short normal_i2c[] = {
94 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END }; 94 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
95 95
96/* 96enum chips { lm90, adm1032, lm99, lm86, max6657, adt7461, max6680, max6646 };
97 * Insmod parameters
98 */
99
100I2C_CLIENT_INSMOD_8(lm90, adm1032, lm99, lm86, max6657, adt7461, max6680,
101 max6646);
102 97
103/* 98/*
104 * The LM90 registers 99 * The LM90 registers
diff --git a/drivers/hwmon/thmc50.c b/drivers/hwmon/thmc50.c
index 866d66507596..7dfb4dec4c5f 100644
--- a/drivers/hwmon/thmc50.c
+++ b/drivers/hwmon/thmc50.c
@@ -35,7 +35,7 @@ MODULE_LICENSE("GPL");
35static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; 35static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
36 36
37/* Insmod parameters */ 37/* Insmod parameters */
38I2C_CLIENT_INSMOD_2(thmc50, adm1022); 38enum chips { thmc50, adm1022 };
39 39
40static unsigned short adm1022_temp3[16]; 40static unsigned short adm1022_temp3[16];
41static unsigned int adm1022_temp3_num; 41static unsigned int adm1022_temp3_num;
diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
index ed086491cc9a..a13b30e8d8d8 100644
--- a/drivers/hwmon/tmp401.c
+++ b/drivers/hwmon/tmp401.c
@@ -42,8 +42,7 @@
42/* Addresses to scan */ 42/* Addresses to scan */
43static const unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END }; 43static const unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END };
44 44
45/* Insmod parameters */ 45enum chips { tmp401, tmp411 };
46I2C_CLIENT_INSMOD_2(tmp401, tmp411);
47 46
48/* 47/*
49 * The TMP401 registers, note some registers have different addresses for 48 * The TMP401 registers, note some registers have different addresses for
diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
index 018ad028c179..4f7c051e2d7b 100644
--- a/drivers/hwmon/tmp421.c
+++ b/drivers/hwmon/tmp421.c
@@ -39,8 +39,7 @@
39static unsigned short normal_i2c[] = { 0x2a, 0x4c, 0x4d, 0x4e, 0x4f, 39static unsigned short normal_i2c[] = { 0x2a, 0x4c, 0x4d, 0x4e, 0x4f,
40 I2C_CLIENT_END }; 40 I2C_CLIENT_END };
41 41
42/* Insmod parameters */ 42enum chips { tmp421, tmp422, tmp423 };
43I2C_CLIENT_INSMOD_3(tmp421, tmp422, tmp423);
44 43
45/* The TMP421 registers */ 44/* The TMP421 registers */
46#define TMP421_CONFIG_REG_1 0x09 45#define TMP421_CONFIG_REG_1 0x09
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index bfaa888f6e47..05f9225b6f94 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -56,9 +56,10 @@
56/* Addresses to scan */ 56/* Addresses to scan */
57static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 57static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
58 0x2e, 0x2f, I2C_CLIENT_END }; 58 0x2e, 0x2f, I2C_CLIENT_END };
59/* Insmod parameters */
60I2C_CLIENT_INSMOD_4(w83781d, w83782d, w83783s, as99127f);
61 59
60enum chips { w83781d, w83782d, w83783s, as99127f };
61
62/* Insmod parameters */
62static unsigned short force_subclients[4]; 63static unsigned short force_subclients[4];
63module_param_array(force_subclients, short, NULL, 0); 64module_param_array(force_subclients, short, NULL, 0);
64MODULE_PARM_DESC(force_subclients, "List of subclient addresses: " 65MODULE_PARM_DESC(force_subclients, "List of subclient addresses: "
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 7178b27146ed..cc6e1508ae90 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -602,29 +602,5 @@ union i2c_smbus_data {
602 module_param_array(var, short, &var##_num, 0); \ 602 module_param_array(var, short, &var##_num, 0); \
603 MODULE_PARM_DESC(var, desc) 603 MODULE_PARM_DESC(var, desc)
604 604
605/* These are the ones you want to use in your own drivers. Pick the one
606 which matches the number of devices the driver differenciates between. */
607#define I2C_CLIENT_INSMOD_2(chip1, chip2) \
608enum chips { any_chip, chip1, chip2 }
609
610#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
611enum chips { any_chip, chip1, chip2, chip3 }
612
613#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
614enum chips { any_chip, chip1, chip2, chip3, chip4 }
615
616#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \
617enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }
618
619#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \
620enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }
621
622#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
623enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
624 chip7 }
625
626#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \
627enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
628 chip7, chip8 }
629#endif /* __KERNEL__ */ 605#endif /* __KERNEL__ */
630#endif /* _LINUX_I2C_H */ 606#endif /* _LINUX_I2C_H */