Skip to contentSkip to conversation

Cleanups for ACPI APD driver

PATCH In review Hanjun Guo 2 participants 7 messages Sep 7, 2020 – Sep 25, 2020 ACPI

lore
Share & tools
lore

Hanjun Guo

author
#0 lore raw

v2 cover Cleanups for ACPI APD driver

ACPI APD driver has some unused code and some mis-behaved kernel doc, make a cleanup for this driver.

Tested on Hisilicon ARM64, and compile tested on Intel x86.

v1->v2:
- Fix the compile warning reported by kernel test robot.

Hanjun Guo (5):
ACPI / APD: Add kernel doc for the properties in struct
apd_device_desc
ACPI / APD: Remove the flags in struct apd_device_desc ACPI / APD: Remove ACPI_MODULE_NAME()
ACPI / APD: Remove the unneeded APD_ADDR(desc) macro define ACPI / APD: Head file including cleanups

 drivers/acpi/acpi_apd.c | 34 ++++++++--------------------------
 1 file changed, 8 insertions(+), 26 deletions(-)
Signature · 1 line
1.7.12.4
author
#1 lore raw

PATCH v2 1/5 ACPI / APD: Add kernel doc for the properties in struct apd_device_desc

commit 7ff55d174cbf ("ACPI / APD: Provide build-in properties of the UART") add the 'struct property_entry *properties' in struct apd_device_desc but didn't add the kernel doc, add it now.

---
 drivers/acpi/acpi_apd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/acpi/acpi_apd.c +1 -0
index 4c34837..6f39289 100644
@@ -34,6 +34,7 @@
  * @flags: device flags like %ACPI_APD_SYSFS, %ACPI_APD_PM
  * @fixed_clk_rate: fixed rate input clock source for acpi device;
  *			0 means no fixed rate input clock source
+ * @properties: build-in properties of the device such as UART
  * @setup: a hook routine to set device resource during create platform device
  *
  * Device description defined as acpi_device_id.driver_data
Signature · 1 line
1.7.12.4
author
#2 lore raw

PATCH v2 2/5 ACPI / APD: Remove the flags in struct apd_device_desc

In reply to Hanjun Guo

The flags is not used in anywhere, remove it and its related code.

---
 drivers/acpi/acpi_apd.c | 9 ---------
 1 file changed, 9 deletions(-)
