Re: [PATCH v3 6/6] leds: Add support for RTL8231 LED scan matrix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2021-05-24 at 13:24 +0300, Andy Shevchenko wrote:
> On Mon, May 24, 2021 at 1:34 AM Sander Vanheule <sander@xxxxxxxxxxxxx> wrote:
> > 
> > Both single and bi-color scanning modes are supported. The driver will
> > verify that the addresses are valid for the current mode, before
> > registering the LEDs. LEDs can be turned on, off, or toggled at one of
> > six predefined rates from 40ms to 1280ms.
> > 
> > Implements a platform device for use as a child device with RTL8231 MFD,
> > and uses the parent regmap to access the required registers.
> 
> ...
> 
> > +         This options enables support for using the LED scanning matrix
> > output
> 
> option

Fixed.

> 
> > +         of the RTL8231 GPIO and LED expander chip.
> > +         When built as a module, this module will be named leds-rtl8231.
> 
> ...
> 
> > +               interval_ms = 500;
> 
> Does this deserve a #define?

Fine by me. Doesn't make a difference for the binary anyway, but it helps
document the code a bit.

> ...
> 
> > +       ret = fwnode_property_count_u32(fwnode, "reg");
> > +       if (ret < 0)
> > +               return ret;
> > +       if (ret != 2)
> > +               return -ENODEV;
> 
> I would say -EINVAL, but -ENODEV is similarly okay.

Any specific reason you think EINVAL is more appropriate than ENODEV?


> ...
> 
> > +       int err;
> 
> ret or err? Be consistent across a single driver.

I had first used 'err' for both fwnode_property_count_u32() and
fwnode_property_read_u32_array(). The former returns "actual count or error
code", while the latter is only "error code". And I found it weird to read the
code as "does error code equal 2", if I used 'err' as variable name.

I've split this up:
 * addr_count for fwnode_property_count_u32's result
 * err for fwnode_property_read_u32_array's result

Since addr_count is only used before err is touched, I guess the compiler will
optimize this out anyway?


Best,
Sander




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux