[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdY-nZrX0EDgsE79egVDK9Lmrj_+gJN6h9B3SQT1z3OUzA@mail.gmail.com>
Date: Mon, 11 Feb 2019 09:34:13 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Justin Chen <justinpopo6@...il.com>
Cc: linux-iio@...r.kernel.org,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
bcm-kernel-feedback-list <bcm-kernel-feedback-list@...adcom.com>,
Florian Fainelli <f.fainelli@...il.com>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Jonathan Cameron <jic23@...nel.org>,
Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald <pmeerw@...erw.net>,
David Lechner <david@...hnology.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iio: adc: ti-ads7950: add GPIO support
Hi Justin,
thanks for your patch!
On Fri, Feb 8, 2019 at 8:25 PM <justinpopo6@...il.com> wrote:
> From: Justin Chen <justinpopo6@...il.com>
>
> The ADS79XX has GPIO pins that can be used. Add support for the GPIO
> pins using the GPIO chip framework.
>
> Signed-off-by: Justin Chen <justinpopo6@...il.com>
(...)
> @@ -56,11 +61,17 @@ struct ti_ads7950_state {
> struct spi_message ring_msg;
> struct spi_message scan_single_msg;
>
> + struct iio_dev *indio_dev;
> + struct gpio_chip *chip;
Why use a pointer here? Correct me if wrong by a struct ti_ads7950_state is
always allocated for each instance of the hardware right?
So just struct gpio_chip chip; should be fine, then just fill in that
struct.
> + /* Add GPIO chip */
> + st->chip->label = dev_name(&st->spi->dev);
So it would be st->chip.label = ... etc.
> + chip = devm_kzalloc(&spi->dev, sizeof(*chip), GFP_KERNEL);
> + if (!chip)
> + return -ENOMEM;
And no need to do this.
Apart from that it looks OK to me, but there are some locking comments
I see.
Yours,
Linus Walleij
Powered by blists - more mailing lists