During the review of the series "Add RT5033 charger device driver" [1] I
noticed two things I'd like to clean up. Additionally, in v5 of that series,
Christophe Jaillet pointed out an unclean error handling of function
"rt5033_charger_data" [2]. The clean-up solves this as well. As I didn't want
to disturb the review process of the series in its late phase, I now add these
clean-ups as a follow-up series.
I was a bit surprised about the patchset "Add RT5033 charger device driver"
being added via the mfd subsystem. This clean-up series affects the charger
driver, which is actually part of the power supply subsystem. I'm not
fully sure what the series should be based on and how it will be applied
best.
Additionally I just realized that in the immutable branch "ib-mfd-power-v6.5"
of kernel/git/lee/mfd.git one patch of the previous series is missing. Because
of this, I currently can't use linux-next or mfd.git as a base. Instead I based
this clean-up patchset right on top of the previous patchset. An instance of
that base can be seen on my GitHub page [3][4].
[1] https://lore.kernel.org/linux-pm/[email protected]/T/#u
[2] https://lore.kernel.org/linux-pm/[email protected]/T/#mbe33ab528f3d8ae136f01b13f45a9be35c0ad061
[3] https://github.com/Jakko3/linux/commits/rt5033-charger_v6
[4] https://github.com/Jakko3/linux/blob/rt5033-charger_v6/drivers/power/supply/rt5033_charger.c
Jakob Hauser (2):
power: supply: rt5033_charger: Simplify initialization of
rt5033_charger_data
power: supply: rt5033_charger: Replace "&pdev->dev" by "charger->dev"
in probe
drivers/power/supply/rt5033_charger.c | 43 ++++++++++++---------------
1 file changed, 19 insertions(+), 24 deletions(-)
--
2.39.2
At the beginning of the probe function, "charger->dev" is set equal to
"&pdev->dev". Therefore it's more clear to subsequently use "charger->dev"
instead of "&pdev->dev".
Signed-off-by: Jakob Hauser <[email protected]>
---
drivers/power/supply/rt5033_charger.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/power/supply/rt5033_charger.c b/drivers/power/supply/rt5033_charger.c
index 361a36c2a195..71a237cd1d61 100644
--- a/drivers/power/supply/rt5033_charger.c
+++ b/drivers/power/supply/rt5033_charger.c
@@ -667,11 +667,11 @@ static int rt5033_charger_probe(struct platform_device *pdev)
psy_cfg.of_node = pdev->dev.of_node;
psy_cfg.drv_data = charger;
- charger->psy = devm_power_supply_register(&pdev->dev,
+ charger->psy = devm_power_supply_register(charger->dev,
&rt5033_charger_desc,
&psy_cfg);
if (IS_ERR(charger->psy))
- return dev_err_probe(&pdev->dev, PTR_ERR(charger->psy),
+ return dev_err_probe(charger->dev, PTR_ERR(charger->psy),
"Failed to register power supply\n");
ret = rt5033_charger_dt_init(charger);
@@ -690,22 +690,22 @@ static int rt5033_charger_probe(struct platform_device *pdev)
np_edev = of_get_parent(np_conn);
charger->edev = extcon_find_edev_by_node(np_edev);
if (IS_ERR(charger->edev)) {
- dev_warn(&pdev->dev, "no extcon device found in device-tree\n");
+ dev_warn(charger->dev, "no extcon device found in device-tree\n");
goto out;
}
- ret = devm_work_autocancel(&pdev->dev, &charger->extcon_work,
+ ret = devm_work_autocancel(charger->dev, &charger->extcon_work,
rt5033_charger_extcon_work);
if (ret) {
- dev_err(&pdev->dev, "failed to initialize extcon work\n");
+ dev_err(charger->dev, "failed to initialize extcon work\n");
return ret;
}
charger->extcon_nb.notifier_call = rt5033_charger_extcon_notifier;
- ret = devm_extcon_register_notifier_all(&pdev->dev, charger->edev,
+ ret = devm_extcon_register_notifier_all(charger->dev, charger->edev,
&charger->extcon_nb);
if (ret) {
- dev_err(&pdev->dev, "failed to register extcon notifier\n");
+ dev_err(charger->dev, "failed to register extcon notifier\n");
return ret;
}
out:
--
2.39.2