|
@@ -543,7 +543,8 @@ void lp55xx_unregister_sysfs(struct lp55xx_chip *chip)
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(lp55xx_unregister_sysfs);
|
|
|
|
|
|
-int lp55xx_of_populate_pdata(struct device *dev, struct device_node *np)
|
|
|
+struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev,
|
|
|
+ struct device_node *np)
|
|
|
{
|
|
|
struct device_node *child;
|
|
|
struct lp55xx_platform_data *pdata;
|
|
@@ -553,17 +554,17 @@ int lp55xx_of_populate_pdata(struct device *dev, struct device_node *np)
|
|
|
|
|
|
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
|
|
|
if (!pdata)
|
|
|
- return -ENOMEM;
|
|
|
+ return ERR_PTR(-ENOMEM);
|
|
|
|
|
|
num_channels = of_get_child_count(np);
|
|
|
if (num_channels == 0) {
|
|
|
dev_err(dev, "no LED channels\n");
|
|
|
- return -EINVAL;
|
|
|
+ return ERR_PTR(-EINVAL);
|
|
|
}
|
|
|
|
|
|
cfg = devm_kzalloc(dev, sizeof(*cfg) * num_channels, GFP_KERNEL);
|
|
|
if (!cfg)
|
|
|
- return -ENOMEM;
|
|
|
+ return ERR_PTR(-ENOMEM);
|
|
|
|
|
|
pdata->led_config = &cfg[0];
|
|
|
pdata->num_channels = num_channels;
|
|
@@ -588,9 +589,7 @@ int lp55xx_of_populate_pdata(struct device *dev, struct device_node *np)
|
|
|
/* LP8501 specific */
|
|
|
of_property_read_u8(np, "pwr-sel", (u8 *)&pdata->pwr_sel);
|
|
|
|
|
|
- dev->platform_data = pdata;
|
|
|
-
|
|
|
- return 0;
|
|
|
+ return pdata;
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(lp55xx_of_populate_pdata);
|
|
|
|