diff mbox series

[2/2] spi: hisi-sfv-v3xx: drop unnecessary ACPI_PTR and related ifendif protection

Message ID 1617881505-51552-3-git-send-email-yangyicong@hisilicon.com
State Accepted
Commit 4a46f88681ca514f9cb33b39312d0ec4e2ec84da
Headers show
Series Minor updates for hisi-sfc-v3xx | expand

Commit Message

Yicong Yang April 8, 2021, 11:31 a.m. UTC
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(-)

Comments

Yicong Yang April 9, 2021, 7:17 a.m. UTC | #1
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
John Garry April 9, 2021, 2:25 p.m. UTC | #2
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
> 
> .
>
diff mbox series

Patch

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,
 };