Skip to contentSkip to conversation

ACPI / utils: Describe function parameters in kernel-doc

PATCH Superseded Andy Shevchenko 2 participants 10 messages Sep 24, 2019

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 ACPI / utils: Describe function parameters in kernel-doc

Kernel documentation script complains that some of the function parameters are not described:

drivers/acpi/utils.c:462: warning: Function parameter or member 'handle' not described in 'acpi_handle_path' drivers/acpi/utils.c:484: warning: Function parameter or member 'level' not described in 'acpi_handle_printk' drivers/acpi/utils.c:484: warning: Function parameter or member 'handle' not described in 'acpi_handle_printk' drivers/acpi/utils.c:484: warning: Function parameter or member 'fmt' not described in 'acpi_handle_printk' drivers/acpi/utils.c:513: warning: Function parameter or member 'descriptor' not described in '__acpi_handle_debug' drivers/acpi/utils.c:513: warning: Function parameter or member 'handle' not described in '__acpi_handle_debug' drivers/acpi/utils.c:513: warning: Function parameter or member 'fmt' not described in '__acpi_handle_debug'

Describe function parameters where it's appropriate.

---
 drivers/acpi/utils.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/acpi/utils.c +7 -0
index e3974a8f8fd4..dbd1c4cfd7d1 100644
@@ -455,6 +455,7 @@ EXPORT_SYMBOL(acpi_evaluate_ost);
 
 /**
  * acpi_handle_path: Return the object path of handle
+ * @handle: ACPI device handle
  *
  * Caller must free the returned buffer
  */
