Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i2c: Get rid of struct i2c_client_address_data

Struct i2c_client_address_data only contains one field at this point,
which makes its usefulness questionable. Get rid of it and pass simple
address lists around instead.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Wolfram Sang <w.sang@pengutronix.de>

+66 -89
+1 -1
Documentation/i2c/writing-clients
··· 44 44 /* if device autodetection is needed: */ 45 45 .class = I2C_CLASS_SOMETHING, 46 46 .detect = foo_detect, 47 - .address_data = &addr_data, 47 + .address_list = normal_i2c, 48 48 49 49 .shutdown = foo_shutdown, /* optional */ 50 50 .suspend = foo_suspend, /* optional */
+1 -1
drivers/hwmon/adm1021.c
··· 130 130 .remove = adm1021_remove, 131 131 .id_table = adm1021_id, 132 132 .detect = adm1021_detect, 133 - .address_data = &addr_data, 133 + .address_list = normal_i2c, 134 134 }; 135 135 136 136 static ssize_t show_temp(struct device *dev,
+1 -1
drivers/hwmon/adm1025.c
··· 137 137 .remove = adm1025_remove, 138 138 .id_table = adm1025_id, 139 139 .detect = adm1025_detect, 140 - .address_data = &addr_data, 140 + .address_list = normal_i2c, 141 141 }; 142 142 143 143 /*
+1 -1
drivers/hwmon/adm1026.c
··· 319 319 .remove = adm1026_remove, 320 320 .id_table = adm1026_id, 321 321 .detect = adm1026_detect, 322 - .address_data = &addr_data, 322 + .address_list = normal_i2c, 323 323 }; 324 324 325 325 static int adm1026_read_value(struct i2c_client *client, u8 reg)
+1 -1
drivers/hwmon/adm1029.c
··· 142 142 .remove = adm1029_remove, 143 143 .id_table = adm1029_id, 144 144 .detect = adm1029_detect, 145 - .address_data = &addr_data, 145 + .address_list = normal_i2c, 146 146 }; 147 147 148 148 /*
+1 -1
drivers/hwmon/adm1031.c
··· 125 125 .remove = adm1031_remove, 126 126 .id_table = adm1031_id, 127 127 .detect = adm1031_detect, 128 - .address_data = &addr_data, 128 + .address_list = normal_i2c, 129 129 }; 130 130 131 131 static inline u8 adm1031_read_value(struct i2c_client *client, u8 reg)
+1 -1
drivers/hwmon/adm9240.c
··· 156 156 .remove = adm9240_remove, 157 157 .id_table = adm9240_id, 158 158 .detect = adm9240_detect, 159 - .address_data = &addr_data, 159 + .address_list = normal_i2c, 160 160 }; 161 161 162 162 /* per client data */
+1 -1
drivers/hwmon/ads7828.c
··· 183 183 .remove = ads7828_remove, 184 184 .id_table = ads7828_id, 185 185 .detect = ads7828_detect, 186 - .address_data = &addr_data, 186 + .address_list = normal_i2c, 187 187 }; 188 188 189 189 /* Return 0 if detection is successful, -ENODEV otherwise */
+1 -1
drivers/hwmon/adt7462.c
··· 256 256 .remove = adt7462_remove, 257 257 .id_table = adt7462_id, 258 258 .detect = adt7462_detect, 259 - .address_data = &addr_data, 259 + .address_list = normal_i2c, 260 260 }; 261 261 262 262 /*
+1 -1
drivers/hwmon/adt7470.c
··· 196 196 .remove = adt7470_remove, 197 197 .id_table = adt7470_id, 198 198 .detect = adt7470_detect, 199 - .address_data = &addr_data, 199 + .address_list = normal_i2c, 200 200 }; 201 201 202 202 /*
+1 -1
drivers/hwmon/adt7473.c
··· 184 184 .remove = adt7473_remove, 185 185 .id_table = adt7473_id, 186 186 .detect = adt7473_detect, 187 - .address_data = &addr_data, 187 + .address_list = normal_i2c, 188 188 }; 189 189 190 190 /*
+1 -1
drivers/hwmon/adt7475.c
··· 1412 1412 .remove = adt7475_remove, 1413 1413 .id_table = adt7475_id, 1414 1414 .detect = adt7475_detect, 1415 - .address_data = &addr_data, 1415 + .address_list = normal_i2c, 1416 1416 }; 1417 1417 1418 1418 static void adt7475_read_hystersis(struct i2c_client *client)
+1 -1
drivers/hwmon/asb100.c
··· 230 230 .remove = asb100_remove, 231 231 .id_table = asb100_id, 232 232 .detect = asb100_detect, 233 - .address_data = &addr_data, 233 + .address_list = normal_i2c, 234 234 }; 235 235 236 236 /* 7 Voltages */
+1 -1
drivers/hwmon/atxp1.c
··· 67 67 .remove = atxp1_remove, 68 68 .id_table = atxp1_id, 69 69 .detect = atxp1_detect, 70 - .address_data = &addr_data, 70 + .address_list = normal_i2c, 71 71 }; 72 72 73 73 struct atxp1_data {
+1 -1
drivers/hwmon/dme1737.c
··· 2318 2318 .remove = dme1737_i2c_remove, 2319 2319 .id_table = dme1737_id, 2320 2320 .detect = dme1737_i2c_detect, 2321 - .address_data = &addr_data, 2321 + .address_list = normal_i2c, 2322 2322 }; 2323 2323 2324 2324 /* ---------------------------------------------------------------------
+1 -1
drivers/hwmon/ds1621.c
··· 321 321 .remove = ds1621_remove, 322 322 .id_table = ds1621_id, 323 323 .detect = ds1621_detect, 324 - .address_data = &addr_data, 324 + .address_list = normal_i2c, 325 325 }; 326 326 327 327 static int __init ds1621_init(void)
+1 -1
drivers/hwmon/f75375s.c
··· 135 135 .remove = f75375_remove, 136 136 .id_table = f75375_id, 137 137 .detect = f75375_detect, 138 - .address_data = &addr_data, 138 + .address_list = normal_i2c, 139 139 }; 140 140 141 141 static inline int f75375_read8(struct i2c_client *client, u8 reg)
+1 -1
drivers/hwmon/fschmd.c
··· 251 251 .remove = fschmd_remove, 252 252 .id_table = fschmd_id, 253 253 .detect = fschmd_detect, 254 - .address_data = &addr_data, 254 + .address_list = normal_i2c, 255 255 }; 256 256 257 257 /*
+1 -1
drivers/hwmon/gl518sm.c
··· 162 162 .remove = gl518_remove, 163 163 .id_table = gl518_id, 164 164 .detect = gl518_detect, 165 - .address_data = &addr_data, 165 + .address_list = normal_i2c, 166 166 }; 167 167 168 168 /*
+1 -1
drivers/hwmon/gl520sm.c
··· 104 104 .remove = gl520_remove, 105 105 .id_table = gl520_id, 106 106 .detect = gl520_detect, 107 - .address_data = &addr_data, 107 + .address_list = normal_i2c, 108 108 }; 109 109 110 110 /* Client data */
+1 -1
drivers/hwmon/lm63.c
··· 156 156 .remove = lm63_remove, 157 157 .id_table = lm63_id, 158 158 .detect = lm63_detect, 159 - .address_data = &addr_data, 159 + .address_list = normal_i2c, 160 160 }; 161 161 162 162 /*
+1 -1
drivers/hwmon/lm73.c
··· 182 182 .remove = lm73_remove, 183 183 .id_table = lm73_ids, 184 184 .detect = lm73_detect, 185 - .address_data = &addr_data, 185 + .address_list = normal_i2c, 186 186 }; 187 187 188 188 /* module glue */
+1 -1
drivers/hwmon/lm75.c
··· 295 295 .remove = lm75_remove, 296 296 .id_table = lm75_ids, 297 297 .detect = lm75_detect, 298 - .address_data = &addr_data, 298 + .address_list = normal_i2c, 299 299 }; 300 300 301 301 /*-----------------------------------------------------------------------*/
+1 -1
drivers/hwmon/lm77.c
··· 91 91 .remove = lm77_remove, 92 92 .id_table = lm77_id, 93 93 .detect = lm77_detect, 94 - .address_data = &addr_data, 94 + .address_list = normal_i2c, 95 95 }; 96 96 97 97 /* straight from the datasheet */
+1 -1
drivers/hwmon/lm78.c
··· 173 173 .remove = lm78_i2c_remove, 174 174 .id_table = lm78_i2c_id, 175 175 .detect = lm78_i2c_detect, 176 - .address_data = &addr_data, 176 + .address_list = normal_i2c, 177 177 }; 178 178 179 179 static struct platform_driver lm78_isa_driver = {
+1 -1
drivers/hwmon/lm80.c
··· 159 159 .remove = lm80_remove, 160 160 .id_table = lm80_id, 161 161 .detect = lm80_detect, 162 - .address_data = &addr_data, 162 + .address_list = normal_i2c, 163 163 }; 164 164 165 165 /*
+1 -1
drivers/hwmon/lm83.c
··· 145 145 .remove = lm83_remove, 146 146 .id_table = lm83_id, 147 147 .detect = lm83_detect, 148 - .address_data = &addr_data, 148 + .address_list = normal_i2c, 149 149 }; 150 150 151 151 /*
+1 -1
drivers/hwmon/lm85.c
··· 356 356 .remove = lm85_remove, 357 357 .id_table = lm85_id, 358 358 .detect = lm85_detect, 359 - .address_data = &addr_data, 359 + .address_list = normal_i2c, 360 360 }; 361 361 362 362
+1 -1
drivers/hwmon/lm87.c
··· 184 184 .remove = lm87_remove, 185 185 .id_table = lm87_id, 186 186 .detect = lm87_detect, 187 - .address_data = &addr_data, 187 + .address_list = normal_i2c, 188 188 }; 189 189 190 190 /*
+1 -1
drivers/hwmon/lm90.c
··· 191 191 .remove = lm90_remove, 192 192 .id_table = lm90_id, 193 193 .detect = lm90_detect, 194 - .address_data = &addr_data, 194 + .address_list = normal_i2c, 195 195 }; 196 196 197 197 /*
+1 -1
drivers/hwmon/lm92.c
··· 416 416 .remove = lm92_remove, 417 417 .id_table = lm92_id, 418 418 .detect = lm92_detect, 419 - .address_data = &addr_data, 419 + .address_list = normal_i2c, 420 420 }; 421 421 422 422 static int __init sensors_lm92_init(void)
+1 -1
drivers/hwmon/lm93.c
··· 2616 2616 .remove = lm93_remove, 2617 2617 .id_table = lm93_id, 2618 2618 .detect = lm93_detect, 2619 - .address_data = &addr_data, 2619 + .address_list = normal_i2c, 2620 2620 }; 2621 2621 2622 2622 static int __init lm93_init(void)
+1 -1
drivers/hwmon/lm95241.c
··· 460 460 .remove = lm95241_remove, 461 461 .id_table = lm95241_id, 462 462 .detect = lm95241_detect, 463 - .address_data = &addr_data, 463 + .address_list = normal_i2c, 464 464 }; 465 465 466 466 static int __init sensors_lm95241_init(void)
+1 -1
drivers/hwmon/max1619.c
··· 113 113 .remove = max1619_remove, 114 114 .id_table = max1619_id, 115 115 .detect = max1619_detect, 116 - .address_data = &addr_data, 116 + .address_list = normal_i2c, 117 117 }; 118 118 119 119 /*
+1 -1
drivers/hwmon/max6650.c
··· 141 141 .remove = max6650_remove, 142 142 .id_table = max6650_id, 143 143 .detect = max6650_detect, 144 - .address_data = &addr_data, 144 + .address_list = normal_i2c, 145 145 }; 146 146 147 147 /*
+1 -1
drivers/hwmon/pcf8591.c
··· 299 299 300 300 .class = I2C_CLASS_HWMON, /* Nearest choice */ 301 301 .detect = pcf8591_detect, 302 - .address_data = &addr_data, 302 + .address_list = normal_i2c, 303 303 }; 304 304 305 305 static int __init pcf8591_init(void)
+1 -1
drivers/hwmon/smsc47m192.c
··· 135 135 .remove = smsc47m192_remove, 136 136 .id_table = smsc47m192_id, 137 137 .detect = smsc47m192_detect, 138 - .address_data = &addr_data, 138 + .address_list = normal_i2c, 139 139 }; 140 140 141 141 /* Voltages */
+1 -1
drivers/hwmon/thmc50.c
··· 108 108 .remove = thmc50_remove, 109 109 .id_table = thmc50_id, 110 110 .detect = thmc50_detect, 111 - .address_data = &addr_data, 111 + .address_list = normal_i2c, 112 112 }; 113 113 114 114 static ssize_t show_analog_out(struct device *dev,
+1 -1
drivers/hwmon/tmp401.c
··· 123 123 .remove = tmp401_remove, 124 124 .id_table = tmp401_id, 125 125 .detect = tmp401_detect, 126 - .address_data = &addr_data, 126 + .address_list = normal_i2c, 127 127 }; 128 128 129 129 /*
+1 -1
drivers/hwmon/tmp421.c
··· 322 322 .remove = tmp421_remove, 323 323 .id_table = tmp421_id, 324 324 .detect = tmp421_detect, 325 - .address_data = &addr_data, 325 + .address_list = normal_i2c, 326 326 }; 327 327 328 328 static int __init tmp421_init(void)
+1 -1
drivers/hwmon/w83781d.c
··· 1536 1536 .remove = w83781d_remove, 1537 1537 .id_table = w83781d_ids, 1538 1538 .detect = w83781d_detect, 1539 - .address_data = &addr_data, 1539 + .address_list = normal_i2c, 1540 1540 }; 1541 1541 1542 1542 /*
+1 -1
drivers/hwmon/w83791d.c
··· 355 355 .remove = w83791d_remove, 356 356 .id_table = w83791d_id, 357 357 .detect = w83791d_detect, 358 - .address_data = &addr_data, 358 + .address_list = normal_i2c, 359 359 }; 360 360 361 361 /* following are the sysfs callback functions */
+1 -1
drivers/hwmon/w83792d.c
··· 328 328 .remove = w83792d_remove, 329 329 .id_table = w83792d_id, 330 330 .detect = w83792d_detect, 331 - .address_data = &addr_data, 331 + .address_list = normal_i2c, 332 332 }; 333 333 334 334 static inline long in_count_from_reg(int nr, struct w83792d_data *data)
+1 -1
drivers/hwmon/w83793.c
··· 252 252 .remove = w83793_remove, 253 253 .id_table = w83793_id, 254 254 .detect = w83793_detect, 255 - .address_data = &addr_data, 255 + .address_list = normal_i2c, 256 256 }; 257 257 258 258 static ssize_t
+1 -1
drivers/hwmon/w83l785ts.c
··· 108 108 .remove = w83l785ts_remove, 109 109 .id_table = w83l785ts_id, 110 110 .detect = w83l785ts_detect, 111 - .address_data = &addr_data, 111 + .address_list = normal_i2c, 112 112 }; 113 113 114 114 /*
+1 -1
drivers/hwmon/w83l786ng.c
··· 168 168 .remove = w83l786ng_remove, 169 169 .id_table = w83l786ng_id, 170 170 .detect = w83l786ng_detect, 171 - .address_data = &addr_data, 171 + .address_list = normal_i2c, 172 172 }; 173 173 174 174 static u8
+7 -8
drivers/i2c/i2c-core.c
··· 1214 1214 1215 1215 static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver) 1216 1216 { 1217 - const struct i2c_client_address_data *address_data; 1217 + const unsigned short *address_list; 1218 1218 struct i2c_client *temp_client; 1219 1219 int i, err = 0; 1220 1220 int adap_id = i2c_adapter_id(adapter); 1221 1221 1222 - address_data = driver->address_data; 1223 - if (!driver->detect || !address_data) 1222 + address_list = driver->address_list; 1223 + if (!driver->detect || !address_list) 1224 1224 return 0; 1225 1225 1226 1226 /* Set up a temporary client to help detect callback */ ··· 1235 1235 1236 1236 /* Stop here if we can't use SMBUS_QUICK */ 1237 1237 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) { 1238 - if (address_data->normal_i2c[0] == I2C_CLIENT_END) 1238 + if (address_list[0] == I2C_CLIENT_END) 1239 1239 goto exit_free; 1240 1240 1241 1241 dev_warn(&adapter->dev, "SMBus Quick command not supported, " ··· 1244 1244 goto exit_free; 1245 1245 } 1246 1246 1247 - for (i = 0; address_data->normal_i2c[i] != I2C_CLIENT_END; i += 1) { 1247 + for (i = 0; address_list[i] != I2C_CLIENT_END; i += 1) { 1248 1248 dev_dbg(&adapter->dev, "found normal entry for adapter %d, " 1249 - "addr 0x%02x\n", adap_id, 1250 - address_data->normal_i2c[i]); 1251 - temp_client->addr = address_data->normal_i2c[i]; 1249 + "addr 0x%02x\n", adap_id, address_list[i]); 1250 + temp_client->addr = address_list[i]; 1252 1251 err = i2c_detect_address(temp_client, driver); 1253 1252 if (err) 1254 1253 goto exit_free;
+1 -1
drivers/misc/eeprom/eeprom.c
··· 232 232 233 233 .class = I2C_CLASS_DDC | I2C_CLASS_SPD, 234 234 .detect = eeprom_detect, 235 - .address_data = &addr_data, 235 + .address_list = normal_i2c, 236 236 }; 237 237 238 238 static int __init eeprom_init(void)
+1 -1
drivers/misc/ics932s401.c
··· 125 125 .remove = ics932s401_remove, 126 126 .id_table = ics932s401_id, 127 127 .detect = ics932s401_detect, 128 - .address_data = &addr_data, 128 + .address_list = normal_i2c, 129 129 }; 130 130 131 131 static struct ics932s401_data *ics932s401_update_device(struct device *dev)
+11 -33
include/linux/i2c.h
··· 110 110 * @driver: Device driver model driver 111 111 * @id_table: List of I2C devices supported by this driver 112 112 * @detect: Callback for device detection 113 - * @address_data: The I2C addresses to probe (for detect) 113 + * @address_list: The I2C addresses to probe (for detect) 114 114 * @clients: List of detected clients we created (for i2c-core use only) 115 115 * 116 116 * The driver.owner field should be set to the module owner of this driver. ··· 162 162 163 163 /* Device detection callback for automatic device creation */ 164 164 int (*detect)(struct i2c_client *, struct i2c_board_info *); 165 - const struct i2c_client_address_data *address_data; 165 + const unsigned short *address_list; 166 166 struct list_head clients; 167 167 }; 168 168 #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) ··· 391 391 #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ 392 392 #define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ 393 393 394 - /* i2c_client_address_data is the struct for holding default client 395 - * addresses for a driver and for the parameters supplied on the 396 - * command line 397 - */ 398 - struct i2c_client_address_data { 399 - const unsigned short *normal_i2c; 400 - }; 401 - 402 394 /* Internal numbers to terminate lists */ 403 395 #define I2C_CLIENT_END 0xfffeU 404 396 ··· 602 610 module_param_array(var, short, &var##_num, 0); \ 603 611 MODULE_PARM_DESC(var, desc) 604 612 605 - #define I2C_CLIENT_INSMOD_COMMON \ 606 - static const struct i2c_client_address_data addr_data = { \ 607 - .normal_i2c = normal_i2c, \ 608 - } 609 - 610 613 /* These are the ones you want to use in your own drivers. Pick the one 611 614 which matches the number of devices the driver differenciates between. */ 612 - #define I2C_CLIENT_INSMOD \ 613 - I2C_CLIENT_INSMOD_COMMON 615 + #define I2C_CLIENT_INSMOD 614 616 615 617 #define I2C_CLIENT_INSMOD_1(chip1) \ 616 - enum chips { any_chip, chip1 }; \ 617 - I2C_CLIENT_INSMOD_COMMON 618 + enum chips { any_chip, chip1 } 618 619 619 620 #define I2C_CLIENT_INSMOD_2(chip1, chip2) \ 620 - enum chips { any_chip, chip1, chip2 }; \ 621 - I2C_CLIENT_INSMOD_COMMON 621 + enum chips { any_chip, chip1, chip2 } 622 622 623 623 #define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ 624 - enum chips { any_chip, chip1, chip2, chip3 }; \ 625 - I2C_CLIENT_INSMOD_COMMON 624 + enum chips { any_chip, chip1, chip2, chip3 } 626 625 627 626 #define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \ 628 - enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ 629 - I2C_CLIENT_INSMOD_COMMON 627 + enum chips { any_chip, chip1, chip2, chip3, chip4 } 630 628 631 629 #define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \ 632 - enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ 633 - I2C_CLIENT_INSMOD_COMMON 630 + enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 } 634 631 635 632 #define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \ 636 - enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ 637 - I2C_CLIENT_INSMOD_COMMON 633 + enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 } 638 634 639 635 #define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \ 640 636 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ 641 - chip7 }; \ 642 - I2C_CLIENT_INSMOD_COMMON 637 + chip7 } 643 638 644 639 #define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \ 645 640 enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ 646 - chip7, chip8 }; \ 647 - I2C_CLIENT_INSMOD_COMMON 641 + chip7, chip8 } 648 642 #endif /* __KERNEL__ */ 649 643 #endif /* _LINUX_I2C_H */