Received: by 10.223.185.116 with SMTP id b49csp8862921wrg; Fri, 2 Mar 2018 09:10:09 -0800 (PST) X-Google-Smtp-Source: AG47ELu3FMSZu0EluwBWY3pXUXJXokwNuxScG0WDNBUZ8ArvDkD1okSJGIQs/jL2s+1nCqMOiK3l X-Received: by 10.101.98.17 with SMTP id d17mr5099823pgv.221.1520010609378; Fri, 02 Mar 2018 09:10:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520010609; cv=none; d=google.com; s=arc-20160816; b=J1C8Wl6x2NeqqG6ooR/MgoCIJRNQ1IVALySmEJnWZmShB5ePsWmATl4lW0S1D8m+gN LrdmDlWaPyz5nipRjSGibapqY8SLUsVQN0pQn58YXOl5Vfl3DPNUPtNqI1Q++CH1qzli BVBzHt9so2DPxgJdiAfo6ugrY+/3kH4aJrti5WRjzmvdW6sYXnLWyEKvpgiyRdAmDatT ReokiuoSKZqnMkLBebWln59zEIe83IPn46QDgVvXSLpaWoKwDJB/vPD+1K1+RRqbaUov Y+n7F8yMwwdOIJZp6GkYRZLxK2FxS+iaphg0fVTMPGrfM14SR3pgoWH7f6XR+6BWPYuf Z4RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=sTuoOchO+wNf0sxYWoGcVCZoWSV0tIb27FqookCxD0Y=; b=BeiMx/8sDKrhLDN6lgtN3DJg+feJMHzh0BDsdINQO2VzYifzTVGsulg/s8roqQF68d scNIA2ddWfps84vRIVAOUtzpKTk4trnRH2kswxpAvDaM2ARJejDqXsEtpeCQfUOi1rb1 qGnoz8ol0NXi9/+t1Jn90dwVB4tVpeegLru8y0pvDC+5iZrdYFzSR7YA88MieCo2WVXY LU8jTGG5yQpABGhsdxxFmANrGGIYYAygrxZwYa/8eayz+boQppZyGZWvbdadRkKoNbT5 wRDHlYU70tQHGWvEhqewURyrb3O1ruXylMMlpYd/+vx04/i6s9wQZoXSyWMsA3IZupJn vyew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=B3fPf/7h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n5si4196797pgd.345.2018.03.02.09.09.53; Fri, 02 Mar 2018 09:10:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=B3fPf/7h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1427309AbeCBRJQ (ORCPT + 99 others); Fri, 2 Mar 2018 12:09:16 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:51610 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424699AbeCBRJN (ORCPT ); Fri, 2 Mar 2018 12:09:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=sTuoOchO+wNf0sxYWoGcVCZoWSV0tIb27FqookCxD0Y=; b=B3fPf/7hKTR9kMWy8yYEDufpZyGUq3xmA8ORn2QcOa+RXLNCR5Hy8c3mBwjyKTXmib4pNomC/XNXxs2dedz+4ZmISK+ZXsW/RSbhNGJYCs3ZHoKdyv+dEezu8kJdTiIls4mKsQ9NTzFDq1L8YJ//U+wWIlxMO1HJSHLCNIRK0Ig=; Received: from n2100.armlinux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:54244) by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1eroAo-0002I8-56; Fri, 02 Mar 2018 17:08:46 +0000 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.76) (envelope-from ) id 1eroAk-0007OW-0I; Fri, 02 Mar 2018 17:08:42 +0000 Date: Fri, 2 Mar 2018 17:08:41 +0000 From: Russell King - ARM Linux To: "Andrew F. Davis" Cc: Pavel Machek , Linus Walleij , Martijn Braam , Daniel Baluta , Ivajlo Dimitrov , Kevin Hilman , ext Tony Lindgren , Mark Brown , Aaro Koskinen , Pali =?iso-8859-1?Q?Roh=E1r?= , Linux-ALSA , kernel list , Peter Ujfalusi , Filip =?utf-8?Q?Matijevi=C4=87?= , Thorsten Leemhuis , =?utf-8?B?TWlja3Vsw6HFoQ==?= Qwertz , Sakari Ailus , Sebastian Reichel , clayton@craftyguy.net, Linux-OMAP , Patrik Bachan , linux-arm-kernel , serge@hallyn.com Subject: Re: [alsa-devel] regression v4.16 on Nokia N900: sound does not work Message-ID: <20180302170841.GP28231@n2100.armlinux.org.uk> References: <20180224214617.GA22619@amd> <71aa88ec-d4df-b49c-7d73-27197f468491@leemhuis.info> <20180226131318.GA14045@amd> <20180226231336.GA18565@amd> <20180302091025.GC30267@amd> <20180302111040.GA6344@amd> <0f090cc7-2b72-a038-26ee-d43077cb9663@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0f090cc7-2b72-a038-26ee-d43077cb9663@ti.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 02, 2018 at 08:22:52AM -0600, Andrew F. Davis wrote: > > diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c > > index 84e5a9d..f0fab26 100644 > > --- a/drivers/gpio/gpiolib-of.c > > +++ b/drivers/gpio/gpiolib-of.c > > @@ -241,29 +241,17 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, > > > > desc = of_get_named_gpiod_flags(dev->of_node, prop_name, idx, > > &of_flags); > > - /* > > - * -EPROBE_DEFER in our case means that we found a > > - * valid GPIO property, but no controller has been > > - * registered so far. > > - * > > - * This means we don't need to look any further for > > - * alternate name conventions, and we should really > > - * preserve the return code for our user to be able to > > - * retry probing later. > > - */ > > - if (IS_ERR(desc) && PTR_ERR(desc) == -EPROBE_DEFER) > > - return desc; > > > > - if (!IS_ERR(desc) || (PTR_ERR(desc) != -ENOENT)) > > + if (!IS_ERR(desc) || PTR_ERR(desc) != -ENOENT) > > > I rather like the () so one doesn't always have to look up C operator > precedence to verify.. Too many make it impossible to see which close paren ties up with which open paren. I've spent way too long in the past reformatting code, where people think that () are a good thing, to work out what the comparison is actually doing before then rewriting the damn thing with less () and in a much clearer way. I'm now convinced that unnecessary () are a very bad thing as they severely harm readability as test complexity increases. > > > > break; > > } > > > > /* Special handling for SPI GPIOs if used */ > > - if (IS_ERR(desc)) > > + if (IS_ERR(desc) && PTR_ERR(desc) == -ENOENT) These can be simplified to: if (desc == ERR_PTR(-ENOENT)) since error pointers are unique - ERR_PTR(-ENOENT) is what was returned as an error-pointer, and if IS_ERR(ERR_PTR(-ENOMENT)) etc were false, we'd have big problems as it'd mean we couldn't detect error pointers! As an added bonus, they don't involve any operator precedence questions either. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up