[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <56C2C9DB.8020302@gmail.com>
Date: Tue, 16 Feb 2016 15:03:55 +0800
From: Peter Hung <hpeter@...il.com>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: Alexandre Courbot <gnurou@...il.com>,
Greg KH <gregkh@...uxfoundation.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Paul Gortmaker <paul.gortmaker@...driver.com>,
Lee Jones <lee.jones@...aro.org>, Jiri Slaby <jslaby@...e.com>,
Peter H <peter_hong@...tek.com.tw>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Peter Hurley <peter@...leysoftware.com>,
soeren.grunewald@...y.de, Wang YanQing <udknight@...il.com>,
Adam Lee <adam.lee@...onical.com>,
Arnd Bergmann <arnd@...db.de>,
Joachim Eastwood <manabian@...il.com>,
Scott Wood <scottwood@...escale.com>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Paul Burton <paul.burton@...tec.com>,
Måns Rullgård <mans@...sr.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Ralf Baechle <ralf@...ux-mips.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-serial@...r.kernel.org" <linux-serial@...r.kernel.org>,
tom_tsai@...tek.com.tw, Peter Hung <hpeter+linux_kernel@...il.com>
Subject: Re: [PATCH V2 2/4] gpio: gpio-f81504: Add Fintek F81504/508/512
PCIE-to-UART/GPIO GPIOLIB support
Hi Linus,
Linus Walleij 於 2016/2/10 下午 05:08 寫道:
> On Thu, Jan 28, 2016 at 10:20 AM, Peter Hung <hpeter@...il.com> wrote:
>> +#include <linux/platform_device.h>
>> +#include <linux/gpio.h>
>
> Drivers should just
> #include <linux/gpio/driver.h>
ok.
>> +static struct f81504_gpio_chip *gpio_to_f81504_chip(struct gpio_chip *chip)
>> +{
>> + return container_of(chip, struct f81504_gpio_chip, chip);
>> +}
>
> Avoid this construction in new code.
>
> Use gpiochip_get_data(chip) everywhere that gpio_to_f81504_chip()
> is used and register the gpiochip with gpiochip_add_data()
> and the code will be simpler.
>
> See any other driver in drivers/gpio for examples, I converted them
> all.
ok. I'll re-write this section.
>> +
>> + if (tmp & BIT(offset))
>> + return GPIOF_DIR_OUT;
>> +
>> + return GPIOF_DIR_IN;
>> +}
>
> Do not use GPIOF* flags in driver code, these are for the consumer
> API. Just return 0/1.
ok
>> + status = gpiochip_add(&gc->chip);
>
> As mentioned, use gpiochip_add_data(&gc->chip, gc);
>
ok.
>> +static struct platform_driver f81504_gpio_driver = {
>> + .driver = {
>> + .name = F81504_GPIO_NAME,
>> + .owner = THIS_MODULE,
>
> I saw coccinelle was already complaining about this.
>
> Looking forward to v3!
I had sent V3 today to resolve the issue above.
Thanks for your advices.
--
With Best Regards,
Peter Hung
Powered by blists - more mailing lists