Skip to contentSkip to conversation

pinctrl: Fix trivial spelling typo in a comment

PATCH In review Charles Keepax 4 participants 23 messages Feb 16, 2017 – Mar 23, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 pinctrl: Fix trivial spelling typo in a comment

---

No changes since v1.

 drivers/pinctrl/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/core.c +1 -1
index d690465..0bf6392f 100644
@@ -525,7 +525,7 @@ pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev,
 EXPORT_SYMBOL_GPL(pinctrl_find_gpio_range_from_pin);
 
 /**
- * pinctrl_remove_gpio_range() - remove a range of GPIOs fro a pin controller
+ * pinctrl_remove_gpio_range() - remove a range of GPIOs from a pin controller
  * @pctldev: pin controller device to remove the range from
  * @range: the GPIO range to remove
  */
Signature · 1 line
2.1.4
#1 lore raw

PATCH v2 2/4 pinctrl: samsung: Register pinctrl before GPIO

If we request a GPIO hog, then gpiochip_add_data will attempt to request some of its own GPIOs. The driver also uses gpiochip_generic_request which means that for any GPIO request to succeed the pinctrl needs to be registered. Currently however the driver registers the GPIO and then the pinctrl meaning all GPIO hog requests will fail, which then in turn causes the whole driver to fail probe. Fix this up by ensuring we register the pinctrl first. Although currently there are no users of GPIO hogs in mainline there are plenty of Samsung based boards that are widely used for development purposes of other hardware. Indeed we hit this issue whilst attaching some additional hardware to an Arndale system.

---

Changes since v1:
- Updated commit message

 drivers/pinctrl/samsung/pinctrl-samsung.c | 32 +++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/pinctrl/samsung/pinctrl-samsung.c +16 -16
index d79eada..1134bc3 100644
@@ -893,6 +893,19 @@ static int samsung_pinctrl_register(struct platform_device *pdev,
 	return 0;
 }
 
+/* unregister the pinctrl interface with the pinctrl subsystem */
+static int samsung_pinctrl_unregister(struct platform_device *pdev,
+				      struct samsung_pinctrl_drv_data *drvdata)
+{
+	struct samsung_pin_bank *bank = drvdata->pin_banks;
+	int i;
+
+	for (i = 0; i < drvdata->nr_banks; ++i, ++bank)
+		pinctrl_remove_gpio_range(drvdata->pctl_dev, &bank->grange);
+
+	return 0;
+}
+
 static const struct gpio_chip samsung_gpiolib_chip = {
 	.request = gpiochip_generic_request,
 	.free = gpiochip_generic_free,
@@ -939,19 +952,6 @@ static int samsung_gpiolib_register(struct platform_device *pdev,
 	return ret;
 }
 
-/* unregister the gpiolib interface with the gpiolib subsystem */
-static int samsung_gpiolib_unregister(struct platform_device *pdev,
-				      struct samsung_pinctrl_drv_data *drvdata)
-{
-	struct samsung_pin_bank *bank = drvdata->pin_banks;
-	int i;
-
-	for (i = 0; i < drvdata->nr_banks; ++i, ++bank)
-		gpiochip_remove(&bank->gpio_chip);
-
-	return 0;
-}
-
 /* retrieve the soc specific data */
 static const struct samsung_pin_ctrl *
 samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d,
@@ -1063,13 +1063,13 @@ static int samsung_pinctrl_probe(struct platform_device *pdev)
 			return PTR_ERR(drvdata->retention_ctrl);
 	}
 
-	ret = samsung_gpiolib_register(pdev, drvdata);
+	ret = samsung_pinctrl_register(pdev, drvdata);
 	if (ret)
 		return ret;
 
-	ret = samsung_pinctrl_register(pdev, drvdata);
+	ret = samsung_gpiolib_register(pdev, drvdata);
 	if (ret) {
-		samsung_gpiolib_unregister(pdev, drvdata);
+		samsung_pinctrl_unregister(pdev, drvdata);
 		return ret;
 	}
 
Signature · 1 line
2.1.4
#2 lore raw

Re: [PATCH v2 2/4] pinctrl: samsung: Register pinctrl before GPIO

Quoted 11 lines · Charles Keepax

If we request a GPIO hog, then gpiochip_add_data will attempt to request some of its own GPIOs. The driver also uses gpiochip_generic_request which means that for any GPIO request to succeed the pinctrl needs to be registered. Currently however the driver registers the GPIO and then the pinctrl meaning all GPIO hog requests will fail, which then in turn causes the whole driver to fail probe. Fix this up by ensuring we register the pinctrl first. Although currently there are no users of GPIO hogs in mainline there are plenty of Samsung based boards that are widely used for development purposes of other hardware. Indeed we hit this issue whilst attaching some additional hardware to an Arndale system.