@@ -473,6 +474,9 @@ static char *acpi_handle_path(acpi_handle handle)
 
 /**
  * acpi_handle_printk: Print message with ACPI prefix and object path
+ * @level: log level
+ * @handle: ACPI device handle
+ * @fmt: format string
  *
  * This function is called through acpi_handle_<level> macros and prints
  * a message with ACPI prefix and object path.  This function acquires
@@ -501,6 +505,9 @@ EXPORT_SYMBOL(acpi_handle_printk);
 #if defined(CONFIG_DYNAMIC_DEBUG)
 /**
  * __acpi_handle_debug: pr_debug with ACPI prefix and object path
+ * @descriptor: Dynamic Debug descriptor
+ * @handle: ACPI device handle
+ * @fmt: format string
  *
  * This function is called through acpi_handle_debug macro and debug
  * prints a message with ACPI prefix and object path. This function
Signature · 1 line
2.23.0
#1 lore raw

PATCH 2/5 ACPI / utils: Introduce acpi_dev_hid_uid_match() helper

There are users outside of ACPI realm which reimplementing the comparator function to check if the given device matches to given HID and UID.

For better utilization, introduce a helper for everyone to use.

---
 drivers/acpi/utils.c    | 25 +++++++++++++++++++++++++
 include/acpi/acpi_bus.h |  3 +++
 include/linux/acpi.h    |  6 ++++++
 3 files changed, 34 insertions(+)
drivers/acpi/utils.c +25 -0
index dbd1c4cfd7d1..804ac0df58ec 100644
@@ -701,6 +701,31 @@ bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs)
 }
 EXPORT_SYMBOL(acpi_check_dsm);
 
+/**
+ * acpi_dev_hid_uid_match - Match device by supplied HID and UID
+ * @adev: ACPI device to match.
+ * @hid2: Hardware ID of the device.
+ * @uid2: Unique ID of the device, pass NULL to not check _UID.
+ *
+ * Matches HID and UID in @adev with given @hid2 and @uid2.
+ * Returns true if matches.
+ */
+bool acpi_dev_hid_uid_match(struct acpi_device *adev,
+			    const char *hid2, const char *uid2)
+{
+	const char *hid1 = acpi_device_hid(adev);
+	const char *uid1 = acpi_device_uid(adev);
+
+	if (strcmp(hid1, hid2))
+		return false;
+
+	if (!uid2)
+		return true;
+
+	return uid1 && !strcmp(uid1, uid2);
+}
+EXPORT_SYMBOL(acpi_dev_hid_uid_match);
+
 /**
  * acpi_dev_found - Detect presence of a given ACPI device in the namespace.
  * @hid: Hardware ID of the device.
include/acpi/acpi_bus.h +3 -0
index 175f7b40c585..d3cc8a786065 100644
@@ -75,6 +75,9 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
 	  .package.elements = (eles)			\
 	}
 
+bool acpi_dev_hid_uid_match(struct acpi_device *adev,
+			    const char *hid2, const char *uid2);
+
 bool acpi_dev_found(const char *hid);
 bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
 
include/linux/acpi.h +6 -0
index 9426b9aaed86..272b51a4f385 100644
@@ -662,6 +662,12 @@ static inline u64 acpi_arch_get_root_pointer(void)
 
 struct fwnode_handle;
 
+static inline bool acpi_dev_hid_uid_match(struct acpi_device *adev,
+					  const char *hid2, const char *uid2)
+{
+	return false;
+}
+
 static inline bool acpi_dev_found(const char *hid)
 {
 	return false;
Signature · 1 line
2.23.0
#2 lore raw

Re: [PATCH v1 2/5] ACPI / utils: Introduce acpi_dev_hid_uid_match() helper

I love your patch! Yet something to improve:

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on pm/linux-next]
[cannot apply to v5.3 next-20190920]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ACPI-utils-Describe-function-parameters-in-kernel-doc/20190924-230504
base:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.4.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=ia64

If you fix the issue, kindly add following tag

All error/warnings (new ones prefixed by >>):

In file included from include/linux/acpi.h:32:0,

                    from include/linux/i2c.h:13,
                    from drivers//media/radio/si4713/si4713.c:15:
>> include/acpi/acpi_bus.h:78:36: warning: 'struct acpi_device' declared inside parameter list will not be visible outside of this definition or declaration

bool acpi_dev_hid_uid_match(struct acpi_device *adev,
^~~~~~~~~~~
--
In file included from include/linux/acpi.h:32:0,
from drivers/acpi/utils.c:15:

>> include/acpi/acpi_bus.h:78:36: warning: 'struct acpi_device' declared inside parameter list will not be visible outside of this definition or declaration
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
                                       ^~~~~~~~~~~
>> drivers/acpi/utils.c:713:6: error: conflicting types for 'acpi_dev_hid_uid_match'
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
         ^~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/acpi.h:32:0,
                    from drivers/acpi/utils.c:15:
   include/acpi/acpi_bus.h:78:6: note: previous declaration of 'acpi_dev_hid_uid_match' was here
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
         ^~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/linkage.h:7:0,
                    from include/linux/kernel.h:8,
                    from drivers/acpi/utils.c:9:
   drivers/acpi/utils.c:727:15: error: conflicting types for 'acpi_dev_hid_uid_match'
    EXPORT_SYMBOL(acpi_dev_hid_uid_match);
                  ^
   include/linux/export.h:79:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                        ^~~
>> drivers/acpi/utils.c:727:1: note: in expansion of macro 'EXPORT_SYMBOL'
    EXPORT_SYMBOL(acpi_dev_hid_uid_match);
    ^~~~~~~~~~~~~

In file included from include/linux/acpi.h:32:0,
from drivers/acpi/utils.c:15:
include/acpi/acpi_bus.h:78:6: note: previous declaration of 'acpi_dev_hid_uid_match' was here
bool acpi_dev_hid_uid_match(struct acpi_device *adev,
^~~~~~~~~~~~~~~~~~~~~~
--
In file included from include/linux/acpi.h:32:0,
from drivers/cpufreq/ia64-acpi-cpufreq.c:24:

>> include/acpi/acpi_bus.h:78:36: warning: 'struct acpi_device' declared inside parameter list will not be visible outside of this definition or declaration
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
                                       ^~~~~~~~~~~
   drivers/cpufreq/ia64-acpi-cpufreq.c: In function 'processor_set_pstate':
   <command-line>:0:16: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 's64 {aka long long int}' [-Wformat=]
   drivers/cpufreq/ia64-acpi-cpufreq.c:12:21: note: in expansion of macro 'KBUILD_MODNAME'
    #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
                        ^~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:125:15: note: in expansion of macro 'pr_fmt'
      func(&id, ##__VA_ARGS__);  \
                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call'
     __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:153:2: note: in expansion of macro '_dynamic_func_call'
     _dynamic_func_call(fmt, __dynamic_pr_debug,  \
     ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:336:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
   drivers/cpufreq/ia64-acpi-cpufreq.c:57:3: note: in expansion of macro 'pr_debug'
      pr_debug("Failed to set freq to 0x%x, with error 0x%lx\n",
      ^~~~~~~~
   drivers/cpufreq/ia64-acpi-cpufreq.c: In function 'processor_get_pstate':
   <command-line>:0:16: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 's64 {aka long long int}' [-Wformat=]
   drivers/cpufreq/ia64-acpi-cpufreq.c:12:21: note: in expansion of macro 'KBUILD_MODNAME'
    #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
                        ^~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:125:15: note: in expansion of macro 'pr_fmt'
      func(&id, ##__VA_ARGS__);  \
                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call'
     __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:153:2: note: in expansion of macro '_dynamic_func_call'
     _dynamic_func_call(fmt, __dynamic_pr_debug,  \
     ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:336:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~

drivers/cpufreq/ia64-acpi-cpufreq.c:79:3: note: in expansion of macro 'pr_debug'
pr_debug("Failed to get current freq with "
^~~~~~~~
--
In file included from include/linux/acpi.h:32:0,

                    from drivers//acpi/utils.c:15:
>> include/acpi/acpi_bus.h:78:36: warning: 'struct acpi_device' declared inside parameter list will not be visible outside of this definition or declaration
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
                                       ^~~~~~~~~~~
   drivers//acpi/utils.c:713:6: error: conflicting types for 'acpi_dev_hid_uid_match'
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
         ^~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/acpi.h:32:0,
                    from drivers//acpi/utils.c:15:
   include/acpi/acpi_bus.h:78:6: note: previous declaration of 'acpi_dev_hid_uid_match' was here
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
         ^~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/linkage.h:7:0,
                    from include/linux/kernel.h:8,
                    from drivers//acpi/utils.c:9:
   drivers//acpi/utils.c:727:15: error: conflicting types for 'acpi_dev_hid_uid_match'
    EXPORT_SYMBOL(acpi_dev_hid_uid_match);
                  ^
   include/linux/export.h:79:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                        ^~~
   drivers//acpi/utils.c:727:1: note: in expansion of macro 'EXPORT_SYMBOL'
    EXPORT_SYMBOL(acpi_dev_hid_uid_match);
    ^~~~~~~~~~~~~
   In file included from include/linux/acpi.h:32:0,
                    from drivers//acpi/utils.c:15:

include/acpi/acpi_bus.h:78:6: note: previous declaration of 'acpi_dev_hid_uid_match' was here
bool acpi_dev_hid_uid_match(struct acpi_device *adev,
^~~~~~~~~~~~~~~~~~~~~~
--
In file included from include/linux/acpi.h:32:0,

                    from drivers//cpufreq/ia64-acpi-cpufreq.c:24:
>> include/acpi/acpi_bus.h:78:36: warning: 'struct acpi_device' declared inside parameter list will not be visible outside of this definition or declaration
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
                                       ^~~~~~~~~~~
   drivers//cpufreq/ia64-acpi-cpufreq.c: In function 'processor_set_pstate':
   <command-line>:0:16: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 's64 {aka long long int}' [-Wformat=]
   drivers//cpufreq/ia64-acpi-cpufreq.c:12:21: note: in expansion of macro 'KBUILD_MODNAME'
    #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
                        ^~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:125:15: note: in expansion of macro 'pr_fmt'
      func(&id, ##__VA_ARGS__);  \
                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call'
     __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:153:2: note: in expansion of macro '_dynamic_func_call'
     _dynamic_func_call(fmt, __dynamic_pr_debug,  \
     ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:336:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
   drivers//cpufreq/ia64-acpi-cpufreq.c:57:3: note: in expansion of macro 'pr_debug'
      pr_debug("Failed to set freq to 0x%x, with error 0x%lx\n",
      ^~~~~~~~
   drivers//cpufreq/ia64-acpi-cpufreq.c: In function 'processor_get_pstate':
   <command-line>:0:16: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 's64 {aka long long int}' [-Wformat=]
   drivers//cpufreq/ia64-acpi-cpufreq.c:12:21: note: in expansion of macro 'KBUILD_MODNAME'
    #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
                        ^~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:125:15: note: in expansion of macro 'pr_fmt'
      func(&id, ##__VA_ARGS__);  \
                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:143:2: note: in expansion of macro '__dynamic_func_call'
     __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:153:2: note: in expansion of macro '_dynamic_func_call'
     _dynamic_func_call(fmt, __dynamic_pr_debug,  \
     ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:336:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~

drivers//cpufreq/ia64-acpi-cpufreq.c:79:3: note: in expansion of macro 'pr_debug'
pr_debug("Failed to get current freq with "
^~~~~~~~
--
In file included from include/linux/acpi.h:32:0,

                    from include/linux/i2c.h:13,
                    from include/media/dvb_frontend.h:38,
                    from drivers/media/tuners/mxl5005s.c:66:
>> include/acpi/acpi_bus.h:78:36: warning: 'struct acpi_device' declared inside parameter list will not be visible outside of this definition or declaration
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
                                       ^~~~~~~~~~~
   drivers/media/tuners/mxl5005s.c: In function 'MXL5005_ControlInit.isra.2':
   drivers/media/tuners/mxl5005s.c:1660:1: warning: the frame size of 4448 bytes is larger than 2048 bytes [-Wframe-larger-than=]
    }
    ^
--
   In file included from include/linux/acpi.h:32:0,
                    from include/linux/i2c.h:13,
                    from include/media/dvb_frontend.h:38,
                    from drivers//media/tuners/mxl5005s.c:66:
>> include/acpi/acpi_bus.h:78:36: warning: 'struct acpi_device' declared inside parameter list will not be visible outside of this definition or declaration
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
                                       ^~~~~~~~~~~
   drivers//media/tuners/mxl5005s.c: In function 'MXL5005_ControlInit.isra.2':
   drivers//media/tuners/mxl5005s.c:1660:1: warning: the frame size of 4448 bytes is larger than 2048 bytes [-Wframe-larger-than=]
    }
    ^

vim +/acpi_dev_hid_uid_match +713 drivers/acpi/utils.c

703
704 /**
705 * acpi_dev_hid_uid_match - Match device by supplied HID and UID
706 * @adev: ACPI device to match.
707 * @hid2: Hardware ID of the device.
708 * @uid2: Unique ID of the device, pass NULL to not check _UID.
709 *
710 * Matches HID and UID in @adev with given @hid2 and @uid2.
711 * Returns true if matches.
712 */

 > 713	bool acpi_dev_hid_uid_match(struct acpi_device *adev,
   714				    const char *hid2, const char *uid2)
   715	{
   716		const char *hid1 = acpi_device_hid(adev);
   717		const char *uid1 = acpi_device_uid(adev);
   718	
   719		if (strcmp(hid1, hid2))
   720			return false;
   721	
   722		if (!uid2)
   723			return true;
   724	
   725		return uid1 && !strcmp(uid1, uid2);
   726	}
 > 727	EXPORT_SYMBOL(acpi_dev_hid_uid_match);

