Re: [PATCH v5 RESEND 2/6] leds: rgb: leds-ktd202x: Get device properties through fwnode to support ACPI

From: Kate Hsuan
Date: Wed Mar 27 2024 - 02:53:47 EST


Hi Andy,

Thank you for reviewing it.

On Mon, Mar 25, 2024 at 3:57 AM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
>
> On Sun, Mar 24, 2024 at 5:02 PM Kate Hsuan <hpa@xxxxxxxxxx> wrote:
> >
> > This LED controller also installed on a Xiaomi pad2 and it is a x86
> > platform. The original driver is based on device tree and can't be
>
> the device
>
> > used for this ACPI based system. This patch migrated the driver to
> > use fwnode to access the properties. Moreover, the fwnode API
> > supports device tree so this work won't effect the original
>
> affect
>
> > implementations.
>
> ...
>
> > + fwnode_for_each_available_child_node(fwnode, child) {
> > + num_channels++;
> > + }
>
> {} are not needed.
>
> > if (!num_channels || num_channels > chip->num_leds)
> > return -EINVAL;
>
> ...
>
> > +static int ktd202x_add_led(struct ktd202x *chip,
> > + struct fwnode_handle *fwnode_color,
>
> Can it be simply fwnode? (Originally it was np, so I assume there is
> no name collision)
It can be. I'll revise this.

>
> ...
>
> > + count = device_get_child_node_count(dev);
> > if (!count || count > chip->num_leds)
> > return -EINVAL;
>
> > + fwnode = dev_fwnode(chip->dev);
>
> Why not dev?
I'll use dev. I had declared it.

>
> > + if (!fwnode)
> > + return -ENODEV;
>
> This is dead code. Please remove these three lines.

Okay.

>
> ...
>
> > + .id_table = ktd202x_id,
>
> Seems to me that you may split the I²C ID table addition into a separate change.

Could you please describe this more clearly? Thank you

>
> --
> With Best Regards,
> Andy Shevchenko
>

I'll propose the v6 patch according to your comments.


--
BR,
Kate