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

hwmon: (ad7418) Avoid forward declaration

Move ad7418_driver to proper place to avoid forward declaration.
Also move ad7418_init_client() close to ad7418_probe().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Axel Lin and committed by
Guenter Roeck
991763a9 045c1391

+34 -38
+34 -38
drivers/hwmon/ad7418.c
··· 55 55 u16 in[4]; 56 56 }; 57 57 58 - static int ad7418_probe(struct i2c_client *client, 59 - const struct i2c_device_id *id); 60 - static int ad7418_remove(struct i2c_client *client); 61 - 62 - static const struct i2c_device_id ad7418_id[] = { 63 - { "ad7416", ad7416 }, 64 - { "ad7417", ad7417 }, 65 - { "ad7418", ad7418 }, 66 - { } 67 - }; 68 - MODULE_DEVICE_TABLE(i2c, ad7418_id); 69 - 70 - static struct i2c_driver ad7418_driver = { 71 - .driver = { 72 - .name = "ad7418", 73 - }, 74 - .probe = ad7418_probe, 75 - .remove = ad7418_remove, 76 - .id_table = ad7418_id, 77 - }; 78 - 79 - static void ad7418_init_client(struct i2c_client *client) 80 - { 81 - struct ad7418_data *data = i2c_get_clientdata(client); 82 - 83 - int reg = i2c_smbus_read_byte_data(client, AD7418_REG_CONF); 84 - if (reg < 0) { 85 - dev_err(&client->dev, "cannot read configuration register\n"); 86 - } else { 87 - dev_info(&client->dev, "configuring for mode 1\n"); 88 - i2c_smbus_write_byte_data(client, AD7418_REG_CONF, reg & 0xfe); 89 - 90 - if (data->type == ad7417 || data->type == ad7418) 91 - i2c_smbus_write_byte_data(client, 92 - AD7418_REG_CONF2, 0x00); 93 - } 94 - } 95 - 96 58 static struct ad7418_data *ad7418_update_device(struct device *dev) 97 59 { 98 60 struct i2c_client *client = to_i2c_client(dev); ··· 181 219 NULL 182 220 }; 183 221 222 + static void ad7418_init_client(struct i2c_client *client) 223 + { 224 + struct ad7418_data *data = i2c_get_clientdata(client); 225 + 226 + int reg = i2c_smbus_read_byte_data(client, AD7418_REG_CONF); 227 + if (reg < 0) { 228 + dev_err(&client->dev, "cannot read configuration register\n"); 229 + } else { 230 + dev_info(&client->dev, "configuring for mode 1\n"); 231 + i2c_smbus_write_byte_data(client, AD7418_REG_CONF, reg & 0xfe); 232 + 233 + if (data->type == ad7417 || data->type == ad7418) 234 + i2c_smbus_write_byte_data(client, 235 + AD7418_REG_CONF2, 0x00); 236 + } 237 + } 238 + 184 239 static int ad7418_probe(struct i2c_client *client, 185 240 const struct i2c_device_id *id) 186 241 { ··· 266 287 sysfs_remove_group(&client->dev.kobj, &data->attrs); 267 288 return 0; 268 289 } 290 + 291 + static const struct i2c_device_id ad7418_id[] = { 292 + { "ad7416", ad7416 }, 293 + { "ad7417", ad7417 }, 294 + { "ad7418", ad7418 }, 295 + { } 296 + }; 297 + MODULE_DEVICE_TABLE(i2c, ad7418_id); 298 + 299 + static struct i2c_driver ad7418_driver = { 300 + .driver = { 301 + .name = "ad7418", 302 + }, 303 + .probe = ad7418_probe, 304 + .remove = ad7418_remove, 305 + .id_table = ad7418_id, 306 + }; 269 307 270 308 module_i2c_driver(ad7418_driver); 271 309