728

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#3 lore raw

Re: [PATCH v1 2/5] ACPI / utils: Introduce acpi_dev_hid_uid_match() helper

In reply to Andy Shevchenko
I love your patch! Perhaps something to improve:

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[cannot apply to v5.3 next-20190920]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ACPI-utils-Describe-function-parameters-in-kernel-doc/20190924-230504
base:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: i386-tinyconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-13) 7.4.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

In file included from init/main.c:30:0:

>> include/linux/acpi.h:665:50: warning: 'struct acpi_device' declared inside parameter list will not be visible outside of this definition or declaration

static inline bool acpi_dev_hid_uid_match(struct acpi_device *adev,
^~~~~~~~~~~

vim +665 include/linux/acpi.h

664

 > 665	static inline bool acpi_dev_hid_uid_match(struct acpi_device *adev,

666 const char *hid2, const char *uid2)
667 {
668 return false;
669 }
670

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#4 lore raw

PATCH 3/5 ACPI / LPSS: Switch to use acpi_dev_hid_uid_match()

In reply to Andy Shevchenko

Since we have a generic helper, drop custom implementation in the driver.

---
 drivers/acpi/acpi_lpss.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)
drivers/acpi/acpi_lpss.c +3 -18
index d696f165a50e..1e6d959bd968 100644
@@ -476,31 +476,16 @@ static const struct lpss_device_links lpss_device_links[] = {
 	{"80860F41", "5", "LNXVIDEO", NULL, DL_FLAG_PM_RUNTIME},
 };
 
