diff mbox series

ACPI: power: Drop name from struct acpi_power_resource

Message ID 2616419.mvXUDI8C0e@kreacher (mailing list archive)
State Awaiting Upstream
Delegated to: Rafael Wysocki
Headers show
Series ACPI: power: Drop name from struct acpi_power_resource | expand

Commit Message

Rafael J. Wysocki Aug. 25, 2021, 6:31 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Drop the name field (that only is used in diagnostic messages) from
struct acpi_power_resource and use the name of the power resource
device object instead of it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/power.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Comments

kernel test robot Aug. 25, 2021, 11:50 p.m. UTC | #1
Hi "Rafael,

I love your patch! Yet something to improve:

[auto build test ERROR on pm/linux-next]
[also build test ERROR on v5.14-rc7 next-20210825]
[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/Rafael-J-Wysocki/ACPI-power-Drop-name-from-struct-acpi_power_resource/20210826-023528
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-c022-20210825 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/f95f6be28951e9fbbe4b8945bf807660e8d4b388
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Rafael-J-Wysocki/ACPI-power-Drop-name-from-struct-acpi_power_resource/20210826-023528
        git checkout f95f6be28951e9fbbe4b8945bf807660e8d4b388
        # save the attached .config to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/printk.h:456,
                    from include/linux/kernel.h:19,
                    from drivers/acpi/power.c:26:
   drivers/acpi/power.c: In function '__acpi_power_on':
>> drivers/acpi/power.c:375:54: error: 'struct acpi_power_resource' has no member named 'name'
     375 |  pr_debug("Power resource [%s] turned on\n", resource->name);
         |                                                      ^~
   include/linux/dynamic_debug.h:134:15: note: in definition of macro '__dynamic_func_call'
     134 |   func(&id, ##__VA_ARGS__);  \
         |               ^~~~~~~~~~~
   include/linux/dynamic_debug.h:162:2: note: in expansion of macro '_dynamic_func_call'
     162 |  _dynamic_func_call(fmt, __dynamic_pr_debug,  \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:471:2: note: in expansion of macro 'dynamic_pr_debug'
     471 |  dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~
   drivers/acpi/power.c:375:2: note: in expansion of macro 'pr_debug'
     375 |  pr_debug("Power resource [%s] turned on\n", resource->name);
         |  ^~~~~~~~
   drivers/acpi/power.c: In function 'acpi_power_on_unlocked':
   drivers/acpi/power.c:400:56: error: 'struct acpi_power_resource' has no member named 'name'
     400 |   pr_debug("Power resource [%s] already on\n", resource->name);
         |                                                        ^~
   include/linux/dynamic_debug.h:134:15: note: in definition of macro '__dynamic_func_call'
     134 |   func(&id, ##__VA_ARGS__);  \
         |               ^~~~~~~~~~~
   include/linux/dynamic_debug.h:162:2: note: in expansion of macro '_dynamic_func_call'
     162 |  _dynamic_func_call(fmt, __dynamic_pr_debug,  \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:471:2: note: in expansion of macro 'dynamic_pr_debug'
     471 |  dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~
   drivers/acpi/power.c:400:3: note: in expansion of macro 'pr_debug'
     400 |   pr_debug("Power resource [%s] already on\n", resource->name);
         |   ^~~~~~~~
   drivers/acpi/power.c: In function '__acpi_power_off':
   drivers/acpi/power.c:432:55: error: 'struct acpi_power_resource' has no member named 'name'
     432 |  pr_debug("Power resource [%s] turned off\n", resource->name);
         |                                                       ^~
   include/linux/dynamic_debug.h:134:15: note: in definition of macro '__dynamic_func_call'
     134 |   func(&id, ##__VA_ARGS__);  \
         |               ^~~~~~~~~~~
   include/linux/dynamic_debug.h:162:2: note: in expansion of macro '_dynamic_func_call'
     162 |  _dynamic_func_call(fmt, __dynamic_pr_debug,  \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:471:2: note: in expansion of macro 'dynamic_pr_debug'
     471 |  dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~
   drivers/acpi/power.c:432:2: note: in expansion of macro 'pr_debug'
     432 |  pr_debug("Power resource [%s] turned off\n", resource->name);
         |  ^~~~~~~~
   drivers/acpi/power.c: In function 'acpi_power_off_unlocked':
   drivers/acpi/power.c:442:57: error: 'struct acpi_power_resource' has no member named 'name'
     442 |   pr_debug("Power resource [%s] already off\n", resource->name);
         |                                                         ^~
   include/linux/dynamic_debug.h:134:15: note: in definition of macro '__dynamic_func_call'
     134 |   func(&id, ##__VA_ARGS__);  \
         |               ^~~~~~~~~~~
   include/linux/dynamic_debug.h:162:2: note: in expansion of macro '_dynamic_func_call'
     162 |  _dynamic_func_call(fmt, __dynamic_pr_debug,  \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:471:2: note: in expansion of macro 'dynamic_pr_debug'
     471 |  dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~
   drivers/acpi/power.c:442:3: note: in expansion of macro 'pr_debug'
     442 |   pr_debug("Power resource [%s] already off\n", resource->name);
         |   ^~~~~~~~
   drivers/acpi/power.c:447:58: error: 'struct acpi_power_resource' has no member named 'name'
     447 |   pr_debug("Power resource [%s] still in use\n", resource->name);
         |                                                          ^~
   include/linux/dynamic_debug.h:134:15: note: in definition of macro '__dynamic_func_call'
     134 |   func(&id, ##__VA_ARGS__);  \
         |               ^~~~~~~~~~~
   include/linux/dynamic_debug.h:162:2: note: in expansion of macro '_dynamic_func_call'
     162 |  _dynamic_func_call(fmt, __dynamic_pr_debug,  \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:471:2: note: in expansion of macro 'dynamic_pr_debug'
     471 |  dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~
   drivers/acpi/power.c:447:3: note: in expansion of macro 'pr_debug'
     447 |   pr_debug("Power resource [%s] still in use\n", resource->name);
         |   ^~~~~~~~


vim +375 drivers/acpi/power.c

4533771c1e53b9 Mika Westerberg   2019-06-25  361  
3e384ee6c687cb Rafael J. Wysocki 2010-10-22  362  static int __acpi_power_on(struct acpi_power_resource *resource)
^1da177e4c3f41 Linus Torvalds    2005-04-16  363  {
4533771c1e53b9 Mika Westerberg   2019-06-25  364  	struct acpi_power_dependent_device *dep;
^1da177e4c3f41 Linus Torvalds    2005-04-16  365  	acpi_status status = AE_OK;
^1da177e4c3f41 Linus Torvalds    2005-04-16  366  
82c7d5efaadf99 Rafael J. Wysocki 2013-01-17  367  	status = acpi_evaluate_object(resource->device.handle, "_ON", NULL, NULL);
ca84f18798a457 Rafael J. Wysocki 2021-05-24  368  	if (ACPI_FAILURE(status)) {
ca84f18798a457 Rafael J. Wysocki 2021-05-24  369  		resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
3e384ee6c687cb Rafael J. Wysocki 2010-10-22  370  		return -ENODEV;
ca84f18798a457 Rafael J. Wysocki 2021-05-24  371  	}
ca84f18798a457 Rafael J. Wysocki 2021-05-24  372  
ca84f18798a457 Rafael J. Wysocki 2021-05-24  373  	resource->state = ACPI_POWER_RESOURCE_STATE_ON;
3e384ee6c687cb Rafael J. Wysocki 2010-10-22  374  
56ce8339d41bf6 Rafael J. Wysocki 2021-01-20 @375  	pr_debug("Power resource [%s] turned on\n", resource->name);
3e384ee6c687cb Rafael J. Wysocki 2010-10-22  376  
4533771c1e53b9 Mika Westerberg   2019-06-25  377  	/*
4533771c1e53b9 Mika Westerberg   2019-06-25  378  	 * If there are other dependents on this power resource we need to
4533771c1e53b9 Mika Westerberg   2019-06-25  379  	 * resume them now so that their drivers can re-initialize the
4533771c1e53b9 Mika Westerberg   2019-06-25  380  	 * hardware properly after it went back to D0.
4533771c1e53b9 Mika Westerberg   2019-06-25  381  	 */
4533771c1e53b9 Mika Westerberg   2019-06-25  382  	if (list_empty(&resource->dependents) ||
4533771c1e53b9 Mika Westerberg   2019-06-25  383  	    list_is_singular(&resource->dependents))
4533771c1e53b9 Mika Westerberg   2019-06-25  384  		return 0;
4533771c1e53b9 Mika Westerberg   2019-06-25  385  
4533771c1e53b9 Mika Westerberg   2019-06-25  386  	list_for_each_entry(dep, &resource->dependents, node) {
4533771c1e53b9 Mika Westerberg   2019-06-25  387  		dev_dbg(dep->dev, "runtime resuming because [%s] turned on\n",
f95f6be28951e9 Rafael J. Wysocki 2021-08-25  388  			resource_dev_name(resource));
4533771c1e53b9 Mika Westerberg   2019-06-25  389  		pm_request_resume(dep->dev);
4533771c1e53b9 Mika Westerberg   2019-06-25  390  	}
4533771c1e53b9 Mika Westerberg   2019-06-25  391  
3e384ee6c687cb Rafael J. Wysocki 2010-10-22  392  	return 0;
3e384ee6c687cb Rafael J. Wysocki 2010-10-22  393  }
3e384ee6c687cb Rafael J. Wysocki 2010-10-22  394  

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

Patch

Index: linux-pm/drivers/acpi/power.c
===================================================================
--- linux-pm.orig/drivers/acpi/power.c
+++ linux-pm/drivers/acpi/power.c
@@ -48,7 +48,6 @@  struct acpi_power_dependent_device {
 struct acpi_power_resource {
 	struct acpi_device device;
 	struct list_head list_node;
-	char *name;
 	u32 system_level;
 	u32 order;
 	unsigned int ref_count;
@@ -70,6 +69,11 @@  static DEFINE_MUTEX(power_resource_list_
                              Power Resource Management
    -------------------------------------------------------------------------- */
 
+static inline const char *resource_dev_name(struct acpi_power_resource *pr)
+{
+	return dev_name(&pr->device.dev);
+}
+
 static inline
 struct acpi_power_resource *to_power_resource(struct acpi_device *device)
 {
@@ -264,7 +268,8 @@  acpi_power_resource_add_dependent(struct
 
 	dep->dev = dev;
 	list_add_tail(&dep->node, &resource->dependents);
-	dev_dbg(dev, "added power dependency to [%s]\n", resource->name);
+	dev_dbg(dev, "added power dependency to [%s]\n",
+		resource_dev_name(resource));
 
 unlock:
 	mutex_unlock(&resource->resource_lock);
@@ -283,7 +288,7 @@  acpi_power_resource_remove_dependent(str
 			list_del(&dep->node);
 			kfree(dep);
 			dev_dbg(dev, "removed power dependency to [%s]\n",
-				resource->name);
+				resource_dev_name(resource));
 			break;
 		}
 	}
@@ -381,7 +386,7 @@  static int __acpi_power_on(struct acpi_p
 
 	list_for_each_entry(dep, &resource->dependents, node) {
 		dev_dbg(dep->dev, "runtime resuming because [%s] turned on\n",
-			resource->name);
+			resource_dev_name(resource));
 		pm_request_resume(dep->dev);
 	}
 
@@ -953,7 +958,6 @@  struct acpi_device *acpi_add_power_resou
 	mutex_init(&resource->resource_lock);
 	INIT_LIST_HEAD(&resource->list_node);
 	INIT_LIST_HEAD(&resource->dependents);
-	resource->name = device->pnp.bus_id;
 	strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
 	strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
 	device->power.state = ACPI_STATE_UNKNOWN;