From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Arnd Bergmann To: Alexandre Courbot Cc: Linus Walleij , Thierry Reding , Sebastian Reichel , Wolfram Sang , Jonathan Cameron , Dmitry Torokhov , Alexander Shiyan , Hans Verkuil , Mauro Carvalho Chehab , Samuel Ortiz , Lee Jones , Chris Ball , Ulf Hansson , Florian Fainelli , Dmitry Eremin-Solenikov , David Woodhouse , Greg Kroah-Hartman , Jiri Slaby , Jingoo Han , Bryan Wu , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Johannes Berg , "John W. Linville" , "David S. Miller" , Lars-Peter Clausen , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Brian Austin , Paul Handrigan , Peter Ujfalusi , Jarkko Nikula , Pavel Machek , Laurent Pinchart , Jean Delvare , linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-i2c@vger.kernel.org, linux-iio@vger.kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, netdev@vger.kernel.org, linux-pm@vger.kernel.org, linux-serial@vger.kernel.org, linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-omap@vger.kernel.org, linux-wireless@vger.kernel.org, alsa-devel@alsa-project.org, g nurou@gmail.com Subject: Re: [PATCH] gpio: extend gpiod_get*() with flags parameter Date: Thu, 24 Jul 2014 18:10:30 +0200 Message-ID: <6059032.T3tqvLkWTo@wuerfel> In-Reply-To: <1406214298-20062-1-git-send-email-acourbot@nvidia.com> References: <1406214298-20062-1-git-send-email-acourbot@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" List-ID: On Friday 25 July 2014 00:04:58 Alexandre Courbot wrote: > I'm not sure how this could be applied harmlessly though - maybe through > a dedicated branch for -next? Problem is that a lot of new code is not > yet merged into mainline, and conflicts are very likely to occur. Linus, > do you have any suggestion as to how this can be done without blood being > spilled? There is a trick that we sometime use in this situation, though it has to be done carefully: > diff --git a/Documentation/gpio/consumer.txt b/Documentation/gpio/consumer.txt > index 7ff30d2..a3fb1d7 100644 > --- a/Documentation/gpio/consumer.txt > +++ b/Documentation/gpio/consumer.txt > @@ -29,13 +29,24 @@ gpiod_get() functions. Like many other kernel subsystems, gpiod_get() takes the > device that will use the GPIO and the function the requested GPIO is supposed to > fulfill: > > - struct gpio_desc *gpiod_get(struct device *dev, const char *con_id) > + struct gpio_desc *gpiod_get(struct device *dev, const char *con_id, > + enum gpio_flags flags) > > - struct gpio_desc *gpiod_get(struct device *dev, const char *con_id) + struct gpio_desc *__gpiod_get(struct device *dev, const char *con_id, + enum gpio_flags flags); + +#define __gpiod_get(dev, con_id, flags, ...) __gpiod_get(dev, con_id, flags) +#define gpiod_get(varargs ...) __gpiod_get(varargs, 0) This will allow both variants to be called, and any users of the three-argument version will pass zero as the fourth argument (or whatever you choose there). Once the conversion is complete, the macros can be removed. ARnd