linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] i2c: imx: use devm_request_threaded_irq to simplify code
@ 2020-10-23  8:18 peng.fan
  2020-10-23  8:18 ` [PATCH 2/2] i2c: imx: remove id_table entry peng.fan
  2020-10-23 15:23 ` [PATCH 1/2] i2c: imx: use devm_request_threaded_irq to simplify code Krzysztof Kozlowski
  0 siblings, 2 replies; 10+ messages in thread
From: peng.fan @ 2020-10-23  8:18 UTC (permalink / raw)
  To: shawnguo, s.hauer, festevam
  Cc: kernel, linux-imx, linux-i2c, linux-arm-kernel, linux-kernel, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

Use devm_request_threaded_irq to simplify code

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/i2c/busses/i2c-imx.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index e6f8d6e45a15..ba9d639223ec 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1216,8 +1216,8 @@ static int i2c_imx_probe(struct platform_device *pdev)
 		goto rpm_disable;
 
 	/* Request IRQ */
-	ret = request_threaded_irq(irq, i2c_imx_isr, NULL, IRQF_SHARED,
-				   pdev->name, i2c_imx);
+	ret = devm_request_threaded_irq(&pdev->dev, irq, i2c_imx_isr, NULL, IRQF_SHARED,
+					pdev->name, i2c_imx);
 	if (ret) {
 		dev_err(&pdev->dev, "can't claim irq %d\n", irq);
 		goto rpm_disable;
@@ -1265,7 +1265,6 @@ static int i2c_imx_probe(struct platform_device *pdev)
 
 clk_notifier_unregister:
 	clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
-	free_irq(irq, i2c_imx);
 rpm_disable:
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
@@ -1278,7 +1277,7 @@ static int i2c_imx_probe(struct platform_device *pdev)
 static int i2c_imx_remove(struct platform_device *pdev)
 {
 	struct imx_i2c_struct *i2c_imx = platform_get_drvdata(pdev);
-	int irq, ret;
+	int ret;
 
 	ret = pm_runtime_get_sync(&pdev->dev);
 	if (ret < 0)
@@ -1298,9 +1297,6 @@ static int i2c_imx_remove(struct platform_device *pdev)
 	imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2SR);
 
 	clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
-	irq = platform_get_irq(pdev, 0);
-	if (irq >= 0)
-		free_irq(irq, i2c_imx);
 	clk_disable_unprepare(i2c_imx->clk);
 
 	pm_runtime_put_noidle(&pdev->dev);
-- 
2.28.0


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

* [PATCH 2/2] i2c: imx: remove id_table entry
  2020-10-23  8:18 [PATCH 1/2] i2c: imx: use devm_request_threaded_irq to simplify code peng.fan
@ 2020-10-23  8:18 ` peng.fan
  2020-10-23 15:28   ` Krzysztof Kozlowski
  2020-10-23 15:23 ` [PATCH 1/2] i2c: imx: use devm_request_threaded_irq to simplify code Krzysztof Kozlowski
  1 sibling, 1 reply; 10+ messages in thread
From: peng.fan @ 2020-10-23  8:18 UTC (permalink / raw)
  To: shawnguo, s.hauer, festevam
  Cc: kernel, linux-imx, linux-i2c, linux-arm-kernel, linux-kernel, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

The legacy platform device code has been removed under arch/arm/mach-imx,
so we no need id_table entry here.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/i2c/busses/i2c-imx.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index ba9d639223ec..7ea36a78abb0 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -233,19 +233,6 @@ static struct imx_i2c_hwdata vf610_i2c_hwdata = {
 
 };
 
-static const struct platform_device_id imx_i2c_devtype[] = {
-	{
-		.name = "imx1-i2c",
-		.driver_data = (kernel_ulong_t)&imx1_i2c_hwdata,
-	}, {
-		.name = "imx21-i2c",
-		.driver_data = (kernel_ulong_t)&imx21_i2c_hwdata,
-	}, {
-		/* sentinel */
-	}
-};
-MODULE_DEVICE_TABLE(platform, imx_i2c_devtype);
-
 static const struct of_device_id i2c_imx_dt_ids[] = {
 	{ .compatible = "fsl,imx1-i2c", .data = &imx1_i2c_hwdata, },
 	{ .compatible = "fsl,imx21-i2c", .data = &imx21_i2c_hwdata, },
@@ -1340,7 +1327,6 @@ static struct platform_driver i2c_imx_driver = {
 		.of_match_table = i2c_imx_dt_ids,
 		.acpi_match_table = i2c_imx_acpi_ids,
 	},
-	.id_table = imx_i2c_devtype,
 };
 
 static int __init i2c_adap_imx_init(void)
-- 
2.28.0


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

* Re: [PATCH 1/2] i2c: imx: use devm_request_threaded_irq to simplify code
  2020-10-23  8:18 [PATCH 1/2] i2c: imx: use devm_request_threaded_irq to simplify code peng.fan
  2020-10-23  8:18 ` [PATCH 2/2] i2c: imx: remove id_table entry peng.fan
@ 2020-10-23 15:23 ` Krzysztof Kozlowski
  2020-10-24  7:39   ` Peng Fan
  1 sibling, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2020-10-23 15:23 UTC (permalink / raw)
  To: peng.fan
  Cc: shawnguo, s.hauer, festevam, kernel, linux-imx, linux-i2c,
	linux-arm-kernel, linux-kernel

On Fri, 23 Oct 2020 at 10:27, <peng.fan@nxp.com> wrote:
>
> From: Peng Fan <peng.fan@nxp.com>
>
> Use devm_request_threaded_irq to simplify code
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/i2c/busses/i2c-imx.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index e6f8d6e45a15..ba9d639223ec 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1216,8 +1216,8 @@ static int i2c_imx_probe(struct platform_device *pdev)
>                 goto rpm_disable;
>
>         /* Request IRQ */
> -       ret = request_threaded_irq(irq, i2c_imx_isr, NULL, IRQF_SHARED,
> -                                  pdev->name, i2c_imx);
> +       ret = devm_request_threaded_irq(&pdev->dev, irq, i2c_imx_isr, NULL, IRQF_SHARED,
> +                                       pdev->name, i2c_imx);

Really? You silently revert commit e50e4f0b85be ("i2c: imx: Fix
external abort on interrupt in exit paths"). This is not a
simplification but serious change. NAK. At least without proper
reasoning of why this is suddenly safe.

Best regards,
Krzysztof
Best regards,
Krzysztof

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

* Re: [PATCH 2/2] i2c: imx: remove id_table entry
  2020-10-23  8:18 ` [PATCH 2/2] i2c: imx: remove id_table entry peng.fan
@ 2020-10-23 15:28   ` Krzysztof Kozlowski
  2020-10-24  7:47     ` Peng Fan
  2020-10-26 23:53     ` Greg Ungerer
  0 siblings, 2 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2020-10-23 15:28 UTC (permalink / raw)
  To: peng.fan
  Cc: shawnguo, s.hauer, festevam, kernel, linux-imx, linux-i2c,
	linux-arm-kernel, linux-kernel, Greg Ungerer, Geert Uytterhoeven,
	linux-m68k, Angelo Dureghello

On Fri, Oct 23, 2020 at 04:18:23PM +0800, peng.fan@nxp.com wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> The legacy platform device code has been removed under arch/arm/mach-imx,
> so we no need id_table entry here.

Cc: Greg, Geert, Angelo,

Aren't you breaking Coldfire platforms?

Best regards,
Krzysztof

> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/i2c/busses/i2c-imx.c | 14 --------------
>  1 file changed, 14 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index ba9d639223ec..7ea36a78abb0 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -233,19 +233,6 @@ static struct imx_i2c_hwdata vf610_i2c_hwdata = {
>  
>  };
>  
> -static const struct platform_device_id imx_i2c_devtype[] = {
> -	{
> -		.name = "imx1-i2c",
> -		.driver_data = (kernel_ulong_t)&imx1_i2c_hwdata,
> -	}, {

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

* RE: [PATCH 1/2] i2c: imx: use devm_request_threaded_irq to simplify code
  2020-10-23 15:23 ` [PATCH 1/2] i2c: imx: use devm_request_threaded_irq to simplify code Krzysztof Kozlowski
@ 2020-10-24  7:39   ` Peng Fan
  2020-10-24 19:28     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 10+ messages in thread
From: Peng Fan @ 2020-10-24  7:39 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: shawnguo, s.hauer, festevam, kernel, dl-linux-imx, linux-i2c,
	linux-arm-kernel, linux-kernel

> Subject: Re: [PATCH 1/2] i2c: imx: use devm_request_threaded_irq to simplify
> code
> 
> On Fri, 23 Oct 2020 at 10:27, <peng.fan@nxp.com> wrote:
> >
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > Use devm_request_threaded_irq to simplify code
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  drivers/i2c/busses/i2c-imx.c | 10 +++-------
> >  1 file changed, 3 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-imx.c
> > b/drivers/i2c/busses/i2c-imx.c index e6f8d6e45a15..ba9d639223ec 100644
> > --- a/drivers/i2c/busses/i2c-imx.c
> > +++ b/drivers/i2c/busses/i2c-imx.c
> > @@ -1216,8 +1216,8 @@ static int i2c_imx_probe(struct platform_device
> *pdev)
> >                 goto rpm_disable;
> >
> >         /* Request IRQ */
> > -       ret = request_threaded_irq(irq, i2c_imx_isr, NULL, IRQF_SHARED,
> > -                                  pdev->name, i2c_imx);
> > +       ret = devm_request_threaded_irq(&pdev->dev, irq, i2c_imx_isr,
> NULL, IRQF_SHARED,
> > +                                       pdev->name, i2c_imx);
> 
> Really? You silently revert commit e50e4f0b85be ("i2c: imx: Fix external abort
> on interrupt in exit paths"). This is not a simplification but serious change. NAK.
> At least without proper reasoning of why this is suddenly safe.

Oh, I need look at git history before. But
Is it because i2c interrupt enabled too early? I'll try your case on i.MX8M platform.

Regards,
Peng.

> 
> Best regards,
> Krzysztof
> Best regards,
> Krzysztof

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

* RE: [PATCH 2/2] i2c: imx: remove id_table entry
  2020-10-23 15:28   ` Krzysztof Kozlowski
@ 2020-10-24  7:47     ` Peng Fan
  2020-10-24 19:25       ` Krzysztof Kozlowski
  2020-10-26 23:53     ` Greg Ungerer
  1 sibling, 1 reply; 10+ messages in thread
From: Peng Fan @ 2020-10-24  7:47 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: shawnguo, s.hauer, festevam, kernel, dl-linux-imx, linux-i2c,
	linux-arm-kernel, linux-kernel, Greg Ungerer, Geert Uytterhoeven,
	linux-m68k, Angelo Dureghello

> Subject: Re: [PATCH 2/2] i2c: imx: remove id_table entry
> 
> On Fri, Oct 23, 2020 at 04:18:23PM +0800, peng.fan@nxp.com wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > The legacy platform device code has been removed under
> > arch/arm/mach-imx, so we no need id_table entry here.
> 
> Cc: Greg, Geert, Angelo,
> 
> Aren't you breaking Coldfire platforms?

Ok, I see coldfire still use use imx1-i2c. Could we remove imx21-i2c or still
keep it?

Thanks
Peng.

> 
> Best regards,
> Krzysztof
> 
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  drivers/i2c/busses/i2c-imx.c | 14 --------------
> >  1 file changed, 14 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-imx.c
> > b/drivers/i2c/busses/i2c-imx.c index ba9d639223ec..7ea36a78abb0
> 100644
> > --- a/drivers/i2c/busses/i2c-imx.c
> > +++ b/drivers/i2c/busses/i2c-imx.c
> > @@ -233,19 +233,6 @@ static struct imx_i2c_hwdata vf610_i2c_hwdata =
> {
> >
> >  };
> >
> > -static const struct platform_device_id imx_i2c_devtype[] = {
> > -	{
> > -		.name = "imx1-i2c",
> > -		.driver_data = (kernel_ulong_t)&imx1_i2c_hwdata,
> > -	}, {

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

* Re: [PATCH 2/2] i2c: imx: remove id_table entry
  2020-10-24  7:47     ` Peng Fan
@ 2020-10-24 19:25       ` Krzysztof Kozlowski
  2020-10-26  1:41         ` Peng Fan
  0 siblings, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2020-10-24 19:25 UTC (permalink / raw)
  To: Peng Fan
  Cc: shawnguo, s.hauer, festevam, kernel, dl-linux-imx, linux-i2c,
	linux-arm-kernel, linux-kernel, Greg Ungerer, Geert Uytterhoeven,
	linux-m68k, Angelo Dureghello

On Sat, Oct 24, 2020 at 07:47:13AM +0000, Peng Fan wrote:
> > Subject: Re: [PATCH 2/2] i2c: imx: remove id_table entry
> > 
> > On Fri, Oct 23, 2020 at 04:18:23PM +0800, peng.fan@nxp.com wrote:
> > > From: Peng Fan <peng.fan@nxp.com>
> > >
> > > The legacy platform device code has been removed under
> > > arch/arm/mach-imx, so we no need id_table entry here.
> > 
> > Cc: Greg, Geert, Angelo,
> > 
> > Aren't you breaking Coldfire platforms?
> 
> Ok, I see coldfire still use use imx1-i2c. Could we remove imx21-i2c or still
> keep it?

Did you check if anything else uses it?

Best regards,
Krzysztof

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

* Re: [PATCH 1/2] i2c: imx: use devm_request_threaded_irq to simplify code
  2020-10-24  7:39   ` Peng Fan
@ 2020-10-24 19:28     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2020-10-24 19:28 UTC (permalink / raw)
  To: Peng Fan
  Cc: shawnguo, s.hauer, festevam, kernel, dl-linux-imx, linux-i2c,
	linux-arm-kernel, linux-kernel

On Sat, Oct 24, 2020 at 07:39:47AM +0000, Peng Fan wrote:
> > Subject: Re: [PATCH 1/2] i2c: imx: use devm_request_threaded_irq to simplify
> > code
> > 
> > On Fri, 23 Oct 2020 at 10:27, <peng.fan@nxp.com> wrote:
> > >
> > > From: Peng Fan <peng.fan@nxp.com>
> > >
> > > Use devm_request_threaded_irq to simplify code
> > >
> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > ---
> > >  drivers/i2c/busses/i2c-imx.c | 10 +++-------
> > >  1 file changed, 3 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/drivers/i2c/busses/i2c-imx.c
> > > b/drivers/i2c/busses/i2c-imx.c index e6f8d6e45a15..ba9d639223ec 100644
> > > --- a/drivers/i2c/busses/i2c-imx.c
> > > +++ b/drivers/i2c/busses/i2c-imx.c
> > > @@ -1216,8 +1216,8 @@ static int i2c_imx_probe(struct platform_device
> > *pdev)
> > >                 goto rpm_disable;
> > >
> > >         /* Request IRQ */
> > > -       ret = request_threaded_irq(irq, i2c_imx_isr, NULL, IRQF_SHARED,
> > > -                                  pdev->name, i2c_imx);
> > > +       ret = devm_request_threaded_irq(&pdev->dev, irq, i2c_imx_isr,
> > NULL, IRQF_SHARED,
> > > +                                       pdev->name, i2c_imx);
> > 
> > Really? You silently revert commit e50e4f0b85be ("i2c: imx: Fix external abort
> > on interrupt in exit paths"). This is not a simplification but serious change. NAK.
> > At least without proper reasoning of why this is suddenly safe.
> 
> Oh, I need look at git history before. But
> Is it because i2c interrupt enabled too early? I'll try your case on i.MX8M platform.

Shortly, it is because shared interrupts do not go well or at all with
devm-managed interrupt handlers. Probably they could be made working
with additional code, e.g. devm_free_irq() call or some additional
checks in interrupt handlers. But in that case there won't be much of
simplification.

Best regards,
Krzysztof


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

* RE: [PATCH 2/2] i2c: imx: remove id_table entry
  2020-10-24 19:25       ` Krzysztof Kozlowski
@ 2020-10-26  1:41         ` Peng Fan
  0 siblings, 0 replies; 10+ messages in thread
From: Peng Fan @ 2020-10-26  1:41 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: shawnguo, s.hauer, festevam, kernel, dl-linux-imx, linux-i2c,
	linux-arm-kernel, linux-kernel, Greg Ungerer, Geert Uytterhoeven,
	linux-m68k, Angelo Dureghello

> Subject: Re: [PATCH 2/2] i2c: imx: remove id_table entry
> 
> On Sat, Oct 24, 2020 at 07:47:13AM +0000, Peng Fan wrote:
> > > Subject: Re: [PATCH 2/2] i2c: imx: remove id_table entry
> > >
> > > On Fri, Oct 23, 2020 at 04:18:23PM +0800, peng.fan@nxp.com wrote:
> > > > From: Peng Fan <peng.fan@nxp.com>
> > > >
> > > > The legacy platform device code has been removed under
> > > > arch/arm/mach-imx, so we no need id_table entry here.
> > >
> > > Cc: Greg, Geert, Angelo,
> > >
> > > Aren't you breaking Coldfire platforms?
> >
> > Ok, I see coldfire still use use imx1-i2c. Could we remove imx21-i2c
> > or still keep it?
> 
> Did you check if anything else uses it?

Not find anyone use imx21-i2c under arch/* except arch/arm/boot/*dtsi

Thanks,
Peng.

> 
> Best regards,
> Krzysztof

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

* Re: [PATCH 2/2] i2c: imx: remove id_table entry
  2020-10-23 15:28   ` Krzysztof Kozlowski
  2020-10-24  7:47     ` Peng Fan
@ 2020-10-26 23:53     ` Greg Ungerer
  1 sibling, 0 replies; 10+ messages in thread
From: Greg Ungerer @ 2020-10-26 23:53 UTC (permalink / raw)
  To: Krzysztof Kozlowski, peng.fan
  Cc: shawnguo, s.hauer, festevam, kernel, linux-imx, linux-i2c,
	linux-arm-kernel, linux-kernel, Geert Uytterhoeven, linux-m68k,
	Angelo Dureghello


On 24/10/20 1:28 am, Krzysztof Kozlowski wrote:
> On Fri, Oct 23, 2020 at 04:18:23PM +0800, peng.fan@nxp.com wrote:
>> From: Peng Fan <peng.fan@nxp.com>
>>
>> The legacy platform device code has been removed under arch/arm/mach-imx,
>> so we no need id_table entry here.
> 
> Cc: Greg, Geert, Angelo,
> 
> Aren't you breaking Coldfire platforms?

Well spotted Krzysztof. It is used by quite a few of the ColdFire parts.

Regards
Greg


> Best regards,
> Krzysztof
> 
>>
>> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> ---
>>   drivers/i2c/busses/i2c-imx.c | 14 --------------
>>   1 file changed, 14 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
>> index ba9d639223ec..7ea36a78abb0 100644
>> --- a/drivers/i2c/busses/i2c-imx.c
>> +++ b/drivers/i2c/busses/i2c-imx.c
>> @@ -233,19 +233,6 @@ static struct imx_i2c_hwdata vf610_i2c_hwdata = {
>>   
>>   };
>>   
>> -static const struct platform_device_id imx_i2c_devtype[] = {
>> -	{
>> -		.name = "imx1-i2c",
>> -		.driver_data = (kernel_ulong_t)&imx1_i2c_hwdata,
>> -	}, {

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

end of thread, other threads:[~2020-10-27  0:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-23  8:18 [PATCH 1/2] i2c: imx: use devm_request_threaded_irq to simplify code peng.fan
2020-10-23  8:18 ` [PATCH 2/2] i2c: imx: remove id_table entry peng.fan
2020-10-23 15:28   ` Krzysztof Kozlowski
2020-10-24  7:47     ` Peng Fan
2020-10-24 19:25       ` Krzysztof Kozlowski
2020-10-26  1:41         ` Peng Fan
2020-10-26 23:53     ` Greg Ungerer
2020-10-23 15:23 ` [PATCH 1/2] i2c: imx: use devm_request_threaded_irq to simplify code Krzysztof Kozlowski
2020-10-24  7:39   ` Peng Fan
2020-10-24 19:28     ` Krzysztof Kozlowski

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).