Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

driver core: Put device attribute @wakeup_last_time_ms and its show() together

Move location of dpm_sysfs_wakeup_change_owner() a bit to

- Put device attribute @wakeup_last_time_ms and its show() together.
- Put two different instances of dpm_sysfs_wakeup_change_owner() together.

That will make better code layout.

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20241028-fix_power_sysfs-v1-1-7b2fbeb14d47@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Zijun Hu and committed by
Greg Kroah-Hartman
eafb1a86 f87f132c

+9 -8
+9 -8
drivers/base/power/sysfs.c
··· 509 509 return sysfs_emit(buf, "%lld\n", msec); 510 510 } 511 511 512 - static inline int dpm_sysfs_wakeup_change_owner(struct device *dev, kuid_t kuid, 513 - kgid_t kgid) 514 - { 515 - if (dev->power.wakeup && dev->power.wakeup->dev) 516 - return device_change_owner(dev->power.wakeup->dev, kuid, kgid); 517 - return 0; 518 - } 519 - 520 512 static DEVICE_ATTR_RO(wakeup_last_time_ms); 521 513 522 514 #ifdef CONFIG_PM_AUTOSLEEP ··· 533 541 534 542 static DEVICE_ATTR_RO(wakeup_prevent_sleep_time_ms); 535 543 #endif /* CONFIG_PM_AUTOSLEEP */ 544 + 545 + static inline int dpm_sysfs_wakeup_change_owner(struct device *dev, kuid_t kuid, 546 + kgid_t kgid) 547 + { 548 + if (dev->power.wakeup && dev->power.wakeup->dev) 549 + return device_change_owner(dev->power.wakeup->dev, kuid, kgid); 550 + return 0; 551 + } 552 + 536 553 #else /* CONFIG_PM_SLEEP */ 537 554 static inline int dpm_sysfs_wakeup_change_owner(struct device *dev, kuid_t kuid, 538 555 kgid_t kgid)