diff options
author | Daniel Mack <zonque@gmail.com> | 2013-08-02 04:19:15 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-08-02 06:22:54 -0400 |
commit | 4a678f037475edd362a18fc3c4616d6222be3042 (patch) | |
tree | e47b9bbe8f3ddffd1099b93f35be8d6ff80a8399 /drivers/regulator/max8660.c | |
parent | dff91d0b721bf8f036c1071a8f16a7effaa87514 (diff) |
regulators: max8660: use i2c_id->driver_data rather than ->name
Introduce an enum and denote the device type via struct i2c_id's
driver_data field rather than comparing strings.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/max8660.c')
-rw-r--r-- | drivers/regulator/max8660.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c index bfd41084c7df..5a734fc9618c 100644 --- a/drivers/regulator/max8660.c +++ b/drivers/regulator/max8660.c | |||
@@ -305,6 +305,11 @@ static const struct regulator_desc max8660_reg[] = { | |||
305 | }, | 305 | }, |
306 | }; | 306 | }; |
307 | 307 | ||
308 | enum { | ||
309 | MAX8660 = 0, | ||
310 | MAX8661 = 1, | ||
311 | }; | ||
312 | |||
308 | static int max8660_probe(struct i2c_client *client, | 313 | static int max8660_probe(struct i2c_client *client, |
309 | const struct i2c_device_id *i2c_id) | 314 | const struct i2c_device_id *i2c_id) |
310 | { | 315 | { |
@@ -313,6 +318,7 @@ static int max8660_probe(struct i2c_client *client, | |||
313 | struct regulator_config config = { }; | 318 | struct regulator_config config = { }; |
314 | struct max8660 *max8660; | 319 | struct max8660 *max8660; |
315 | int boot_on, i, id, ret = -EINVAL; | 320 | int boot_on, i, id, ret = -EINVAL; |
321 | unsigned int type; | ||
316 | 322 | ||
317 | if (pdata->num_subdevs > MAX8660_V_END) { | 323 | if (pdata->num_subdevs > MAX8660_V_END) { |
318 | dev_err(&client->dev, "Too many regulators found!\n"); | 324 | dev_err(&client->dev, "Too many regulators found!\n"); |
@@ -327,6 +333,7 @@ static int max8660_probe(struct i2c_client *client, | |||
327 | 333 | ||
328 | max8660->client = client; | 334 | max8660->client = client; |
329 | rdev = max8660->rdev; | 335 | rdev = max8660->rdev; |
336 | type = i2c_id->driver_data; | ||
330 | 337 | ||
331 | if (pdata->en34_is_high) { | 338 | if (pdata->en34_is_high) { |
332 | /* Simulate always on */ | 339 | /* Simulate always on */ |
@@ -376,7 +383,7 @@ static int max8660_probe(struct i2c_client *client, | |||
376 | break; | 383 | break; |
377 | 384 | ||
378 | case MAX8660_V7: | 385 | case MAX8660_V7: |
379 | if (!strcmp(i2c_id->name, "max8661")) { | 386 | if (type == MAX8661) { |
380 | dev_err(&client->dev, "Regulator not on this chip!\n"); | 387 | dev_err(&client->dev, "Regulator not on this chip!\n"); |
381 | goto err_out; | 388 | goto err_out; |
382 | } | 389 | } |
@@ -431,8 +438,8 @@ static int max8660_remove(struct i2c_client *client) | |||
431 | } | 438 | } |
432 | 439 | ||
433 | static const struct i2c_device_id max8660_id[] = { | 440 | static const struct i2c_device_id max8660_id[] = { |
434 | { "max8660", 0 }, | 441 | { .name = "max8660", .driver_data = MAX8660 }, |
435 | { "max8661", 0 }, | 442 | { .name = "max8661", .driver_data = MAX8661 }, |
436 | { } | 443 | { } |
437 | }; | 444 | }; |
438 | MODULE_DEVICE_TABLE(i2c, max8660_id); | 445 | MODULE_DEVICE_TABLE(i2c, max8660_id); |