Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754227AbcDYKLW (ORCPT ); Mon, 25 Apr 2016 06:11:22 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:35407 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752436AbcDYKLG (ORCPT ); Mon, 25 Apr 2016 06:11:06 -0400 Date: Mon, 25 Apr 2016 12:11:01 +0200 From: Thierry Reding To: Laxman Dewangan Cc: swarren@wwwdotorg.org, linus.walleij@linaro.org, gnurou@gmail.com, linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V4 3/4] gpio: tegra: Get rid of all file scoped global variables Message-ID: <20160425101101.GC20630@ulmo.ba.sec> References: <1461319754-12040-1-git-send-email-ldewangan@nvidia.com> <1461319754-12040-3-git-send-email-ldewangan@nvidia.com> <20160425100055.GA20630@ulmo.ba.sec> <571DE912.3060602@nvidia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qtZFehHsKgwS5rPz" Content-Disposition: inline In-Reply-To: <571DE912.3060602@nvidia.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2196 Lines: 61 --qtZFehHsKgwS5rPz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 25, 2016 at 03:23:22PM +0530, Laxman Dewangan wrote: >=20 > On Monday 25 April 2016 03:30 PM, Thierry Reding wrote: > > * PGP Signed by an unknown key > >=20 > > On Fri, Apr 22, 2016 at 03:39:13PM +0530, Laxman Dewangan wrote: > > [...] > > > diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c > > [...] > > > static struct gpio_chip tegra_gpio_chip =3D { > > This variable is still file-scoped. Why not get rid of it at the same > > time? It's rather pointless to remove all file-scoped variables except a > > single one, because now the driver still isn't properly equipped to deal > > with multiple instances (however theoretical that may be). > >=20 >=20 > Yaah, Alex also pointed that to have the instance of gpio_chip in > tegra_gpio_info and then do as > tgi->gc =3D tegra_gpio_chip. >=20 >=20 > same for irq_chip also. >=20 >=20 > I hope this will resolve the concern. An alternative would be to do away with tegra_gpio_chip altogether and instead assign the fields directly within ->probe(). Both patterns seem to be used in drivers/gpio, with the latter one being slightly more common. Thierry --qtZFehHsKgwS5rPz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJXHe01AAoJEN0jrNd/PrOhioEP/3LTh0F2NLzw2NU/Cdfrm+jJ cDkjW4jGN985fzqaKsoJded3PUmAu2jL3VJMGaDhF7xU7wz9lw0qSY4MbwFPohaz uQDPh7lE5D3J9eL4UIIhWJyD8N/bNjMP6pOowQif/LP+PesnZ7HWW8Rj8BuaGBV9 7h9vYaOp0vWtuy0LDLYFL8iFPZJ1bv/Jxa0i9YcUnONVEhE0ngtp2T+SepCbvtNg W1JwUp+Mh2raw4mwTUQcfNxqMN2m2vG5QFlInh9U3rObzjaPbj+GXBHt937klXUY ivYWyPWqPo8RkAvo6fQVg4BiiO9z2nj4sgSkGHtzVCCGiqR3tPUFxSfTgsf7WAiH C1cP9L6pS2P9jOMMq6O9dRC4+TYrf0Kzn1j2LD4d2D3a2O6h4gx4ex0us5K0fufm P88b7a0KeMZurUIj34bq5Tz3GFN9vmPj/PkPrLpDpF/HsTRIfEMcYtcneP9mRRXV hkuzJPuoAf9+Q86MSzifZx4/6aLbveeKN08QoidbLnbiA1lf/Gg/bgNt4e3HC/4D esboKriPKpgoLxjFu962TY654SFGwywfMUbgVt1Q5G9tnp15maqTwdX2op6hObNw HNYy61VFn0uidQBTe5GJWpC6U+LLPSYeiyVRa5EvsRLzARI1hso7sf59YSa6iFL9 ICL70Ly/i1tmej6YO3qw =KjYp -----END PGP SIGNATURE----- --qtZFehHsKgwS5rPz--