Re: [PATCH v5 1/2] leds: tps6105x: add driver for mfd chip led mode

From: Sven Van Asbroeck
Date: Mon Dec 09 2019 - 10:15:16 EST


Thank you for the review, Dan. Some remarks below.

On Mon, Dec 9, 2019 at 9:12 AM Dan Murphy <dmurphy@xxxxxx> wrote:
>
> > + priv->fwnode = device_get_next_child_node(pdev->dev.parent, NULL);
>
> Probably need to check for NULL on the return
>

The driver will work without crashes or oopses even when this returns NULL:
- struct led_init_data . fwnode is optional (can be NULL)
- fwnode_handle_put() ignores NULL arguments

By not checking for NULL here, non-devicetree users can still select
led mode through platform data on the parent mfd driver, and things
will "just work".

Could I persuade you to keep this behaviour?
Perhaps I should put a comment in to clarify?

> > + ret = regmap_update_bits(tps6105x->regmap, TPS6105X_REG_0,
> > + TPS6105X_REG0_MODE_MASK | TPS6105X_REG0_TORCHC_MASK,
> > + TPS6105X_REG0_MODE_TORCH << TPS6105X_REG0_MODE_SHIFT);
> Checkpatch should have warned about alignment here

I used 5.4's checkpatch.pl, but somehow it doesn't warn :(
Will fix that up.