-static bool hid_uid_match(struct acpi_device *adev,
-			  const char *hid2, const char *uid2)
-{
-	const char *hid1 = acpi_device_hid(adev);
-	const char *uid1 = acpi_device_uid(adev);
-
-	if (strcmp(hid1, hid2))
-		return false;
-
-	if (!uid2)
-		return true;
-
-	return uid1 && !strcmp(uid1, uid2);
-}
-
 static bool acpi_lpss_is_supplier(struct acpi_device *adev,
 				  const struct lpss_device_links *link)
 {
-	return hid_uid_match(adev, link->supplier_hid, link->supplier_uid);
+	return acpi_dev_hid_uid_match(adev, link->supplier_hid, link->supplier_uid);
 }
 
 static bool acpi_lpss_is_consumer(struct acpi_device *adev,
 				  const struct lpss_device_links *link)
 {
-	return hid_uid_match(adev, link->consumer_hid, link->consumer_uid);
+	return acpi_dev_hid_uid_match(adev, link->consumer_hid, link->consumer_uid);
 }
 
 struct hid_uid {
@@ -516,7 +501,7 @@ static int match_hid_uid(struct device *dev, const void *data)
 	if (!adev)
 		return 0;
 
-	return hid_uid_match(adev, id->hid, id->uid);
+	return acpi_dev_hid_uid_match(adev, id->hid, id->uid);
 }
 
 static struct device *acpi_lpss_find_device(const char *hid, const char *uid)
