Re: [PATCH 4/7] power: supply: all: switch psy_cfg from of_node to fwnode

Baolin Wang
2025-02-25T03:40:00Z

On 2025/2/25 07:21, Sebastian Reichel wrote:
> When registering a power-supply device, either a of_node or the more
> recent fwnode can be supplied. Since fwnode can also contain an of_node,
> let's try to get rid of it.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---

[snip]

> drivers/power/supply/sc2731_charger.c | 2 +-
> drivers/power/supply/sc27xx_fuel_gauge.c | 3 +--

> diff --git a/drivers/power/supply/sc2731_charger.c b/drivers/power/supply/sc2731_charger.c
> index 50d5157af9277dc09fe24852747f4f62e72bc712..58b86fd78771360f74ffdad152c3905e1bee7c1b 100644
> --- a/drivers/power/supply/sc2731_charger.c
> +++ b/drivers/power/supply/sc2731_charger.c
> @@ -480,7 +480,7 @@ static int sc2731_charger_probe(struct platform_device *pdev)
> }
>
> charger_cfg.drv_data = info;
> - charger_cfg.of_node = np;
> + charger_cfg.fwnode = dev_fwnode(&pdev->dev);
> info->psy_usb = devm_power_supply_register(&pdev->dev,
> &sc2731_charger_desc,
> &charger_cfg);
> diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c
> index f36edc2ba708748d0ceb61298056f8c905aca012..196d96cd986266738785d8582e907858faaf2ba3 100644
> --- a/drivers/power/supply/sc27xx_fuel_gauge.c
> +++ b/drivers/power/supply/sc27xx_fuel_gauge.c
> @@ -1141,7 +1141,6 @@ static int sc27xx_fgu_hw_init(struct sc27xx_fgu_data *data)
> static int sc27xx_fgu_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> - struct device_node *np = dev->of_node;
> struct power_supply_config fgu_cfg = { };
> struct sc27xx_fgu_data *data;
> int ret, irq;
> @@ -1205,7 +1204,7 @@ static int sc27xx_fgu_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, data);
>
> fgu_cfg.drv_data = data;
> - fgu_cfg.of_node = np;
> + fgu_cfg.fwnode = dev_fwnode(dev);
> data->battery = devm_power_supply_register(dev, &sc27xx_fgu_desc,
> &fgu_cfg);
> if (IS_ERR(data->battery)) {

For sc27xx parts:

Acked-by: Baolin Wang <baolin.wang@linux.alibaba.com>

Thanks.