linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Luka Kovacic <luka.kovacic@sartura.hr>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	linux-hwmon@vger.kernel.org,
	"Linux LED Subsystem" <linux-leds@vger.kernel.org>,
	"Lee Jones" <lee.jones@linaro.org>, "Pavel Machek" <pavel@ucw.cz>,
	"Dan Murphy" <dmurphy@ti.com>, "Rob Herring" <robh+dt@kernel.org>,
	"Jean Delvare" <jdelvare@suse.com>,
	"Guenter Roeck" <linux@roeck-us.net>,
	"Marek Behún" <marek.behun@nic.cz>,
	luka.perkov@sartura.hr, robert.marko@sartura.hr
Subject: Re: [PATCH v5 4/6] drivers: leds: Add the iEi WT61P803 PUZZLE LED driver
Date: Sun, 18 Oct 2020 21:50:33 +0300	[thread overview]
Message-ID: <CAHp75VdQnNXdhs52+WFt4bQKwZ3u5euFd3d65XU+-sMSFjt8jA@mail.gmail.com> (raw)
In-Reply-To: <20201017211035.257110-5-luka.kovacic@sartura.hr>

On Sun, Oct 18, 2020 at 12:18 AM Luka Kovacic <luka.kovacic@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	other threads:[~2020-10-18 18:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-17 21:10 [PATCH v5 0/6] Add support for the iEi WT61P803 PUZZLE MCU Luka Kovacic
2020-10-17 21:10 ` [PATCH v5 1/6] dt-bindings: Add iEi vendor prefix and iEi WT61P803 PUZZLE driver bindings Luka Kovacic
2020-10-19 14:46   ` Rob Herring
2020-10-17 21:10 ` [PATCH v5 2/6] drivers: mfd: Add a driver for iEi WT61P803 PUZZLE MCU Luka Kovacic
2020-10-17 21:10 ` [PATCH v5 3/6] drivers: hwmon: Add the iEi WT61P803 PUZZLE HWMON driver Luka Kovacic
2020-10-17 21:10 ` [PATCH v5 4/6] drivers: leds: Add the iEi WT61P803 PUZZLE LED driver Luka Kovacic
2020-10-18 18:50   ` Andy Shevchenko [this message]
2020-10-19 21:35     ` Luka Kovacic
2020-10-17 21:10 ` [PATCH v5 5/6] Documentation/ABI: Add iei-wt61p803-puzzle driver sysfs interface documentation Luka Kovacic
2020-10-17 21:10 ` [PATCH v5 6/6] MAINTAINERS: Add an entry for the iEi WT61P803 PUZZLE driver Luka Kovacic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHp75VdQnNXdhs52+WFt4bQKwZ3u5euFd3d65XU+-sMSFjt8jA@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=dmurphy@ti.com \
    --cc=jdelvare@suse.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=luka.kovacic@sartura.hr \
    --cc=luka.perkov@sartura.hr \
    --cc=marek.behun@nic.cz \
    --cc=pavel@ucw.cz \
    --cc=robert.marko@sartura.hr \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).