diff mbox

[v2] pinctrl: samsung: Calculate GPIO base for pinctrl_add_gpio_range

Message ID 1488301475-10804-1-git-send-email-ckeepax@opensource.wolfsonmicro.com (mailing list archive)
State Superseded
Headers show

Commit Message

Charles Keepax Feb. 28, 2017, 5:04 p.m. UTC
As the pinctrl is now added before the GPIOs are registered we need to
manually calculate what the GPIO base will be, otherwise the base for
each gpio_range will be set to zero. Fortunately the driver
already assigns a GPIO base, in samsung_gpiolib_register, and uses the
same calculation it does for the pin_base. Meaning the two will always
be the same and allowing us to reuse the pinbase and avoid the issue.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---

Changes since v1:
 - Use grange.base in samsung_gpiolib_register to make it more
   clear the two are related in the driver.

Thanks,
Charles


 drivers/pinctrl/samsung/pinctrl-samsung.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tomasz Figa March 4, 2017, 11:20 a.m. UTC | #1
Hi Charles,

2017-03-01 2:04 GMT+09:00 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>:
> As the pinctrl is now added before the GPIOs are registered we need to
> manually calculate what the GPIO base will be, otherwise the base for
> each gpio_range will be set to zero. Fortunately the driver
> already assigns a GPIO base, in samsung_gpiolib_register, and uses the
> same calculation it does for the pin_base. Meaning the two will always
> be the same and allowing us to reuse the pinbase and avoid the issue.

Sorry, I didn't notice before and I don't see the offending patch in ,
but you should add

Fixes: XXXXXXXXXXXX ("pinctrl: Patch subject")

if you intend to submit this patch separately. Otherwise, maybe this
can be just squashed?

>
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
>
> Changes since v1:
>  - Use grange.base in samsung_gpiolib_register to make it more
>    clear the two are related in the driver.

Other than the above:

Acked-by: Tomasz Figa <tomasz.figa@gmail.com>

Best regards,
Tomasz
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Charles Keepax March 6, 2017, 4:49 p.m. UTC | #2
On Sat, Mar 04, 2017 at 08:20:11PM +0900, Tomasz Figa wrote:
> Hi Charles,
> 
> 2017-03-01 2:04 GMT+09:00 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>:
> > As the pinctrl is now added before the GPIOs are registered we need to
> > manually calculate what the GPIO base will be, otherwise the base for
> > each gpio_range will be set to zero. Fortunately the driver
> > already assigns a GPIO base, in samsung_gpiolib_register, and uses the
> > same calculation it does for the pin_base. Meaning the two will always
> > be the same and allowing us to reuse the pinbase and avoid the issue.
> 
> Sorry, I didn't notice before and I don't see the offending patch in ,
> but you should add
> 
> Fixes: XXXXXXXXXXXX ("pinctrl: Patch subject")
> 
> if you intend to submit this patch separately. Otherwise, maybe this
> can be just squashed?
> 

Yeah apologies for that as the original patch hasn't showed up in
the tree yet I couldn't pull a commit ID to add the fixes tag.
Squashing it in is probably the best way to go.

Thanks,
Charles
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Krzysztof Kozlowski March 20, 2017, 6:39 p.m. UTC | #3
On Mon, Mar 06, 2017 at 04:49:09PM +0000, Charles Keepax wrote:
> On Sat, Mar 04, 2017 at 08:20:11PM +0900, Tomasz Figa wrote:
> > Hi Charles,
> > 
> > 2017-03-01 2:04 GMT+09:00 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>:
> > > As the pinctrl is now added before the GPIOs are registered we need to
> > > manually calculate what the GPIO base will be, otherwise the base for
> > > each gpio_range will be set to zero. Fortunately the driver
> > > already assigns a GPIO base, in samsung_gpiolib_register, and uses the
> > > same calculation it does for the pin_base. Meaning the two will always
> > > be the same and allowing us to reuse the pinbase and avoid the issue.
> > 
> > Sorry, I didn't notice before and I don't see the offending patch in ,
> > but you should add
> > 
> > Fixes: XXXXXXXXXXXX ("pinctrl: Patch subject")
> > 
> > if you intend to submit this patch separately. Otherwise, maybe this
> > can be just squashed?
> > 
> 
> Yeah apologies for that as the original patch hasn't showed up in
> the tree yet I couldn't pull a commit ID to add the fixes tag.
> Squashing it in is probably the best way to go.

Hi Charles,

Thanks for the work.

This is a follow up of:
https://patchwork.kernel.org/patch/9577147/
Right?

None of these two were applied so can you squash them, rebase, retest
and send again?

Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Charles Keepax March 21, 2017, 9:32 a.m. UTC | #4
On Mon, Mar 20, 2017 at 08:39:15PM +0200, Krzysztof Kozlowski wrote:
> On Mon, Mar 06, 2017 at 04:49:09PM +0000, Charles Keepax wrote:
> > On Sat, Mar 04, 2017 at 08:20:11PM +0900, Tomasz Figa wrote:
> > > Hi Charles,
> > > 
> > > 2017-03-01 2:04 GMT+09:00 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>:
> > > > As the pinctrl is now added before the GPIOs are registered we need to
> > > > manually calculate what the GPIO base will be, otherwise the base for
> > > > each gpio_range will be set to zero. Fortunately the driver
> > > > already assigns a GPIO base, in samsung_gpiolib_register, and uses the
> > > > same calculation it does for the pin_base. Meaning the two will always
> > > > be the same and allowing us to reuse the pinbase and avoid the issue.
> > > 
> > > Sorry, I didn't notice before and I don't see the offending patch in ,
> > > but you should add
> > > 
> > > Fixes: XXXXXXXXXXXX ("pinctrl: Patch subject")
> > > 
> > > if you intend to submit this patch separately. Otherwise, maybe this
> > > can be just squashed?
> > > 
> > 
> > Yeah apologies for that as the original patch hasn't showed up in
> > the tree yet I couldn't pull a commit ID to add the fixes tag.
> > Squashing it in is probably the best way to go.
> 
> Hi Charles,
> 
> Thanks for the work.
> 
> This is a follow up of:
> https://patchwork.kernel.org/patch/9577147/
> Right?
> 
> None of these two were applied so can you squash them, rebase, retest
> and send again?
> 

Yeah no problem should be able to resend later today hopefully.

Thanks,
Charles
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index ddc8d6b..27d5157 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -882,7 +882,7 @@  static int samsung_pinctrl_register(struct platform_device *pdev,
 		pin_bank->grange.id = bank;
 		pin_bank->grange.pin_base = drvdata->pin_base
 						+ pin_bank->pin_base;
-		pin_bank->grange.base = pin_bank->gpio_chip.base;
+		pin_bank->grange.base = pin_bank->grange.pin_base;
 		pin_bank->grange.npins = pin_bank->gpio_chip.ngpio;
 		pin_bank->grange.gc = &pin_bank->gpio_chip;
 		pinctrl_add_gpio_range(drvdata->pctl_dev, &pin_bank->grange);
@@ -928,7 +928,7 @@  static int samsung_gpiolib_register(struct platform_device *pdev,
 		bank->gpio_chip = samsung_gpiolib_chip;
 
 		gc = &bank->gpio_chip;
-		gc->base = drvdata->pin_base + bank->pin_base;
+		gc->base = bank->grange.base;
 		gc->ngpio = bank->nr_pins;
 		gc->parent = &pdev->dev;
 		gc->of_node = bank->of_node;