Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752819AbbGOHmG (ORCPT ); Wed, 15 Jul 2015 03:42:06 -0400 Received: from mail-ob0-f180.google.com ([209.85.214.180]:35138 "EHLO mail-ob0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751632AbbGOHmE (ORCPT ); Wed, 15 Jul 2015 03:42:04 -0400 MIME-Version: 1.0 In-Reply-To: <1434838377-8042-3-git-send-email-stefan@agner.ch> References: <1434838377-8042-1-git-send-email-stefan@agner.ch> <1434838377-8042-3-git-send-email-stefan@agner.ch> Date: Wed, 15 Jul 2015 09:42:02 +0200 Message-ID: Subject: Re: [PATCH 2/2] gpio: gpio-ftdi-cbus: add driver for FTDI CBUS GPIOs From: Linus Walleij To: Stefan Agner Cc: Johan Hovold , Alexandre Courbot , Grant Likely , Greg KH , Sascha Silbe , Philipp Hachtmann , "linux-usb@vger.kernel.org" , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1961 Lines: 67 On Sun, Jun 21, 2015 at 12:12 AM, Stefan Agner wrote: > This driver allows to use the CBUS pins, e.g. CBUS 0-3 on FT232R > type of devices. Note that the pins need to be configured first > by using I/O mode signal option in the EEPROM. This is _not_ the > factory default configuration of any of the four pins. > > See also FTDI's Application Note AN_232R-01. > > Signed-off-by: Stefan Agner I see no big problems with this driver but I guess the serial portions are the controversial parts. > +++ b/drivers/gpio/gpio-ftdi-cbus.c > @@ -0,0 +1,167 @@ > +/* > + * gpiolib support for FTDI SIO chips supporting CBUS GPIO's (FT232R class) > + * > + * Copyright 2015 Stefan Agner > + * > + * Author: Stefan Agner > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms of the GNU General Public License as published by the > + * Free Software Foundation; either version 2 of the License, or (at your > + * option) any later version. > + * > + * Note: To use the GPIOs on CBUS the signal option need to be set to > + * I/O mode in EEPROM! > + */ > + > +#include > +#include > +#include > +#include #include should be enough. > +static int ftdi_cbus_gpio_direction_input(struct gpio_chip *chip, > + unsigned offset) > +{ > + struct ftdi_cbus_gpio *fcg = to_ftdi_cbus_gpio(chip); > + > + fcg->cbus_mask &= ~((1 << offset) << 4); I usually replace: (1 << offset) with #include BIT(offset) so it's clear what is happening. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/