Quoted 6 lines

---

Changes since v1:
- Updated commit message

Patch applied. Will not be visible in -next until after the merge window though.

Yours,
Linus Walleij

#3 lore raw

Re: [PATCH v2 2/4] pinctrl: samsung: Register pinctrl before GPIO

Quoted 18 lines · Linus Walleij
Quoted 15 lines · Charles Keepax

If we request a GPIO hog, then gpiochip_add_data will attempt to request some of its own GPIOs. The driver also uses gpiochip_generic_request which means that for any GPIO request to succeed the pinctrl needs to be registered. Currently however the driver registers the GPIO and then the pinctrl meaning all GPIO hog requests will fail, which then in turn causes the whole driver to fail probe. Fix this up by ensuring we register the pinctrl first. Although currently there are no users of GPIO hogs in mainline there are plenty of Samsung based boards that are widely used for development purposes of other hardware. Indeed we hit this issue whilst attaching some additional hardware to an Arndale system.

---

Quoted 6 lines
Quoted 2 lines

Changes since v1:
- Updated commit message

Patch applied. Will not be visible in -next until after the merge window though.

Apologies but I think you might be best to drop this patch for now, it seems this causes the ranges passed to pinctrl_add_gpio_range to have the wrong .base, whilst I can actually see no ill effects from this on Arndale. I suspect this patch may be only part of the solution and may potentially cause issues for others even though it seems fine for me.

It does seem to there is some circular dependancy issues between setting up the pinctrl and setting up the gpio which crops up in the case of gpio hogs that may be more fundamental.

Thanks,
Charles

#4 lore raw

PATCH 1/1 pinctrl: samsung: Calculate GPIO base for pinctrl_add_gpio_range

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.

---

Ok I might have spoken to soon there looks like there is a simple way to fix this up, at least in this case. It would be much more of an issue if the driver allocated its GPIO base dynamically.

Thanks,
Charles

 drivers/pinctrl/samsung/pinctrl-samsung.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/samsung/pinctrl-samsung.c +1 -1
index ddc8d6b..864d8b4d 100644
@@ -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);
Signature · 1 line
2.1.4
#5 lore raw

Re: [PATCH] pinctrl: samsung: Calculate GPIO base for pinctrl_add_gpio_range

Hi Charles,

2017-02-24 2:54 GMT+09:00 Charles Keepax <[email protected]>:

Quoted 6 lines

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.

Please see my comment inline.

Quoted 19 lines

---

Ok I might have spoken to soon there looks like there is a simple way to fix this up, at least in this case. It would be much more of an issue if the driver allocated its GPIO base dynamically.

Thanks,
Charles

 drivers/pinctrl/samsung/pinctrl-samsung.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/samsung/pinctrl-samsung.c +0 -0
index ddc8d6b..864d8b4d 100644

