Skip to contentSkip to conversation

Cleanups for ACPI APD driver

PATCH Superseded Hanjun Guo 2 participants 10 messages Sep 7, 2020 – Sep 9, 2020 ACPI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Hanjun Guo

author
#0 lore raw

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.

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 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 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 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 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 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 | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/acpi/acpi_apd.c +4 -8
index 561d9ba..5d50ca7 100644
@@ -7,17 +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 "internal.h"
+#include <linux/platform_data/clk-fch.h>
+#include <linux/platform_device.h>
 
 struct apd_private_data;
 
Signature · 1 line
1.7.12.4
#6 lore raw

Re: [PATCH 5/5] ACPI / APD: Head file including cleanups

I love your patch! Perhaps something to improve:

Hi Hanjun,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on v5.9-rc4 next-20200903]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hanjun-Guo/Cleanups-for-ACPI-APD-driver/20200907-170548
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-s022-20200907 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-191-g10164920-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/acpi/acpi_apd.c:250:13: warning: no previous prototype for 'acpi_apd_init' [-Wmissing-prototypes]
     250 | void __init acpi_apd_init(void)
         |             ^~~~~~~~~~~~~

# https://github.com/0day-ci/linux/commit/a8b5a7197395679505a8a3126b829495abe2ae13
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Hanjun-Guo/Cleanups-for-ACPI-APD-driver/20200907-170548 git checkout a8b5a7197395679505a8a3126b829495abe2ae13
vim +/acpi_apd_init +250 drivers/acpi/acpi_apd.c

92082a8886f30a Ken Xue 2015-02-06 249
92082a8886f30a Ken Xue 2015-02-06 @250 void __init acpi_apd_init(void)

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

author
#7 lore raw

Re: [PATCH 5/5] ACPI / APD: Head file including cleanups

Quoted 20 lines · kernel test robot

Hi Hanjun,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on v5.9-rc4 next-20200903]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hanjun-Guo/Cleanups-for-ACPI-APD-driver/20200907-170548
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-s022-20200907 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
         # apt-get install sparse
         # sparse version: v0.6.2-191-g10164920-dirty
         # save the attached .config to linux build tree
         make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
Quoted 8 lines

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

drivers/acpi/acpi_apd.c:250:13: warning: no previous prototype for 'acpi_apd_init' [-Wmissing-prototypes]

      250 | void __init acpi_apd_init(void)
          |             ^~~~~~~~~~~~~

Hmm, I didn't get this locally, I think it's because acpi_apd_init() is added in the head file internal.h, but I removed the internal.h inclusion for head file, I will add it back.

Thanks
Hanjun

#8 lore raw

Re: [PATCH 5/5] ACPI / APD: Head file including cleanups

In reply to Hanjun Guo
I love your patch! Perhaps something to improve:

Hi Hanjun,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on v5.9-rc4 next-20200903]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hanjun-Guo/Cleanups-for-ACPI-APD-driver/20200907-170548
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-r021-20200907 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ab68517e6b7e51b84c4b0e813a30258ec1ce5da5)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/acpi/acpi_apd.c:250:13: warning: no previous prototype for function 'acpi_apd_init' [-Wmissing-prototypes]
   void __init acpi_apd_init(void)
               ^

drivers/acpi/acpi_apd.c:250:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __init acpi_apd_init(void)
^
static
1 warning generated.

# https://github.com/0day-ci/linux/commit/a8b5a7197395679505a8a3126b829495abe2ae13
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Hanjun-Guo/Cleanups-for-ACPI-APD-driver/20200907-170548 git checkout a8b5a7197395679505a8a3126b829495abe2ae13
vim +/acpi_apd_init +250 drivers/acpi/acpi_apd.c

92082a8886f30a Ken Xue 2015-02-06 249
92082a8886f30a Ken Xue 2015-02-06 @250 void __init acpi_apd_init(void)

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

author
#9 lore raw

Re: [PATCH 5/5] ACPI / APD: Head file including cleanups

Quoted 27 lines · kernel test robot

Hi Hanjun,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on v5.9-rc4 next-20200903]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Hanjun-Guo/Cleanups-for-ACPI-APD-driver/20200907-170548
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-r021-20200907 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ab68517e6b7e51b84c4b0e813a30258ec1ce5da5)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

Quoted 8 lines
Quoted 1 line
Quoted 1 line

drivers/acpi/acpi_apd.c:250:13: warning: no previous prototype for function 'acpi_apd_init' [-Wmissing-prototypes]

void __init acpi_apd_init(void)
^
drivers/acpi/acpi_apd.c:250:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void __init acpi_apd_init(void)
^
static
1 warning generated.

I think this was fixed in v2.

Thanks for the report!

Hanjun