Signature · 1 line
2.23.0
#5 lore raw

Re: [PATCH v1 3/5] ACPI / LPSS: Switch to use acpi_dev_hid_uid_match()

I love your patch! Yet something to improve:

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on pm/linux-next]
[cannot apply to v5.3 next-20190920]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ACPI-utils-Describe-function-parameters-in-kernel-doc/20190924-230504
base:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-13) 7.4.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

In file included from include/linux/acpi.h:32:0,
from drivers/acpi/acpi_lpss.c:10:
include/acpi/acpi_bus.h:78:36: warning: 'struct acpi_device' declared inside parameter list will not be visible outside of this definition or declaration
bool acpi_dev_hid_uid_match(struct acpi_device *adev,
^~~~~~~~~~~
drivers/acpi/acpi_lpss.c: In function 'acpi_lpss_is_supplier':

>> drivers/acpi/acpi_lpss.c:484:32: error: passing argument 1 of 'acpi_dev_hid_uid_match' from incompatible pointer type [-Werror=incompatible-pointer-types]
     return acpi_dev_hid_uid_match(adev, link->supplier_hid, link->supplier_uid);
                                   ^~~~
   In file included from include/linux/acpi.h:32:0,
                    from drivers/acpi/acpi_lpss.c:10:
   include/acpi/acpi_bus.h:78:6: note: expected 'struct acpi_device *' but argument is of type 'struct acpi_device *'
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
         ^~~~~~~~~~~~~~~~~~~~~~
   drivers/acpi/acpi_lpss.c: In function 'acpi_lpss_is_consumer':
   drivers/acpi/acpi_lpss.c:490:32: error: passing argument 1 of 'acpi_dev_hid_uid_match' from incompatible pointer type [-Werror=incompatible-pointer-types]
     return acpi_dev_hid_uid_match(adev, link->consumer_hid, link->consumer_uid);
                                   ^~~~
   In file included from include/linux/acpi.h:32:0,
                    from drivers/acpi/acpi_lpss.c:10:
   include/acpi/acpi_bus.h:78:6: note: expected 'struct acpi_device *' but argument is of type 'struct acpi_device *'
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
         ^~~~~~~~~~~~~~~~~~~~~~
   drivers/acpi/acpi_lpss.c: In function 'match_hid_uid':
   drivers/acpi/acpi_lpss.c:506:32: error: passing argument 1 of 'acpi_dev_hid_uid_match' from incompatible pointer type [-Werror=incompatible-pointer-types]
     return acpi_dev_hid_uid_match(adev, id->hid, id->uid);
                                   ^~~~

In file included from include/linux/acpi.h:32:0,
from drivers/acpi/acpi_lpss.c:10:
include/acpi/acpi_bus.h:78:6: note: expected 'struct acpi_device *' but argument is of type 'struct acpi_device *'
bool acpi_dev_hid_uid_match(struct acpi_device *adev,
^~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/acpi_dev_hid_uid_match +484 drivers/acpi/acpi_lpss.c

480
481 static bool acpi_lpss_is_supplier(struct acpi_device *adev,
482 const struct lpss_device_links *link)
483 {

 > 484		return acpi_dev_hid_uid_match(adev, link->supplier_hid, link->supplier_uid);

485 }
486

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#6 lore raw

PATCH 4/5 mmc: sdhci-acpi: Switch to use acpi_dev_hid_uid_match()

In reply to Andy Shevchenko

Since we have a generic helper, drop custom implementation in the driver.

---
 drivers/mmc/host/sdhci-acpi.c | 49 ++++++++++++-----------------------
 1 file changed, 16 insertions(+), 33 deletions(-)
drivers/mmc/host/sdhci-acpi.c +16 -33
index 1604f512c7bd..f913c3f57bbf 100644
@@ -61,7 +61,7 @@ struct sdhci_acpi_slot {
 	mmc_pm_flag_t	pm_caps;
 	unsigned int	flags;
 	size_t		priv_size;
-	int (*probe_slot)(struct platform_device *, const char *, const char *);
+	int (*probe_slot)(struct platform_device *, struct acpi_device *);
 	int (*remove_slot)(struct platform_device *);
 	int (*free_slot)(struct platform_device *pdev);
 	int (*setup_host)(struct platform_device *pdev);
@@ -325,12 +325,10 @@ static bool sdhci_acpi_cht_pci_wifi(unsigned int vendor, unsigned int device,
  * wifi card in the expected slot with an ACPI companion node, is used to
  * indicate that acpi_device_fix_up_power() should be avoided.
  */
-static inline bool sdhci_acpi_no_fixup_child_power(const char *hid,
-						   const char *uid)
+static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev)
 {
 	return sdhci_acpi_cht() &&
-	       !strcmp(hid, "80860F14") &&
-	       !strcmp(uid, "2") &&
+	       acpi_dev_hid_uid_match(adev, "80860F14", "2") &&
 	       sdhci_acpi_cht_pci_wifi(0x14e4, 0x43ec, 0, 28);
 }
 
@@ -345,8 +343,7 @@ static inline bool sdhci_acpi_byt_defer(struct device *dev)
 	return false;
 }
 
-static inline bool sdhci_acpi_no_fixup_child_power(const char *hid,
-						   const char *uid)
+static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev)
 {
 	return false;
 }
@@ -375,19 +372,18 @@ static int bxt_get_cd(struct mmc_host *mmc)
 	return ret;
 }
 
