aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/leds/leds-lp8501.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--drivers/leds/leds-lp8501.c81
1 files changed, 4 insertions, 77 deletions
diff --git a/drivers/leds/leds-lp8501.c b/drivers/leds/leds-lp8501.c
index 9eaad0c2148f..d3c718bb8275 100644
--- a/drivers/leds/leds-lp8501.c
+++ b/drivers/leds/leds-lp8501.c
@@ -305,87 +305,14 @@ static struct lp55xx_device_config lp8501_cfg = {
.run_engine = lp8501_run_engine,
};
-static int lp8501_probe(struct i2c_client *client)
-{
- const struct i2c_device_id *id = i2c_client_get_device_id(client);
- int ret;
- struct lp55xx_chip *chip;
- struct lp55xx_led *led;
- struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev);
- struct device_node *np = dev_of_node(&client->dev);
-
- chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
- if (!chip)
- return -ENOMEM;
-
- chip->cfg = &lp8501_cfg;
-
- if (!pdata) {
- if (np) {
- pdata = lp55xx_of_populate_pdata(&client->dev, np,
- chip);
- if (IS_ERR(pdata))
- return PTR_ERR(pdata);
- } else {
- dev_err(&client->dev, "no platform data\n");
- return -EINVAL;
- }
- }
-
- led = devm_kcalloc(&client->dev,
- pdata->num_channels, sizeof(*led), GFP_KERNEL);
- if (!led)
- return -ENOMEM;
-
- chip->cl = client;
- chip->pdata = pdata;
-
- mutex_init(&chip->lock);
-
- i2c_set_clientdata(client, led);
-
- ret = lp55xx_init_device(chip);
- if (ret)
- goto err_init;
-
- dev_info(&client->dev, "%s Programmable led chip found\n", id->name);
-
- ret = lp55xx_register_leds(led, chip);
- if (ret)
- goto err_out;
-
- ret = lp55xx_register_sysfs(chip);
- if (ret) {
- dev_err(&client->dev, "registering sysfs failed\n");
- goto err_out;
- }
-
- return 0;
-
-err_out:
- lp55xx_deinit_device(chip);
-err_init:
- return ret;
-}
-
-static void lp8501_remove(struct i2c_client *client)
-{
- struct lp55xx_led *led = i2c_get_clientdata(client);
- struct lp55xx_chip *chip = led->chip;
-
- lp55xx_stop_all_engine(chip);
- lp55xx_unregister_sysfs(chip);
- lp55xx_deinit_device(chip);
-}
-
static const struct i2c_device_id lp8501_id[] = {
- { "lp8501" },
+ { "lp8501", .driver_data = (kernel_ulong_t)&lp8501_cfg, },
{ }
};
MODULE_DEVICE_TABLE(i2c, lp8501_id);
static const struct of_device_id of_lp8501_leds_match[] = {
- { .compatible = "ti,lp8501", },
+ { .compatible = "ti,lp8501", .data = &lp8501_cfg, },
{},
};
@@ -396,8 +323,8 @@ static struct i2c_driver lp8501_driver = {
.name = "lp8501",
.of_match_table = of_lp8501_leds_match,
},
- .probe = lp8501_probe,
- .remove = lp8501_remove,
+ .probe = lp55xx_probe,
+ .remove = lp55xx_remove,
.id_table = lp8501_id,
};