diff mbox series

[06/15] ACPI: acpi_lpss: fix some coding style issues

Message ID 1616827256-51840-7-git-send-email-tanxiaofei@huawei.com
State New
Headers show
Series acpi: fix some coding style issues | expand

Commit Message

Xiaofei Tan March 27, 2021, 6:40 a.m. UTC
Fix some coding style issues reported by checkpatch.pl, including
following types:

WARNING: simple_strtol is obsolete, use kstrtol instead
WARNING: Missing a blank line after declarations

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
 drivers/acpi/acpi_lpss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

kernel test robot March 27, 2021, 8:41 a.m. UTC | #1
Hi Xiaofei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on v5.12-rc4 next-20210326]
[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/Xiaofei-Tan/acpi-fix-some-coding-style-issues/20210327-144714
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-a005-20210326 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d50fe9f0d6b9ee61df8830a67ea0a33c27a637e7)
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
        # https://github.com/0day-ci/linux/commit/31b45f08e2017005a1da942954093a6f09be7269
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Xiaofei-Tan/acpi-fix-some-coding-style-issues/20210327-144714
        git checkout 31b45f08e2017005a1da942954093a6f09be7269
        # 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
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/acpi/acpi_lpss.c:190:26: warning: incompatible pointer to integer conversion passing 'void *' to parameter of type 'unsigned int' [-Wint-conversion]
                   uid = kstrtol(uid_str, NULL, 10);
                                          ^~~~
   include/linux/stddef.h:8:14: note: expanded from macro 'NULL'
   #define NULL ((void *)0)
                ^~~~~~~~~~~
   include/linux/kernel.h:246:68: note: passing argument to parameter 'base' here
   static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
                                                                      ^
>> drivers/acpi/acpi_lpss.c:190:32: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'long *' [-Wint-conversion]
                   uid = kstrtol(uid_str, NULL, 10);
                                                ^~
   include/linux/kernel.h:246:80: note: passing argument to parameter 'res' here
   static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
                                                                                  ^
   2 warnings generated.


vim +190 drivers/acpi/acpi_lpss.c

   179	
   180	static void byt_i2c_setup(struct lpss_private_data *pdata)
   181	{
   182		const char *uid_str = acpi_device_uid(pdata->adev);
   183		acpi_handle handle = pdata->adev->handle;
   184		unsigned long long shared_host = 0;
   185		acpi_status status;
   186		long uid = 0;
   187	
   188		/* Expected to always be true, but better safe then sorry */
   189		if (uid_str)
 > 190			uid = kstrtol(uid_str, NULL, 10);
   191	
   192		/* Detect I2C bus shared with PUNIT and ignore its d3 status */
   193		status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
   194		if (ACPI_SUCCESS(status) && shared_host && uid)
   195			pmc_atom_d3_mask &= ~(BIT_LPSS2_F1_I2C1 << (uid - 1));
   196	
   197		lpss_deassert_reset(pdata);
   198	
   199		if (readl(pdata->mmio_base + pdata->dev_desc->prv_offset))
   200			pdata->fixed_clk_rate = 133000000;
   201	
   202		writel(0, pdata->mmio_base + LPSS_I2C_ENABLE);
   203	}
   204	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index be73974..2df231e 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -187,7 +187,7 @@  static void byt_i2c_setup(struct lpss_private_data *pdata)
 
 	/* Expected to always be true, but better safe then sorry */
 	if (uid_str)
-		uid = simple_strtol(uid_str, NULL, 10);
+		uid = kstrtol(uid_str, NULL, 10);
 
 	/* Detect I2C bus shared with PUNIT and ignore its d3 status */
 	status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
@@ -377,6 +377,7 @@  static const struct acpi_device_id acpi_lpss_device_ids[] = {
 static int is_memory(struct acpi_resource *res, void *not_used)
 {
 	struct resource r;
+
 	return !acpi_dev_resource_memory(res, &r);
 }
 
@@ -1200,6 +1201,7 @@  static int acpi_lpss_poweroff_noirq(struct device *dev)
 	if (pdata->dev_desc->resume_from_noirq) {
 		/* This is analogous to the acpi_lpss_suspend_noirq() case. */
 		int ret = acpi_lpss_do_poweroff_late(dev);
+
 		if (ret)
 			return ret;
 	}