On Sun, Oct 18, 2020 at 12:18 AM Luka Kovacic <luka.kova...@sartura.hr> wrote:
>
> Add support for the iEi WT61P803 PUZZLE LED driver.
> Currently only the front panel power LED is supported.
>
> This driver depends on the iEi WT61P803 PUZZLE MFD driver.

...

> +/**
> + * struct iei_wt61p803_puzzle_led - MCU LED Driver
> + *
> + * @mcu:               MCU struct pointer
> + * @response_buffer    Global MCU response buffer allocation
> + * @lock:              General mutex lock to protect simultaneous R/W access 
> to led_power_state
> + * @led_power_state:   State of the front panel power LED
> + * @cdev:              LED classdev
> + */
> +struct iei_wt61p803_puzzle_led {
> +       struct iei_wt61p803_puzzle *mcu;
> +       unsigned char *response_buffer;
> +       struct mutex lock;
> +       int led_power_state;

> +       struct led_classdev cdev;

If you are using container_of() and move this member to be first, you
will effectively make the container_of() a no-op.

> +};
> +
> +static inline struct iei_wt61p803_puzzle_led *cdev_to_iei_wt61p803_puzzle_led
> +       (struct led_classdev *led_cdev)
> +{
> +       return dev_get_drvdata(led_cdev->dev->parent);

Why not simply call container_of()

> +}

...

> +       ret = fwnode_property_read_u32(child, "reg", &reg);
> +       if (ret || reg > 1) {
> +               dev_err(dev, "Could not register 'reg' (%lu)\n", (unsigned 
> long)reg);

When you cast explicitly during printf() you are doing something wrong
in 99.9% cases.
What's wrong with %u in this case?

> +               ret = -EINVAL;
> +               goto err_child_node;
> +       }

-- 
With Best Regards,
Andy Shevchenko

Reply via email to