Re: [PATCH v4] leds: pca963x: enable low-power state

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

 



Hi Matt


Have you verified that led_set cannot be called in "parallel" ? There
might be a race condition otherwise

On Fri, Oct 28, 2016 at 4:53 AM, Matt Ranostay <mranostay@xxxxxxxxx> wrote:
>
> +static int pca963x_power_state(struct pca963x_led *pca963x)

What about:

if (pca963x->led_cdev.brightness)
  set_bit(pca963x->led_num, leds_on);
else
  clear_bit(pca963x->led_num, leds_on);

if (!(*leds_on) != !cached_leds)
  return i2c_smbus_write_byte_data(pca963x->chip->client,
                                   PCA963X_MODE1, *leds_on ? 0: BIT(4));

return 0


I believe it is simpler, but it is just a matter of taste.


Regards!
--
To unsubscribe from this list: send the line "unsubscribe linux-leds" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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