drivers/pinctrl/samsung/pinctrl-samsung.c static int samsung_pinctrl_register(struct platform_device *pdev, · line 885

Quoted 5 lines
drivers/pinctrl/samsung/pinctrl-samsung.c +1 -1
@@ -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;

If we are not reading the base from the GPIO bank anymore, maybe it could make sense to actually make samsung_gpiolib_register() use bank->grange.base as gc->base? This way we would avoid explicitly numbering two times.

Best regards,
Tomasz

#6 lore raw

Re: [PATCH] pinctrl: samsung: Calculate GPIO base for pinctrl_add_gpio_range

Quoted 7 lines · Tomasz Figa
Quoted 7 lines
drivers/pinctrl/samsung/pinctrl-samsung.c +0 -0
index ddc8d6b..864d8b4d 100644
@@ -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
Quoted 9 lines

drivers/pinctrl/samsung/pinctrl-samsung.c static int samsung_pinctrl_register(struct platform_device *pdev, · line 885

Quoted 3 lines
drivers/pinctrl/samsung/pinctrl-samsung.c +1 -1
                                                + pin_bank->pin_base;
-               pin_bank->grange.base = pin_bank->gpio_chip.base;
+               pin_bank->grange.base = pin_bank->grange.pin_base;

If we are not reading the base from the GPIO bank anymore, maybe it could make sense to actually make samsung_gpiolib_register() use bank->grange.base as gc->base? This way we would avoid explicitly numbering two times.

Yeah no problem I can respin with that included.

Thanks,
Charles

#7 lore raw

PATCH v2 1/1 pinctrl: samsung: Calculate GPIO base for pinctrl_add_gpio_range

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.

---

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(-)
drivers/pinctrl/samsung/pinctrl-samsung.c +2 -2
index ddc8d6b..27d5157 100644
@@ -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;
Signature · 1 line
2.1.4
Acked-by on v2 1/1
#8 lore raw

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

Hi Charles,

2017-03-01 2:04 GMT+09:00 Charles Keepax <[email protected]>:

Quoted 6 lines

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?

Quoted 7 lines

---

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:

Best regards,
Tomasz

#9 lore raw

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

Quoted 10 lines · Tomasz Figa

Hi Charles,

2017-03-01 2:04 GMT+09:00 Charles Keepax <[email protected]>:

Quoted 6 lines

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.

Quoted 8 lines

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

#10 lore raw

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

Quoted 16 lines · Charles Keepax
Quoted 15 lines · Tomasz Figa

Hi Charles,

2017-03-01 2:04 GMT+09:00 Charles Keepax <[email protected]>:

Quoted 6 lines

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")
Quoted 7 lines
Quoted 3 lines

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

#11 lore raw

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

Quoted 27 lines · Krzysztof Kozlowski
Quoted 16 lines · Charles Keepax
Quoted 15 lines · Tomasz Figa

Hi Charles,

2017-03-01 2:04 GMT+09:00 Charles Keepax <[email protected]>:

Quoted 6 lines

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")
Quoted 7 lines
Quoted 3 lines

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,

Quoted 9 lines

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

#12 lore raw

Re: [PATCH v2 2/4] pinctrl: samsung: Register pinctrl before GPIO

In reply to Charles Keepax
Quoted 26 lines · Charles Keepax
Quoted 18 lines · Linus Walleij
Quoted 15 lines · Charles Keepax

If we request a GPIO hog, then gpiochip_add_data will attempt to request some of its own GPIOs. The driver also uses gpiochip_generic_request which means that for any GPIO request to succeed the pinctrl needs to be registered. Currently however the driver registers the GPIO and then the pinctrl meaning all GPIO hog requests will fail, which then in turn causes the whole driver to fail probe. Fix this up by ensuring we register the pinctrl first. Although currently there are no users of GPIO hogs in mainline there are plenty of Samsung based boards that are widely used for development purposes of other hardware. Indeed we hit this issue whilst attaching some additional hardware to an Arndale system.

---

Quoted 6 lines
Quoted 2 lines

Changes since v1:
- Updated commit message

Patch applied. Will not be visible in -next until after the merge window though.

Quoted 6 lines

Apologies but I think you might be best to drop this patch for now, it seems this causes the ranges passed to pinctrl_add_gpio_range to have the wrong .base, whilst I can actually see no ill effects from this on Arndale. I suspect this patch may be only part of the solution and may potentially cause issues for others even though it seems fine for me.

OK I dropped it.

Resend it if you figure it out.

The Samsung driver traffic is increasing, and there are now a bunch of developers starting to step on each others' toes.

Would you Samsung developers start considering someone who can collect Samsung pin control patches and send them as pull requests to me?

Yours,
Linus Walleij

#13 lore raw

Re: [PATCH v2 2/4] pinctrl: samsung: Register pinctrl before GPIO

Quoted 37 lines · Linus Walleij
Quoted 26 lines · Charles Keepax
Quoted 18 lines · Linus Walleij
Quoted 15 lines · Charles Keepax

If we request a GPIO hog, then gpiochip_add_data will attempt to request some of its own GPIOs. The driver also uses gpiochip_generic_request which means that for any GPIO request to succeed the pinctrl needs to be registered. Currently however the driver registers the GPIO and then the pinctrl meaning all GPIO hog requests will fail, which then in turn causes the whole driver to fail probe. Fix this up by ensuring we register the pinctrl first. Although currently there are no users of GPIO hogs in mainline there are plenty of Samsung based boards that are widely used for development purposes of other hardware. Indeed we hit this issue whilst attaching some additional hardware to an Arndale system.

---

Quoted 6 lines
Quoted 2 lines

Changes since v1:
- Updated commit message

Patch applied. Will not be visible in -next until after the merge window though.

Quoted 6 lines

Apologies but I think you might be best to drop this patch for now, it seems this causes the ranges passed to pinctrl_add_gpio_range to have the wrong .base, whilst I can actually see no ill effects from this on Arndale. I suspect this patch may be only part of the solution and may potentially cause issues for others even though it seems fine for me.

OK I dropped it.

Quoted 8 lines

Resend it if you figure it out.

The Samsung driver traffic is increasing, and there are now a bunch of developers starting to step on each others' toes.

Would you Samsung developers start considering someone who can collect Samsung pin control patches and send them as pull requests to me?

For some reason, some days ago I had impression that Sylwester is doing this already... but I was corrected that you are taking them directly. If Tomasz and Sylwester are willing to do this, they got my Ack.

If not, I can take it and set a separate repo on my kernel.org account.

Best regards,
Krzysztof

#14 lore raw

Re: [PATCH v2 2/4] pinctrl: samsung: Register pinctrl before GPIO

Quoted 47 lines · Krzysztof Kozlowski
Quoted 37 lines · Linus Walleij
Quoted 26 lines · Charles Keepax
Quoted 18 lines · Linus Walleij
Quoted 15 lines · Charles Keepax

If we request a GPIO hog, then gpiochip_add_data will attempt to request some of its own GPIOs. The driver also uses gpiochip_generic_request which means that for any GPIO request to succeed the pinctrl needs to be registered. Currently however the driver registers the GPIO and then the pinctrl meaning all GPIO hog requests will fail, which then in turn causes the whole driver to fail probe. Fix this up by ensuring we register the pinctrl first. Although currently there are no users of GPIO hogs in mainline there are plenty of Samsung based boards that are widely used for development purposes of other hardware. Indeed we hit this issue whilst attaching some additional hardware to an Arndale system.

---

Quoted 6 lines
Quoted 2 lines

Changes since v1:
- Updated commit message

Patch applied. Will not be visible in -next until after the merge window though.

Quoted 6 lines

Apologies but I think you might be best to drop this patch for now, it seems this causes the ranges passed to pinctrl_add_gpio_range to have the wrong .base, whilst I can actually see no ill effects from this on Arndale. I suspect this patch may be only part of the solution and may potentially cause issues for others even though it seems fine for me.

OK I dropped it.

Quoted 8 lines

Resend it if you figure it out.

The Samsung driver traffic is increasing, and there are now a bunch of developers starting to step on each others' toes.

Would you Samsung developers start considering someone who can collect Samsung pin control patches and send them as pull requests to me?

Quoted 6 lines

For some reason, some days ago I had impression that Sylwester is doing this already... but I was corrected that you are taking them directly. If Tomasz and Sylwester are willing to do this, they got my Ack.

If not, I can take it and set a separate repo on my kernel.org account.

That would be great, if there will be a lot of Samsung pin control work for this kernel cycle.

Yours,
Linus Walleij

#15 lore raw

PATCH v2 3/4 pinctrl: samsung: Remove unused local variable

In reply to Charles Keepax

The local variable drvdata is not used in samsung_gpio_set_direction.

---

Changes since v1:
- Update commit message

 drivers/pinctrl/samsung/pinctrl-samsung.c | 2 --
 1 file changed, 2 deletions(-)
drivers/pinctrl/samsung/pinctrl-samsung.c +0 -2
index 1134bc3..4ab20ec 100644
@@ -566,13 +566,11 @@ static int samsung_gpio_set_direction(struct gpio_chip *gc,
 {
 	const struct samsung_pin_bank_type *type;
 	struct samsung_pin_bank *bank;
-	struct samsung_pinctrl_drv_data *drvdata;
 	void __iomem *reg;
 	u32 data, mask, shift;
 
 	bank = gpiochip_get_data(gc);
 	type = bank->type;
-	drvdata = bank->drvdata;
 
 	reg = bank->pctl_base + bank->pctl_offset
 			+ type->reg_offset[PINCFG_TYPE_FUNC];
Signature · 1 line
2.1.4
#17 lore raw

PATCH v2 4/4 pinctrl: samsung: Use devres version of gpiochip_add_data

In reply to Charles Keepax

Use devm_gpiochip_add_data to simplify the error path in samsung_gpiolib_register. Additionally this would also fix a leak if the pinctrl driver was unbound, although admittedly I can't see any good use-case for doing so, but the driver does currently allow it.

---

Changes since v1:
- Update commit message.

 drivers/pinctrl/samsung/pinctrl-samsung.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/pinctrl/samsung/pinctrl-samsung.c +2 -7
index 4ab20ec..eb08f30 100644
@@ -934,20 +934,15 @@ static int samsung_gpiolib_register(struct platform_device *pdev,
 		gc->of_node = bank->of_node;
 		gc->label = bank->name;
 
-		ret = gpiochip_add_data(gc, bank);
+		ret = devm_gpiochip_add_data(&pdev->dev, gc, bank);
 		if (ret) {
 			dev_err(&pdev->dev, "failed to register gpio_chip %s, error code: %d\n",
 							gc->label, ret);
-			goto fail;
+			return ret;
 		}
 	}
 
 	return 0;
-
-fail:
-	for (--i, --bank; i >= 0; --i, --bank)
-		gpiochip_remove(&bank->gpio_chip);
-	return ret;
 }
 
 /* retrieve the soc specific data */
Signature · 1 line
2.1.4
maintainer Reviewed-by on v2 4/4
#18 lore raw

Re: [PATCH v2 4/4] pinctrl: samsung: Use devres version of gpiochip_add_data

Quoted 4 lines · Charles Keepax

Use devm_gpiochip_add_data to simplify the error path in samsung_gpiolib_register. Additionally this would also fix a leak if the pinctrl driver was unbound, although admittedly I can't see any good use-case for doing so, but the driver does currently allow it.

Driver does not allow unbinding (.suppress_bind_attrs = true)...

Regardless of this:

Best regards,
Krzysztof

#19 lore raw

Re: [PATCH v2 4/4] pinctrl: samsung: Use devres version of gpiochip_add_data

Quoted 8 lines · Krzysztof Kozlowski
Quoted 4 lines · Charles Keepax

Use devm_gpiochip_add_data to simplify the error path in samsung_gpiolib_register. Additionally this would also fix a leak if the pinctrl driver was unbound, although admittedly I can't see any good use-case for doing so, but the driver does currently allow it.

Driver does not allow unbinding (.suppress_bind_attrs = true)...

Oops... sorry missed that.

Thanks,
Charles

#20 lore raw

Re: [PATCH v2 4/4] pinctrl: samsung: Use devres version of gpiochip_add_data

Quoted 11 lines · Charles Keepax
Quoted 8 lines · Krzysztof Kozlowski
Quoted 4 lines · Charles Keepax

Use devm_gpiochip_add_data to simplify the error path in samsung_gpiolib_register. Additionally this would also fix a leak if the pinctrl driver was unbound, although admittedly I can't see any good use-case for doing so, but the driver does currently allow it.

Driver does not allow unbinding (.suppress_bind_attrs = true)...

Oops... sorry missed that.

Can you resend with updated commit msg? I think it was not picked up by Linus yet.

Best regards,
Krzysztof

#21 lore raw

Re: [PATCH v2 4/4] pinctrl: samsung: Use devres version of gpiochip_add_data

Quoted 8 lines · Krzysztof Kozlowski
Quoted 7 lines · Charles Keepax
Quoted 6 lines · Krzysztof Kozlowski
Quoted 4 lines · Charles Keepax

Use devm_gpiochip_add_data to simplify the error path in samsung_gpiolib_register. Additionally this would also fix a leak if the pinctrl driver was unbound, although admittedly I can't see any good use-case for doing so, but the driver does currently allow it.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Driver does not allow unbinding (.suppress_bind_attrs = true)...

Oops... sorry missed that.

Can you resend with updated commit msg? I think it was not picked up by Linus yet.

I'm expecting you to pick it up and send to me by pull request now I guess, or did we agree that a Samsung patches wouldn't be too voluminous this cycle?

If you're OK with it, can we proceed to use you as Samsung patch collection point for this kernel cycle from this moment on?

Yours,
Linus Walleij

#22 lore raw

Re: [PATCH v2 4/4] pinctrl: samsung: Use devres version of gpiochip_add_data

Quoted 17 lines · Linus Walleij
Quoted 8 lines · Krzysztof Kozlowski
Quoted 7 lines · Charles Keepax
Quoted 6 lines · Krzysztof Kozlowski
Quoted 4 lines · Charles Keepax

Use devm_gpiochip_add_data to simplify the error path in samsung_gpiolib_register. Additionally this would also fix a leak if the pinctrl driver was unbound, although admittedly I can't see any good use-case for doing so, but the driver does currently allow it.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Driver does not allow unbinding (.suppress_bind_attrs = true)...

Oops... sorry missed that.

Can you resend with updated commit msg? I think it was not picked up by Linus yet.

Quoted 6 lines

I'm expecting you to pick it up and send to me by pull request now I guess, or did we agree that a Samsung patches wouldn't be too voluminous this cycle?

If you're OK with it, can we proceed to use you as Samsung patch collection point for this kernel cycle from this moment on?

I will take it, especially that more things are coming. I already applied patch from Chanwoo which should go to fixes (initially I put it on wrong branch).

Best regards,
Krzysztof