Re: [PATCH v7 6/7] media: i2c: add DS90UB913 driver

From: Laurent Pinchart
Date: Fri Jan 20 2023 - 04:06:14 EST


Hi Tomi,

On Fri, Jan 20, 2023 at 09:04:39AM +0200, Tomi Valkeinen wrote:
> On 20/01/2023 02:03, Laurent Pinchart wrote:
> > On Wed, Jan 18, 2023 at 02:40:30PM +0200, Tomi Valkeinen wrote:
> >> Add driver for TI DS90UB913 FPD-Link III Serializer.
> >>
> >> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
> >> ---
> >> drivers/media/i2c/Kconfig | 13 +
> >> drivers/media/i2c/Makefile | 1 +
> >> drivers/media/i2c/ds90ub913.c | 848 ++++++++++++++++++++++++++++++++++
> >> 3 files changed, 862 insertions(+)
> >> create mode 100644 drivers/media/i2c/ds90ub913.c

[snip]

> >> diff --git a/drivers/media/i2c/ds90ub913.c b/drivers/media/i2c/ds90ub913.c
> >> new file mode 100644
> >> index 000000000000..befa78128a9a
> >> --- /dev/null
> >> +++ b/drivers/media/i2c/ds90ub913.c
> >> @@ -0,0 +1,848 @@

[snip]

> >> +static int ub913_gpio_direction_out(struct gpio_chip *gc, unsigned int offset,
> >> + int value)
> >> +{
> >> + struct ub913_data *priv = gpiochip_get_data(gc);
> >> + unsigned int reg_idx = offset / 2;
> >> + unsigned int field_idx = offset % 2;
> >> +
> >> + return regmap_update_bits(priv->regmap, UB913_REG_GPIO_CFG(reg_idx),
> >> + UB913_REG_GPIO_CFG_MASK(field_idx),
> >> + UB913_REG_GPIO_CFG_ENABLE(field_idx) |
> >> + (value ? UB913_REG_GPIO_CFG_OUT_VAL(field_idx) :
> >> + 0));
> >
> > I find the indentation weird, I would have written
> >
> > return regmap_update_bits(priv->regmap, UB913_REG_GPIO_CFG(reg_idx),
> > UB913_REG_GPIO_CFG_MASK(field_idx),
> > UB913_REG_GPIO_CFG_ENABLE(field_idx) |
> > (value ? UB913_REG_GPIO_CFG_OUT_VAL(field_idx) : 0));
> >
> > Your call.
>
> It's clang-format. I still haven't found out how to make it indent as
> I'd like. Actually, with kernel's clang-format settings this ends up as:
>
> return regmap_update_bits(
> priv->regmap, UB913_REG_GPIO_CFG(reg_idx),
> UB913_REG_GPIO_CFG_MASK(field_idx),
> UB913_REG_GPIO_CFG_ENABLE(field_idx) |
> (value ? UB913_REG_GPIO_CFG_OUT_VAL(field_idx) : 0));

That's horrible indeed.

> But checkpatch complains about line ending with (. Adjusting the
> settings a bit I got it to indent as it is currently.

It's lovely when tools work together as expected, right ? :-)

> The indent after the line ending with | make sense, I think, but I don't
> mind your formatting either.

I don't think I've seen that style before. If you prefer it, your code,
your style :-) Just be consistent through the driver in that case.

> >> +}

[snip]

--
Regards,

Laurent Pinchart