Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2330617imu; Wed, 21 Nov 2018 09:57:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/WC01QqFL/YrZWIAvOhMYQeAerYpQ/W6tL17F3ffBWuQdVfD9Hw7e2dRJwk8ye500Hwe5h8 X-Received: by 2002:a17:902:6b03:: with SMTP id o3-v6mr7779291plk.208.1542823042917; Wed, 21 Nov 2018 09:57:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542823042; cv=none; d=google.com; s=arc-20160816; b=b5WmuKvNxhTYTS0Lj3aB0BOiGsw0Jum6y65mtOdA1Ec3IVlagZFUhFilktYvrQHoQF ibuFGBqcMpUx31GMxs0Jyk4I6zzHi0LKNxs7iRAXpBK86nkqdZK752IuYlS3c/jhIOE0 AJ3nXGpnATbLh8i3MrrM25oio0O+ZJBK+CPNFGQHuO+ls89TWYq1pHH8q5ydVtqcgdSi oTsdgQ9Xhoo56uYE9TDgeTtNu1v9+sfijc9ynPA1tbUeiD6KahgemlAn///+J0ytCMRL zmCa/n5+lmPQVNqklPL1BGMlIrLCaRF9sbNLhgYQ2DFC1Au/iK8GGG+talV9Z6nLYkyj DxrQ== 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; bh=3zYuetRRSt4I8SVzeYgmJzVR+kUFiVYNC6hL6vvXBio=; b=eIcn1lM0k1g6UkmPYsw8K6yZDsC2EZoUa1cix5595e+wMDkQ7VVEEwiMXzSl4vTSBq CMr36NylnlqKrXEWpqfVdJWGfbJAyRrZZuwRCQ/HJe8i3HLlvRfSeluJfXQNfxjk9K+S dQYLhkEP0TauQvQ7bD6xfbIb9oqJ0zy4W4Xz13Xw5AJqi2FlLJ0c3tj2ATexPcG3Jf3P V27MnRf+C7+6QNinaOVkS2hD2qjs1do4++1mSU/JxkJBaWSkscVlhL/dizCXHB9BJU1c wTWjwCru2om4dS4ktWQVt57UvTimUsFvIOg11PBQrQLNGlWyLpyh8V5mv5j7f0xBV3Lw 4Kzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pm2saDLt; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v75si11500464pfd.157.2018.11.21.09.57.05; Wed, 21 Nov 2018 09:57:22 -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=pass header.i=@gmail.com header.s=20161025 header.b=pm2saDLt; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731412AbeKVBau (ORCPT + 99 others); Wed, 21 Nov 2018 20:30:50 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:39460 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726790AbeKVBat (ORCPT ); Wed, 21 Nov 2018 20:30:49 -0500 Received: by mail-ed1-f67.google.com with SMTP id b14so5118310edt.6; Wed, 21 Nov 2018 06:56:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3zYuetRRSt4I8SVzeYgmJzVR+kUFiVYNC6hL6vvXBio=; b=pm2saDLtu9hxDbBpiXP2Ir6T60on3/nvF1skHKArNr79aiazvmCcSRmgA+09pb0wRt C3mr3jTu+/Q26S+/YWg4nFrFzwgtZGbfrD/j/6/yCQymnrPhwHsU7mIb1se5/f23H4ol fGh8/Cv56OgNep2DaxNcfWzTYWXNY/deCbChyPhSXGVGGdW48CbzKHeQN+YiYpw2enaw BdiSOxknXy+0JX8UYfkvwxfyDIQUD8bJejpkW7GhHigaN+9+GZUVRX8xK5RocTAW6ilM JfHgn2TgcGiRt1Dyr1rl1wVQCwg7IxHrEkMDULzPuCqDFgkA4LGdOi4KOuL9MDu7pdc8 KAew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3zYuetRRSt4I8SVzeYgmJzVR+kUFiVYNC6hL6vvXBio=; b=dLscdso3y7kaec3BpuCBWmOaL/soPkInuLo2i0c2HNFoHgCej+J4ZU5BE+ec7iEHcc 300+JKPznsXrGFGGsJ5PbrQU05H1uMtiK+5aUuN9a0qHknm0h6Rhq0FTqGSr5kVKSHkZ Fp5uYQVGsY7Ro1kyumQB6n/2VrUpzkQ0CQXEDpElPwGmf/im4n+9WG8IectLkPeafR1f 7VugknJFa8yMykFSoIjyPclvbn08Uc01G9wbRipAOwTqot0ZZKMNnHMfUjZZYkzYylpX dGAcT/blIu/gIkiHc8P9kTmwnztoaph1wbk2W0CYIZCggpTyd08s92MGnsknFLkoAUcI 3FKA== X-Gm-Message-State: AA+aEWbR3SnlBNqY5tB8dz4zCjPsoublo340xka8Uht3s89lnqYmgX7W uTfByjS57oy8Sy7j1IYBfi+ce4TS X-Received: by 2002:a50:abc5:: with SMTP id u63mr5915171edc.87.1542812162640; Wed, 21 Nov 2018 06:56:02 -0800 (PST) Received: from localhost (pD9E511F8.dip0.t-ipconnect.de. [217.229.17.248]) by smtp.gmail.com with ESMTPSA id c2sm13147286edv.14.2018.11.21.06.56.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Nov 2018 06:56:02 -0800 (PST) Date: Wed, 21 Nov 2018 15:56:00 +0100 From: Thierry Reding To: Jon Hunter Cc: Frank Lee , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] soc/tegra: refactor soc_is_tegra() Message-ID: <20181121145600.GA7739@ulmo> References: <20181121141204.22819-1-tiny.windzz@gmail.com> <2d534bbb-7b75-8521-bf88-36b52c918d19@nvidia.com> <20181121144320.GA6446@ulmo> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="/04w6evG8XlLl3ft" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --/04w6evG8XlLl3ft Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 21, 2018 at 02:50:54PM +0000, Jon Hunter wrote: >=20 > On 21/11/2018 14:47, Frank Lee wrote: > > On Wed, Nov 21, 2018 at 10:43 PM Thierry Reding > > wrote: > >> > >> On Wed, Nov 21, 2018 at 02:34:57PM +0000, Jon Hunter wrote: > >>> > >>> On 21/11/2018 14:12, Yangtao Li wrote: > >>>> of_find_node_by_path() acquires a reference to the node returned by > >>>> it and that reference needs to be dropped by its caller.soc_is_tegra= () > >>>> doesn't do that, so fix it.Call of_machine_is_compatible() to refact= or > >>>> soc_is_tegra() whcih automatically manages the reference count. > >>>> > >>>> Signed-off-by: Yangtao Li > >>>> --- > >>>> drivers/soc/tegra/common.c | 12 +++++++----- > >>>> 1 file changed, 7 insertions(+), 5 deletions(-) > >>>> > >>>> diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c > >>>> index cd8f41351add..0b40700b672a 100644 > >>>> --- a/drivers/soc/tegra/common.c > >>>> +++ b/drivers/soc/tegra/common.c > >>>> @@ -22,11 +22,13 @@ static const struct of_device_id tegra_machine_m= atch[] =3D { > >>>> > >>>> bool soc_is_tegra(void) > >>>> { > >>>> - struct device_node *root; > >>>> + struct of_device_id *match =3D tegra_machine_match; > >>>> > >>>> - root =3D of_find_node_by_path("/"); > >>>> - if (!root) > >>>> - return false; > >>>> + while(match->compatible){ > >>>> + if(of_machine_is_compatible(match->compatible)) > >>>> + return true; > >>>> + match++; > >>>> + } > >>>> > >>>> - return of_match_node(tegra_machine_match, root) !=3D NULL; > >>>> + return false; > >>>> } > >>> > >>> Ugh ... sorry, I thought that of_machine_is_compatible() looped throu= gh > >>> the matches. OK, let's stick with your initial fix. > >> > >> Actually I prefer this one. Even if it is slightly more verbose, I thi= nk > >> it's much clearer what's actually going on. Also this hides all of the > >> OF node reference counting in a core function, so it's worth the extra > >> line, in my opinion. > >> > >> Thierry > > Hi Jon=EF=BC=9A > >=20 > > I like both, how aboout you? >=20 > Yes fine with me too. However, looks like there is some formatting that > needs to be fixed up above. Please make sure you run checkpatch.pl on > your patches. Otherwise ... >=20 > Acked-by: Jon Hunter >=20 > Thierry, pick up this version if you prefer. Yeah, I noticed the formatting issues, but I can take care of them while applying. Thanks, Thierry --/04w6evG8XlLl3ft Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAlv1cf4ACgkQ3SOs138+ s6HURxAAgZLF0ApqMUdW8u+cYt5TdoxFRNBxdnCers9NjotDx930n4C8esF3FtGB vORNyNEkCwuetSOBV5XaMkd1ZxedFfNPhD835gQD4wyRrqBABtDxn1SZ+M/TzLE3 ZPELjivuvfSKSbp6yDGOrgqdOIzF54WhRaCzgs65QOQp9BMGoAwESDfBsz5l+h3g kHbYGuhCFrOd4oCzKyxMtsmUMFgkdqeGlzlXhDbb1NuixkeNK1abgUgElRVAliwO lwYN7suaRwOAcgeZT6kQwykwgUcATJB82g592wvbkAKj13gSgxcpnt6mblFk63ko cXUK5wIH3FUu0bn+g/c2eJl5zkUSq0B/0Uyqcxne54q6/Bw0s4ds4sQ2MLIwWduT hSVvXCj6E1Y1iEMNey/Q5sH5Sl5QU3xdAuAqUuooAzP9Y7Q6eOszRBbu6c1dSfbw NRFLQANtSr9hT05W64TKwHF52O4wIkLM+sHjBCEWS1YA7sLcrjoaErpXlcAkC3mv g+uWU6vMD54Ipu8VEROROiyZj7AYu9/ndwm8vZtyZyf3/De6CFUGkZ7AVw34ZCNP jL5VtdqtfO5n6pggkz2YIxmZbU75xg8vNvMGMbW2Xi3jhhkIcsxpYWGhkuTvG0rn sOmZD1nrgrpC4NJukaWv6EYTdwsPGoT53hJHFw+NYiRHYXsfsoU= =zobO -----END PGP SIGNATURE----- --/04w6evG8XlLl3ft--