-static int intel_probe_slot(struct platform_device *pdev, const char *hid,
-			    const char *uid)
+static int intel_probe_slot(struct platform_device *pdev, struct acpi_device *adev)
 {
 	struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
 	struct intel_host *intel_host = sdhci_acpi_priv(c);
 	struct sdhci_host *host = c->host;
 
-	if (hid && uid && !strcmp(hid, "80860F14") && !strcmp(uid, "1") &&
+	if (acpi_dev_hid_uid_match(adev, "80860F14", "1") &&
 	    sdhci_readl(host, SDHCI_CAPABILITIES) == 0x446cc8b2 &&
 	    sdhci_readl(host, SDHCI_CAPABILITIES_1) == 0x00000807)
 		host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */
 
-	if (hid && !strcmp(hid, "80865ACA"))
+	if (acpi_dev_hid_uid_match(adev, "80865ACA", NULL))
 		host->mmc_host_ops.get_cd = bxt_get_cd;
 
 	intel_dsm_init(intel_host, &pdev->dev, host->mmc);
@@ -473,8 +469,7 @@ static irqreturn_t sdhci_acpi_qcom_handler(int irq, void *ptr)
 	return IRQ_HANDLED;
 }
 
-static int qcom_probe_slot(struct platform_device *pdev, const char *hid,
-			   const char *uid)
+static int qcom_probe_slot(struct platform_device *pdev, struct acpi_device *adev)
 {
 	struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
 	struct sdhci_host *host = c->host;
@@ -482,7 +477,7 @@ static int qcom_probe_slot(struct platform_device *pdev, const char *hid,
 
 	*irq = -EINVAL;
 
-	if (strcmp(hid, "QCOM8051"))
+	if (acpi_dev_hid_uid_match(adev, "QCOM8051", NULL))
 		return 0;
 
 	*irq = platform_get_irq(pdev, 1);
@@ -501,14 +496,12 @@ static int qcom_free_slot(struct platform_device *pdev)
 	struct sdhci_host *host = c->host;
 	struct acpi_device *adev;
 	int *irq = sdhci_acpi_priv(c);
-	const char *hid;
 
 	adev = ACPI_COMPANION(dev);
 	if (!adev)
 		return -ENODEV;
 
-	hid = acpi_device_hid(adev);
-	if (strcmp(hid, "QCOM8051"))
+	if (!acpi_dev_hid_uid_match(adev, "QCOM8051", NULL))
 		return 0;
 
 	if (*irq < 0)
@@ -583,7 +576,7 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_amd = {
 };
 
 static int sdhci_acpi_emmc_amd_probe_slot(struct platform_device *pdev,
-					  const char *hid, const char *uid)
+					  struct acpi_device *adev)
 {
 	struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
 	struct sdhci_host *host   = c->host;
@@ -654,17 +647,12 @@ static const struct acpi_device_id sdhci_acpi_ids[] = {
 };
 MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids);
 
-static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(const char *hid,
-							 const char *uid)
+static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(struct acpi_device *adev)
 {
 	const struct sdhci_acpi_uid_slot *u;
 
 	for (u = sdhci_acpi_uids; u->hid; u++) {
-		if (strcmp(u->hid, hid))
-			continue;
-		if (!u->uid)
-			return u->slot;
-		if (uid && !strcmp(u->uid, uid))
+		if (acpi_dev_hid_uid_match(adev, u->hid, u->uid))
 			return u->slot;
 	}
 	return NULL;
@@ -680,22 +668,17 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
 	struct resource *iomem;
 	resource_size_t len;
 	size_t priv_size;
-	const char *hid;
-	const char *uid;
 	int err;
 
 	device = ACPI_COMPANION(dev);
 	if (!device)
 		return -ENODEV;
 
-	hid = acpi_device_hid(device);
-	uid = acpi_device_uid(device);
-
-	slot = sdhci_acpi_get_slot(hid, uid);
+	slot = sdhci_acpi_get_slot(device);
 
 	/* Power on the SDHCI controller and its children */
 	acpi_device_fix_up_power(device);
-	if (!sdhci_acpi_no_fixup_child_power(hid, uid)) {
+	if (!sdhci_acpi_no_fixup_child_power(device)) {
 		list_for_each_entry(child, &device->children, node)
 			if (child->status.present && child->status.enabled)
 				acpi_device_fix_up_power(child);
@@ -745,7 +728,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
 
 	if (c->slot) {
 		if (c->slot->probe_slot) {
-			err = c->slot->probe_slot(pdev, hid, uid);
+			err = c->slot->probe_slot(pdev, device);
 			if (err)
 				goto err_free;
 		}
Signature · 1 line
2.23.0
#7 lore raw

Re: [PATCH v1 4/5] mmc: sdhci-acpi: Switch to use acpi_dev_hid_uid_match()

I love your patch! Yet something to improve:

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on pm/linux-next]
[cannot apply to v5.3 next-20190920]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ACPI-utils-Describe-function-parameters-in-kernel-doc/20190924-230504
base:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.4.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=ia64

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

In file included from include/linux/acpi.h:32:0,
from drivers/mmc/host/sdhci-acpi.c:22:
include/acpi/acpi_bus.h:78:36: warning: 'struct acpi_device' declared inside parameter list will not be visible outside of this definition or declaration
bool acpi_dev_hid_uid_match(struct acpi_device *adev,
^~~~~~~~~~~
drivers/mmc/host/sdhci-acpi.c: In function 'intel_probe_slot':

>> drivers/mmc/host/sdhci-acpi.c:381:29: error: passing argument 1 of 'acpi_dev_hid_uid_match' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if (acpi_dev_hid_uid_match(adev, "80860F14", "1") &&
                                ^~~~
   In file included from include/linux/acpi.h:32:0,
                    from drivers/mmc/host/sdhci-acpi.c:22:
   include/acpi/acpi_bus.h:78:6: note: expected 'struct acpi_device *' but argument is of type 'struct acpi_device *'
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
         ^~~~~~~~~~~~~~~~~~~~~~
   drivers/mmc/host/sdhci-acpi.c:386:29: error: passing argument 1 of 'acpi_dev_hid_uid_match' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if (acpi_dev_hid_uid_match(adev, "80865ACA", NULL))
                                ^~~~
   In file included from include/linux/acpi.h:32:0,
                    from drivers/mmc/host/sdhci-acpi.c:22:
   include/acpi/acpi_bus.h:78:6: note: expected 'struct acpi_device *' but argument is of type 'struct acpi_device *'
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
         ^~~~~~~~~~~~~~~~~~~~~~
   drivers/mmc/host/sdhci-acpi.c: In function 'qcom_probe_slot':
   drivers/mmc/host/sdhci-acpi.c:480:29: error: passing argument 1 of 'acpi_dev_hid_uid_match' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if (acpi_dev_hid_uid_match(adev, "QCOM8051", NULL))
                                ^~~~
   In file included from include/linux/acpi.h:32:0,
                    from drivers/mmc/host/sdhci-acpi.c:22:
   include/acpi/acpi_bus.h:78:6: note: expected 'struct acpi_device *' but argument is of type 'struct acpi_device *'
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
         ^~~~~~~~~~~~~~~~~~~~~~
   drivers/mmc/host/sdhci-acpi.c: In function 'qcom_free_slot':
   drivers/mmc/host/sdhci-acpi.c:504:30: error: passing argument 1 of 'acpi_dev_hid_uid_match' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if (!acpi_dev_hid_uid_match(adev, "QCOM8051", NULL))
                                 ^~~~
   In file included from include/linux/acpi.h:32:0,
                    from drivers/mmc/host/sdhci-acpi.c:22:
   include/acpi/acpi_bus.h:78:6: note: expected 'struct acpi_device *' but argument is of type 'struct acpi_device *'
    bool acpi_dev_hid_uid_match(struct acpi_device *adev,
         ^~~~~~~~~~~~~~~~~~~~~~
   drivers/mmc/host/sdhci-acpi.c: In function 'sdhci_acpi_get_slot':
   drivers/mmc/host/sdhci-acpi.c:655:30: error: passing argument 1 of 'acpi_dev_hid_uid_match' from incompatible pointer type [-Werror=incompatible-pointer-types]
      if (acpi_dev_hid_uid_match(adev, u->hid, u->uid))
                                 ^~~~

In file included from include/linux/acpi.h:32:0,
from drivers/mmc/host/sdhci-acpi.c:22:
include/acpi/acpi_bus.h:78:6: note: expected 'struct acpi_device *' but argument is of type 'struct acpi_device *'
bool acpi_dev_hid_uid_match(struct acpi_device *adev,
^~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/acpi_dev_hid_uid_match +381 drivers/mmc/host/sdhci-acpi.c

374
375 static int intel_probe_slot(struct platform_device *pdev, struct acpi_device *adev)
376 {
377 struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
378 struct intel_host *intel_host = sdhci_acpi_priv(c);
379 struct sdhci_host *host = c->host;
380

 > 381		if (acpi_dev_hid_uid_match(adev, "80860F14", "1") &&

382 sdhci_readl(host, SDHCI_CAPABILITIES) == 0x446cc8b2 &&
383 sdhci_readl(host, SDHCI_CAPABILITIES_1) == 0x00000807)
384 host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */
385
386 if (acpi_dev_hid_uid_match(adev, "80865ACA", NULL))
387 host->mmc_host_ops.get_cd = bxt_get_cd;
388
389 intel_dsm_init(intel_host, &pdev->dev, host->mmc);
390
391 host->mmc_host_ops.start_signal_voltage_switch =
392 intel_start_signal_voltage_switch;
393
394 return 0;
395 }
396

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#8 lore raw

PATCH 5/5 iommu/amd: Switch to use acpi_dev_hid_uid_match()

In reply to Andy Shevchenko

Since we have a generic helper, drop custom implementation in the driver.

---
 drivers/iommu/amd_iommu.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/iommu/amd_iommu.c +1 -14
index 61de81965c44..bad1bcea4ea1 100644
@@ -129,24 +129,11 @@ static inline int match_hid_uid(struct device *dev,
 				struct acpihid_map_entry *entry)
 {
 	struct acpi_device *adev = ACPI_COMPANION(dev);
-	const char *hid, *uid;
 
 	if (!adev)
 		return -ENODEV;
 
-	hid = acpi_device_hid(adev);
-	uid = acpi_device_uid(adev);
-
-	if (!hid || !(*hid))
-		return -ENODEV;
-
-	if (!uid || !(*uid))
-		return strcmp(hid, entry->hid);
-
-	if (!(*entry->uid))
-		return strcmp(hid, entry->hid);
-
-	return (strcmp(hid, entry->hid) || strcmp(uid, entry->uid));
+	return acpi_dev_hid_uid_match(adev, entry->hid, entry->uid) ? 0 : -ENODEV;
 }
 
 static inline u16 get_pci_device_id(struct device *dev)
Signature · 1 line
2.23.0
#9 lore raw

Re: [PATCH v1 5/5] iommu/amd: Switch to use acpi_dev_hid_uid_match()

Quoted 1 line · Andy Shevchenko

Since we have a generic helper, drop custom implementation in the driver.

Actually we may get rid of match_hid_uid() completely and thus slightly speed up get_acpihid_device_id().

I'll wait for other comments and then send v2.

Quoted 38 lines
---
 drivers/iommu/amd_iommu.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/iommu/amd_iommu.c +1 -14
index 61de81965c44..bad1bcea4ea1 100644
@@ -129,24 +129,11 @@ static inline int match_hid_uid(struct device *dev,
 				struct acpihid_map_entry *entry)
 {
 	struct acpi_device *adev = ACPI_COMPANION(dev);
-	const char *hid, *uid;
 
 	if (!adev)
 		return -ENODEV;
 
-	hid = acpi_device_hid(adev);
-	uid = acpi_device_uid(adev);
-
-	if (!hid || !(*hid))
-		return -ENODEV;
-
-	if (!uid || !(*uid))
-		return strcmp(hid, entry->hid);
-
-	if (!(*entry->uid))
-		return strcmp(hid, entry->hid);
-
-	return (strcmp(hid, entry->hid) || strcmp(uid, entry->uid));
+	return acpi_dev_hid_uid_match(adev, entry->hid, entry->uid) ? 0 : -ENODEV;
 }
 
 static inline u16 get_pci_device_id(struct device *dev)
Signature · 1 line
2.23.0
Signature · 2 lines
With Best Regards,
Andy Shevchenko