linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Minor updates for hisi-sfc-v3xx
@ 2021-04-08 11:31 Yicong Yang
  2021-04-08 11:31 ` [PATCH 1/2] spi: hisi-sfc-v3xx: fix potential irq race condition Yicong Yang
  2021-04-08 11:31 ` [PATCH 2/2] spi: hisi-sfv-v3xx: drop unnecessary ACPI_PTR and related ifendif protection Yicong Yang
  0 siblings, 2 replies; 7+ messages in thread
From: Yicong Yang @ 2021-04-08 11:31 UTC (permalink / raw)
  To: broonie, linux-spi; +Cc: john.garry, prime.zeng, yangyicong, linuxarm

This series fix a potential interrupt race condition and
cleanup the ACPI protection for the driver.

Yicong Yang (2):
  spi: hisi-sfc-v3xx: fix potential irq race condition
  spi: hisi-sfv-v3xx: drop unnecessary ACPI_PTR and related ifendif
    protection

 drivers/spi/spi-hisi-sfc-v3xx.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

-- 
2.8.1


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

* [PATCH 1/2] spi: hisi-sfc-v3xx: fix potential irq race condition
  2021-04-08 11:31 [PATCH 0/2] Minor updates for hisi-sfc-v3xx Yicong Yang
@ 2021-04-08 11:31 ` Yicong Yang
  2021-04-08 11:31 ` [PATCH 2/2] spi: hisi-sfv-v3xx: drop unnecessary ACPI_PTR and related ifendif protection Yicong Yang
  1 sibling, 0 replies; 7+ messages in thread
From: Yicong Yang @ 2021-04-08 11:31 UTC (permalink / raw)
  To: broonie, linux-spi; +Cc: john.garry, prime.zeng, yangyicong, linuxarm

We mask the irq when the command completion is timeout. This won't
stop the already running irq handler. Use sychronize_irq() after
we mask the irq, to make sure there is no running handler.

Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
---
 drivers/spi/spi-hisi-sfc-v3xx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-hisi-sfc-v3xx.c b/drivers/spi/spi-hisi-sfc-v3xx.c
