From mboxrd@z Thu Jan 1 00:00:00 1970 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Subject: Re: [PATCH] RFC: let gpiod_get_optional et all return NULL when GPIOLIB is not enabled Date: Tue, 28 Apr 2015 08:45:24 +0200 Message-ID: <20150428064524.GV19431@pengutronix.de> References: <1423731809-4800-1-git-send-email-u.kleine-koenig@pengutronix.de> <20150306085957.GC10717@pengutronix.de> <20150427152153.GN19431@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Content-Disposition: inline In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Alexandre Courbot Cc: Linus Walleij , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Grant Likely , Rob Herring , Benjamin Herrenschmidt , Alexandre Courbot , Sascha Hauer , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , "linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" List-Id: devicetree@vger.kernel.org Hello, On Tue, Apr 28, 2015 at 12:31:37PM +0900, Alexandre Courbot wrote: > On Tue, Apr 28, 2015 at 12:21 AM, Uwe Kleine-K=F6nig > wrote: > > On Thu, Apr 09, 2015 at 11:20:55AM +0900, Alexandre Courbot wrote: > >> Having GPIO disabled means there is no GPIO support, including the > >> ability to look for GPIOs. -ENOSYS is a well-documented error-code > >> which meaning also applies to the gpio_*_optional functions (we do= n't > >> have support for the operation you requested). If a driver or > >> architecture really, really needs GPIO support they can require or > >> depend on CONFIG_GPIOLIB, and the problem goes away. If they can w= ork > >> with and without gpiolib, then they should check for -ENOSYS when = they > >> request GPIOs and behave accordingly. > > What whould be the right behaviour in your eyes? I hope it's not > > > > if (ret !=3D -ENOSYS) > > return ret; > > > > /* continue and ignore error */ >=20 > If a consumer absolutely needs a GPIO (most of the drivers out there = I > believe), then -ENOSYS can be handled like any other error. If it > doesn't, and the driver is fine without GPIO support as well (meaning > that it can somehow work even if a GPIO is declared, but GPIO support > is not compiled in), then it will need to explicitly handle that > particular error. That case should be rare though - most drivers will > want to propagate -ENOSYS. Ack. Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig = | Industrial Linux Solutions | http://www.pengutronix.de/= | -- To unsubscribe from this list: send the line "unsubscribe devicetree" i= n the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html