From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753795AbcBPHED (ORCPT ); Tue, 16 Feb 2016 02:04:03 -0500 Received: from mail-pf0-f172.google.com ([209.85.192.172]:32902 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753552AbcBPHEA (ORCPT ); Tue, 16 Feb 2016 02:04:00 -0500 Subject: Re: [PATCH V2 2/4] gpio: gpio-f81504: Add Fintek F81504/508/512 PCIE-to-UART/GPIO GPIOLIB support To: Linus Walleij References: <1453972838-30268-1-git-send-email-hpeter+linux_kernel@gmail.com> <1453972838-30268-3-git-send-email-hpeter+linux_kernel@gmail.com> Cc: Alexandre Courbot , Greg KH , Andy Shevchenko , Paul Gortmaker , Lee Jones , Jiri Slaby , Peter H , Heikki Krogerus , Peter Hurley , soeren.grunewald@desy.de, Wang YanQing , Adam Lee , Arnd Bergmann , Joachim Eastwood , Scott Wood , Masahiro Yamada , Paul Burton , =?UTF-8?B?TcOlbnMgUnVsbGfDpXJk?= , Matthias Brugger , Ralf Baechle , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , "linux-serial@vger.kernel.org" , tom_tsai@fintek.com.tw, Peter Hung From: Peter Hung Message-ID: <56C2C9DB.8020302@gmail.com> Date: Tue, 16 Feb 2016 15:03:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, Linus Walleij 於 2016/2/10 下午 05:08 寫道: > On Thu, Jan 28, 2016 at 10:20 AM, Peter Hung wrote: >> +#include >> +#include > > Drivers should just > #include 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