[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdQnNXdhs52+WFt4bQKwZ3u5euFd3d65XU+-sMSFjt8jA@mail.gmail.com>
Date: Sun, 18 Oct 2020 21:50:33 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Luka Kovacic <luka.kovacic@...tura.hr>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-hwmon@...r.kernel.org,
Linux LED Subsystem <linux-leds@...r.kernel.org>,
Lee Jones <lee.jones@...aro.org>, Pavel Machek <pavel@....cz>,
Dan Murphy <dmurphy@...com>, Rob Herring <robh+dt@...nel.org>,
Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Marek BehĂșn <marek.behun@....cz>,
luka.perkov@...tura.hr, robert.marko@...tura.hr
Subject: Re: [PATCH v5 4/6] drivers: leds: Add the iEi WT61P803 PUZZLE LED driver
On Sun, Oct 18, 2020 at 12:18 AM Luka Kovacic <luka.kovacic@...tura.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", ®);
> + 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
Powered by blists - more mailing lists