From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030709AbdIZNR2 (ORCPT ); Tue, 26 Sep 2017 09:17:28 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:54857 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030693AbdIZNRV (ORCPT ); Tue, 26 Sep 2017 09:17:21 -0400 Subject: Re: [PATCH v2 03/10] pinctrl: axp209: use drv_data of pinctrl_pin_desc to store pin reg To: Maxime Ripard Cc: linus.walleij@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, linux@armlinux.org.uk, lee.jones@linaro.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, thomas.petazzoni@free-electrons.com References: <7993a30fbc2e50a2d228fa0c8fad643c4034b101.1506428208.git-series.quentin.schulz@free-electrons.com> <20170926130108.uibnri32b73elfy6@flea> From: Quentin Schulz Message-ID: <0ae64e95-ee49-fb4c-e79b-e8c25c86580c@free-electrons.com> Date: Tue, 26 Sep 2017 15:17:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170926130108.uibnri32b73elfy6@flea> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vSHPog3EoUl0rPKW3pRvkEVwkG1WG7sTx" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --vSHPog3EoUl0rPKW3pRvkEVwkG1WG7sTx Content-Type: multipart/mixed; boundary="vrocQsabtXwawM6sGkv2mo3NPT4vHRvTS"; protected-headers="v1" From: Quentin Schulz To: Maxime Ripard Cc: linus.walleij@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, linux@armlinux.org.uk, lee.jones@linaro.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, thomas.petazzoni@free-electrons.com Message-ID: <0ae64e95-ee49-fb4c-e79b-e8c25c86580c@free-electrons.com> Subject: Re: [PATCH v2 03/10] pinctrl: axp209: use drv_data of pinctrl_pin_desc to store pin reg References: <7993a30fbc2e50a2d228fa0c8fad643c4034b101.1506428208.git-series.quentin.schulz@free-electrons.com> <20170926130108.uibnri32b73elfy6@flea> In-Reply-To: <20170926130108.uibnri32b73elfy6@flea> --vrocQsabtXwawM6sGkv2mo3NPT4vHRvTS Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi Maxime, On 26/09/2017 15:01, Maxime Ripard wrote: > On Tue, Sep 26, 2017 at 12:17:13PM +0000, Quentin Schulz wrote: >> Instead of using a function to retrieve each pin's correct control >> register, use drv_data within pinctrl_pin_desc to store the ctrl reg. >> >> Remove axp20x_gpio_get_reg and replace every occurrence by a get from >> drv_data. >=20 > Why do you need to do that? This should be explained. >=20 Agreed that it misses an explanation. Today, to get a register addr of one of the GPIOs in the PMIC, we basically get the GPIO number and returns the register via this info. There are 3 GPIOs in AXP209, 2 in AXP813. I didn't want to have a switch case for the GPIO number and then an if/else inside one of the case to check if the device is AXP209 or AXP813 in which case we return -EINVAL instead of the GPIO2 reg. With support for new PMIC, we would have a bunch of if conditions and complexify the process for something really simple. IMHO, this also allows easier integration of future PMICs which might have different regs for the GPIOs. I don't *need* it but I find this solution nicer. Thanks, Quentin --=20 Quentin Schulz, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com --vrocQsabtXwawM6sGkv2mo3NPT4vHRvTS-- --vSHPog3EoUl0rPKW3pRvkEVwkG1WG7sTx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJZylNRAAoJEIS4mnU+4PGjausP/jCLjovT11NgMXFOVjpQzfXz MzOgi+lsdHY9fX+D3+l/RzC6ptBJbokeaWC6nqhiwMBHx5m3yI0hiNOQKQjn9HSi 7APd+jVP5DGJfKhPORSbggGuWOU1c19Yf+GdtTV2PuEysXGztU4m2Ye+JHFd3ywA +Ky7t8mrpi1yRVVoqGROnMqHARaWqzLqKF308gL4Xi5nnUgrUht4TFS0K2z67hoX JqAN8ewqBVfx1RAOct6KYL051QbP1rp7uRahWEDchBCrJ706oF7iFpLhJ7JkQPaN 0fASEfTeC8T7SOdYImJCY1Sr8H98FKyBeshYxNTjnZKqzDJoui7/D2+b5XbbUEo3 V6SC6FCVCFVlWut/h3Y9HIzi8d9nFKrHYXZpOUqVta8hi0L/TuKpNAl07uuI6sKm 2zQjcKAN15L3SqyLsLNgtfEFQM0a+PXnseK99lTgFihzipayfTAwUDRGUmU2MTXn hLXQSFLTIjJsWT8ci0x0BrIS80/GrFc8NCw75zr1F9XmYqNzS+qpckdg2iIaCuUp 39mNK8u4Y+AAs17GtNXzvi/wT0sh2tKLb7Fb4PWMXg3rhNBJt8a+UGS5aN5lklLy SR5GAUjZX2d9+nSnIb3OUb0Ranw7bKzz9yzXIA7o82IxzHv/GLUpIaNrrDyki5LB gE0rot06wA11hwv9ZDua =Oin5 -----END PGP SIGNATURE----- --vSHPog3EoUl0rPKW3pRvkEVwkG1WG7sTx--