drivers/acpi/acpi_apd.c +0 -9
index 6f39289..c4bc4ab 100644
@@ -23,15 +23,7 @@
 struct apd_private_data;
 
 /**
- * ACPI_APD_SYSFS : add device attributes in sysfs
- * ACPI_APD_PM : attach power domain to device
- */
-#define ACPI_APD_SYSFS	BIT(0)
-#define ACPI_APD_PM	BIT(1)
-
-/**
  * struct apd_device_desc - a descriptor for apd device
- * @flags: device flags like %ACPI_APD_SYSFS, %ACPI_APD_PM
  * @fixed_clk_rate: fixed rate input clock source for acpi device;
  *			0 means no fixed rate input clock source
  * @properties: build-in properties of the device such as UART
@@ -40,7 +32,6 @@
  * Device description defined as acpi_device_id.driver_data
  */
 struct apd_device_desc {
-	unsigned int flags;
 	unsigned int fixed_clk_rate;
 	struct property_entry *properties;
 	int (*setup)(struct apd_private_data *pdata);
Signature · 1 line
1.7.12.4
author
#3 lore raw

PATCH v2 3/5 ACPI / APD: Remove ACPI_MODULE_NAME()

In reply to Hanjun Guo

ACPI_MODULE_NAME() is used for ACPI debug output when using ACPI debug print functions, but ACPI debug print functions are not used in acpi_apd.c, remove the ACPI_MODULE_NAME().

---
 drivers/acpi/acpi_apd.c | 1 -
 1 file changed, 1 deletion(-)
drivers/acpi/acpi_apd.c +0 -1
index c4bc4ab..4dbf85b 100644
@@ -19,7 +19,6 @@
 
 #include "internal.h"
 
-ACPI_MODULE_NAME("acpi_apd");
 struct apd_private_data;
 
 /**
Signature · 1 line
1.7.12.4
author
#4 lore raw

PATCH v2 4/5 ACPI / APD: Remove the unneeded APD_ADDR(desc) macro define

In reply to Hanjun Guo

Since APD_ADDR(desc) is only used when CONFIG_X86_AMD_PLATFORM_DEVICE or CONFIG_ARM64 is set, no need for the redundant
'#define APD_ADDR(desc) (0UL)', remove it.

Also update the comments for #endif.

---
 drivers/acpi/acpi_apd.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/acpi/acpi_apd.c +3 -8
index 4dbf85b..561d9ba 100644
@@ -62,7 +62,6 @@ static int acpi_apd_setup(struct apd_private_data *pdata)
 }
 
 #ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
-
 static int misc_check_res(struct acpi_resource *ares, void *data)
 {
 	struct resource res;
@@ -133,7 +132,7 @@ static int fch_misc_setup(struct apd_private_data *pdata)
 static const struct apd_device_desc fch_misc_desc = {
 	.setup = fch_misc_setup,
 };
-#endif
+#endif /* CONFIG_X86_AMD_PLATFORM_DEVICE */
 
 #ifdef CONFIG_ARM64
 static const struct apd_device_desc xgene_i2c_desc = {
@@ -175,13 +174,9 @@ static int fch_misc_setup(struct apd_private_data *pdata)
 	.setup = acpi_apd_setup,
 	.fixed_clk_rate = 250000000,
 };
-#endif
+#endif /* CONFIG_ARM64 */
 
-#else
-
-#define APD_ADDR(desc) (0UL)
-
-#endif /* CONFIG_X86_AMD_PLATFORM_DEVICE */
+#endif
 
 /**
 * Create platform device during acpi scan attach handle.
Signature · 1 line
1.7.12.4
author
#5 lore raw

PATCH v2 5/5 ACPI / APD: Head file including cleanups

In reply to Hanjun Guo

Make the including head files to be alphabetical order, and remove the not needed head file inclusion.

---
 drivers/acpi/acpi_apd.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/acpi/acpi_apd.c +4 -6
index 561d9ba..05855db 100644
@@ -7,15 +7,13 @@
  *	Wu, Jeff <[email protected]>
  */
 
-#include <linux/clk-provider.h>
-#include <linux/platform_data/clk-fch.h>
-#include <linux/platform_device.h>
-#include <linux/pm_domain.h>
-#include <linux/clkdev.h>
 #include <linux/acpi.h>
+#include <linux/clkdev.h>
+#include <linux/clk-provider.h>
 #include <linux/err.h>
 #include <linux/io.h>
-#include <linux/pm.h>
+#include <linux/platform_data/clk-fch.h>
+#include <linux/platform_device.h>
 
 #include "internal.h"
 
Signature · 1 line
1.7.12.4
#6 lore raw
In reply to Hanjun Guo
Quoted 9 lines · Hanjun Guo

ACPI APD driver has some unused code and some mis-behaved kernel doc, make a cleanup for this driver.

Tested on Hisilicon ARM64, and compile tested on Intel x86.

v1->v2:
- Fix the compile warning reported by kernel test robot.

Quoted 7 lines

Hanjun Guo (5):
ACPI / APD: Add kernel doc for the properties in struct
apd_device_desc
ACPI / APD: Remove the flags in struct apd_device_desc ACPI / APD: Remove ACPI_MODULE_NAME()
ACPI / APD: Remove the unneeded APD_ADDR(desc) macro define ACPI / APD: Head file including cleanups

All applied as 5.10 material with edited subjects and changelogs, thanks!