linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pwm: lp3943: Dynamically allocate pwm chip base
@ 2020-10-30 13:41 Lokesh Vutla
  2020-10-30 20:11 ` Uwe Kleine-König
  2020-11-11 20:12 ` Thierry Reding
  0 siblings, 2 replies; 4+ messages in thread
From: Lokesh Vutla @ 2020-10-30 13:41 UTC (permalink / raw)
  To: Thierry Reding, u.kleine-koenig
  Cc: Lee Jones, linux-pwm, linux-kernel, Lokesh Vutla, Sekhar Nori

When there are other pwm controllers enabled along with pwm-lp3943,
pwm-lp3942 is failing to probe with -EEXIST error. This is because
other pwm controller is probed first and assigned pwmchip 0 and
pwm-lp3943 is requesting for 0 again. In order to avoid this, assign the
chip base with -1, so that id is dynamically allocated.

Fixes: af66b3c0934e ("pwm: Add LP3943 PWM driver")
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/pwm/pwm-lp3943.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c
index 7551253ada32..bf3f14fb5f24 100644
--- a/drivers/pwm/pwm-lp3943.c
+++ b/drivers/pwm/pwm-lp3943.c
@@ -275,6 +275,7 @@ static int lp3943_pwm_probe(struct platform_device *pdev)
 	lp3943_pwm->chip.dev = &pdev->dev;
 	lp3943_pwm->chip.ops = &lp3943_pwm_ops;
 	lp3943_pwm->chip.npwm = LP3943_NUM_PWMS;
+	lp3943_pwm->chip.base = -1;
 
 	platform_set_drvdata(pdev, lp3943_pwm);
 
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pwm: lp3943: Dynamically allocate pwm chip base
  2020-10-30 13:41 [PATCH] pwm: lp3943: Dynamically allocate pwm chip base Lokesh Vutla
@ 2020-10-30 20:11 ` Uwe Kleine-König
  2020-11-02  5:01   ` Lokesh Vutla
  2020-11-11 20:12 ` Thierry Reding
  1 sibling, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2020-10-30 20:11 UTC (permalink / raw)
  To: Lokesh Vutla
  Cc: Thierry Reding, Lee Jones, linux-pwm, linux-kernel, Sekhar Nori

[-- Attachment #1: Type: text/plain, Size: 847 bytes --]

On Fri, Oct 30, 2020 at 07:11:35PM +0530, Lokesh Vutla wrote:
> When there are other pwm controllers enabled along with pwm-lp3943,
> pwm-lp3942 is failing to probe with -EEXIST error. This is because
> other pwm controller is probed first and assigned pwmchip 0 and
> pwm-lp3943 is requesting for 0 again. In order to avoid this, assign the
> chip base with -1, so that id is dynamically allocated.
> 
> Fixes: af66b3c0934e ("pwm: Add LP3943 PWM driver")
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>

Reviewed-by: Uwe Kleine-König <u.kleine-könig@pengutronix.de>

With this patch applied only the pwm-ab8500 driver is left not using -1
for base.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pwm: lp3943: Dynamically allocate pwm chip base
  2020-10-30 20:11 ` Uwe Kleine-König
@ 2020-11-02  5:01   ` Lokesh Vutla
  0 siblings, 0 replies; 4+ messages in thread
From: Lokesh Vutla @ 2020-11-02  5:01 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Lee Jones, linux-pwm, linux-kernel, Sekhar Nori

Hi Uwe,

On 31/10/20 1:41 am, Uwe Kleine-König wrote:
> On Fri, Oct 30, 2020 at 07:11:35PM +0530, Lokesh Vutla wrote:
>> When there are other pwm controllers enabled along with pwm-lp3943,
>> pwm-lp3942 is failing to probe with -EEXIST error. This is because
>> other pwm controller is probed first and assigned pwmchip 0 and
>> pwm-lp3943 is requesting for 0 again. In order to avoid this, assign the
>> chip base with -1, so that id is dynamically allocated.
>>
>> Fixes: af66b3c0934e ("pwm: Add LP3943 PWM driver")
>> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> 
> Reviewed-by: Uwe Kleine-König <u.kleine-könig@pengutronix.de>

Thanks.

> 
> With this patch applied only the pwm-ab8500 driver is left not using -1
> for base.

pwm-ab8500 is assigning ab8500->chip.base as pdev->id. At least in the DT case
pdev->id is always -1(as of today). So, base is being allocated dynamically in
case of DT.

Thanks and regards,
Lokesh

> 
> Best regards
> Uwe
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pwm: lp3943: Dynamically allocate pwm chip base
  2020-10-30 13:41 [PATCH] pwm: lp3943: Dynamically allocate pwm chip base Lokesh Vutla
  2020-10-30 20:11 ` Uwe Kleine-König
@ 2020-11-11 20:12 ` Thierry Reding
  1 sibling, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2020-11-11 20:12 UTC (permalink / raw)
  To: Lokesh Vutla
  Cc: u.kleine-koenig, Lee Jones, linux-pwm, linux-kernel, Sekhar Nori

[-- Attachment #1: Type: text/plain, Size: 624 bytes --]

On Fri, Oct 30, 2020 at 07:11:35PM +0530, Lokesh Vutla wrote:
> When there are other pwm controllers enabled along with pwm-lp3943,
> pwm-lp3942 is failing to probe with -EEXIST error. This is because
> other pwm controller is probed first and assigned pwmchip 0 and
> pwm-lp3943 is requesting for 0 again. In order to avoid this, assign the
> chip base with -1, so that id is dynamically allocated.
> 
> Fixes: af66b3c0934e ("pwm: Add LP3943 PWM driver")
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> ---
>  drivers/pwm/pwm-lp3943.c | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-11 20:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30 13:41 [PATCH] pwm: lp3943: Dynamically allocate pwm chip base Lokesh Vutla
2020-10-30 20:11 ` Uwe Kleine-König
2020-11-02  5:01   ` Lokesh Vutla
2020-11-11 20:12 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).