Skip to content

Commit

Permalink
regulator: da9211: Set of_match_table and export device table
Browse files Browse the repository at this point in the history
Also move da9211_i2c_id and da9211_dt_ids close to the user for better
readability.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Axel Lin authored and Mark Brown committed Sep 5, 2014
1 parent 67c866c commit 6a52f56
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions drivers/regulator/da9211-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,20 +388,6 @@ static int da9211_regulator_init(struct da9211 *chip)
return 0;
}

static const struct i2c_device_id da9211_i2c_id[] = {
{"da9211", DA9211},
{"da9213", DA9213},
{},
};

#ifdef CONFIG_OF
static const struct of_device_id da9211_dt_ids[] = {
{ .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] },
{ .compatible = "dlg,da9213", .data = &da9211_i2c_id[1] },
{},
};
#endif

/*
* I2C driver interface functions
*/
Expand Down Expand Up @@ -479,12 +465,27 @@ static int da9211_i2c_probe(struct i2c_client *i2c,
return ret;
}

static const struct i2c_device_id da9211_i2c_id[] = {
{"da9211", DA9211},
{"da9213", DA9213},
{},
};
MODULE_DEVICE_TABLE(i2c, da9211_i2c_id);

#ifdef CONFIG_OF
static const struct of_device_id da9211_dt_ids[] = {
{ .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] },
{ .compatible = "dlg,da9213", .data = &da9211_i2c_id[1] },
{},
};
MODULE_DEVICE_TABLE(of, da9211_dt_ids);
#endif

static struct i2c_driver da9211_regulator_driver = {
.driver = {
.name = "da9211",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(da9211_dt_ids),
},
.probe = da9211_i2c_probe,
.id_table = da9211_i2c_id,
Expand Down

0 comments on commit 6a52f56

Please sign in to comment.