index 385eb7b..0d9e103 100644
--- a/drivers/spi/spi-hisi-sfc-v3xx.c
+++ b/drivers/spi/spi-hisi-sfc-v3xx.c
@@ -342,6 +342,7 @@ static int hisi_sfc_v3xx_generic_exec_op(struct hisi_sfc_v3xx_host *host,
 			ret = 0;
 
 		hisi_sfc_v3xx_disable_int(host);
+		synchronize_irq(host->irq);
 		host->completion = NULL;
 	} else {
 		ret = hisi_sfc_v3xx_wait_cmd_idle(host);
-- 
2.8.1


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

* [PATCH 2/2] spi: hisi-sfv-v3xx: drop unnecessary ACPI_PTR and related ifendif protection
  2021-04-08 11:31 [PATCH 0/2] Minor updates for hisi-sfc-v3xx Yicong Yang
  2021-04-08 11:31 ` [PATCH 1/2] spi: hisi-sfc-v3xx: fix potential irq race condition Yicong Yang
@ 2021-04-08 11:31 ` Yicong Yang
  2021-04-08 13:51   ` Mark Brown
  1 sibling, 1 reply; 7+ messages in thread
From: Yicong Yang @ 2021-04-08 11:31 UTC (permalink / raw)
  To: broonie, linux-spi; +Cc: john.garry, prime.zeng, yangyicong, linuxarm

The ACPI_PTR() and related IS_ENABLED(CONFIG_ACPI) protection is
redundant, so drop them.

Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
---
 drivers/spi/spi-hisi-sfc-v3xx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-hisi-sfc-v3xx.c b/drivers/spi/spi-hisi-sfc-v3xx.c
index 0d9e103..d3a23b1 100644
--- a/drivers/spi/spi-hisi-sfc-v3xx.c
+++ b/drivers/spi/spi-hisi-sfc-v3xx.c
@@ -5,13 +5,13 @@
 // Copyright (c) 2019 HiSilicon Technologies Co., Ltd.
 // Author: John Garry <john.garry@huawei.com>
 
-#include <linux/acpi.h>
 #include <linux/bitops.h>
 #include <linux/completion.h>
 #include <linux/dmi.h>
 #include <linux/interrupt.h>
 #include <linux/iopoll.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
@@ -508,18 +508,16 @@ static int hisi_sfc_v3xx_probe(struct platform_device *pdev)
 	return ret;
 }
 
-#if IS_ENABLED(CONFIG_ACPI)
 static const struct acpi_device_id hisi_sfc_v3xx_acpi_ids[] = {
 	{"HISI0341", 0},
 	{}
 };
 MODULE_DEVICE_TABLE(acpi, hisi_sfc_v3xx_acpi_ids);
-#endif
 
 static struct platform_driver hisi_sfc_v3xx_spi_driver = {
 	.driver = {
 		.name	= "hisi-sfc-v3xx",
-		.acpi_match_table = ACPI_PTR(hisi_sfc_v3xx_acpi_ids),
+		.acpi_match_table = hisi_sfc_v3xx_acpi_ids,
 	},
 	.probe	= hisi_sfc_v3xx_probe,
 };
-- 
2.8.1


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

* Re: [PATCH 2/2] spi: hisi-sfv-v3xx: drop unnecessary ACPI_PTR and related ifendif protection
  2021-04-08 11:31 ` [PATCH 2/2] spi: hisi-sfv-v3xx: drop unnecessary ACPI_PTR and related ifendif protection Yicong Yang
@ 2021-04-08 13:51   ` Mark Brown
  2021-04-09  7:17     ` Yicong Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2021-04-08 13:51 UTC (permalink / raw)
  To: Yicong Yang; +Cc: linux-spi, john.garry, prime.zeng, linuxarm

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

On Thu, Apr 08, 2021 at 07:31:45PM +0800, Yicong Yang wrote:
> The ACPI_PTR() and related IS_ENABLED(CONFIG_ACPI) protection is
> redundant, so drop them.

The driver supports building without ACPI so are you sure these are
redundant?

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

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

* Re: [PATCH 2/2] spi: hisi-sfv-v3xx: drop unnecessary ACPI_PTR and related ifendif protection
  2021-04-08 13:51   ` Mark Brown
@ 2021-04-09  7:17     ` Yicong Yang
  2021-04-09 14:25       ` John Garry
  0 siblings, 1 reply; 7+ messages in thread
From: Yicong Yang @ 2021-04-09  7:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi, john.garry, prime.zeng, linuxarm

On 2021/4/8 21:51, Mark Brown wrote:
> On Thu, Apr 08, 2021 at 07:31:45PM +0800, Yicong Yang wrote:
>> The ACPI_PTR() and related IS_ENABLED(CONFIG_ACPI) protection is
>> redundant, so drop them.
> 
> The driver supports building without ACPI so are you sure these are
> redundant?
> 

yes. we're not using any acpi function in this driver. What ifdef macro
and ACPI_PTR() protects is struct acpi_device_id, which is defined in
mod_devicetable.h rather than acpi.h. It can be built when ACPI=n.

some similiar cleanups can be found:
6c328c347ac3 ("platform/x86: i2c-multi-instantiate: Drop redundant ACPI_PTR()")
846afc1dbcbf ("iio: accel: bma220: Drop ACPI_PTR() and accompanying ifdeffery")
[...]

Thanks,
Yicong


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

* Re: [PATCH 2/2] spi: hisi-sfv-v3xx: drop unnecessary ACPI_PTR and related ifendif protection
  2021-04-09  7:17     ` Yicong Yang
@ 2021-04-09 14:25       ` John Garry
  2021-04-09 15:11         ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: John Garry @ 2021-04-09 14:25 UTC (permalink / raw)
  To: Yicong Yang, Mark Brown; +Cc: linux-spi, prime.zeng, linuxarm

On 09/04/2021 08:17, Yicong Yang wrote:
> On 2021/4/8 21:51, Mark Brown wrote:
>> On Thu, Apr 08, 2021 at 07:31:45PM +0800, Yicong Yang wrote:
>>> The ACPI_PTR() and related IS_ENABLED(CONFIG_ACPI) protection is
>>> redundant, so drop them.
>>
>> The driver supports building without ACPI so are you sure these are
>> redundant?
>>
> 
> yes. we're not using any acpi function in this driver. What ifdef macro
> and ACPI_PTR() protects is struct acpi_device_id, which is defined in
> mod_devicetable.h rather than acpi.h. It can be built when ACPI=n.
> 

I asked the exact same thing, so another version with an updated commit 
message with this info could be useful. Mark's call, though.

Thanks,
John

> some similiar cleanups can be found:
> 6c328c347ac3 ("platform/x86: i2c-multi-instantiate: Drop redundant ACPI_PTR()")
> 846afc1dbcbf ("iio: accel: bma220: Drop ACPI_PTR() and accompanying ifdeffery")
> [...]
> 
> Thanks,
> Yicong
> 
> .
> 


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

* Re: [PATCH 2/2] spi: hisi-sfv-v3xx: drop unnecessary ACPI_PTR and related ifendif protection
  2021-04-09 14:25       ` John Garry
@ 2021-04-09 15:11         ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2021-04-09 15:11 UTC (permalink / raw)
  To: John Garry; +Cc: Yicong Yang, linux-spi, prime.zeng, linuxarm

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

On Fri, Apr 09, 2021 at 03:25:49PM +0100, John Garry wrote:
> On 09/04/2021 08:17, Yicong Yang wrote:

> > yes. we're not using any acpi function in this driver. What ifdef macro
> > and ACPI_PTR() protects is struct acpi_device_id, which is defined in
> > mod_devicetable.h rather than acpi.h. It can be built when ACPI=n.

> I asked the exact same thing, so another version with an updated commit
> message with this info could be useful. Mark's call, though.

Yes, please.

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

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

end of thread, other threads:[~2021-04-09 15:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 11:31 [PATCH 0/2] Minor updates for hisi-sfc-v3xx Yicong Yang
2021-04-08 11:31 ` [PATCH 1/2] spi: hisi-sfc-v3xx: fix potential irq race condition Yicong Yang
2021-04-08 11:31 ` [PATCH 2/2] spi: hisi-sfv-v3xx: drop unnecessary ACPI_PTR and related ifendif protection Yicong Yang
2021-04-08 13:51   ` Mark Brown
2021-04-09  7:17     ` Yicong Yang
2021-04-09 14:25       ` John Garry
2021-04-09 15:11         ` Mark Brown

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