* [PATCH v1 0/5] ACPI: proc: A few cleanups
@ 2025-06-12 20:11 Andy Shevchenko
2025-06-12 20:11 ` [PATCH v1 1/5] ACPI: wakeup: Drop unneeded casting for sleep_state Andy Shevchenko
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Andy Shevchenko @ 2025-06-12 20:11 UTC (permalink / raw)
To: Andy Shevchenko, linux-acpi, linux-kernel; +Cc: Rafael J. Wysocki, Len Brown
While looking into warning related to export.h inclusion, I took
the opportunity to make the module up-to-date to the modern APIs.
Hence this mini-series. Note, the first patch is to make the used
type consistent across the files.
Andy Shevchenko (5):
ACPI: wakeup: Drop unneeded casting for sleep_state
ACPI: proc: Use correct format specifier and drop casting
ACPI: proc: Remove unused header
ACPI: proc: Use str_enabled_disabled() helper
ACPI: proc: Prefer to use octal permission
drivers/acpi/proc.c | 17 +++++++----------
drivers/acpi/wakeup.c | 4 ++--
2 files changed, 9 insertions(+), 12 deletions(-)
--
2.47.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v1 1/5] ACPI: wakeup: Drop unneeded casting for sleep_state
2025-06-12 20:11 [PATCH v1 0/5] ACPI: proc: A few cleanups Andy Shevchenko
@ 2025-06-12 20:11 ` Andy Shevchenko
2025-06-12 20:11 ` [PATCH v1 2/5] ACPI: proc: Use correct format specifier and drop casting Andy Shevchenko
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2025-06-12 20:11 UTC (permalink / raw)
To: Andy Shevchenko, linux-acpi, linux-kernel; +Cc: Rafael J. Wysocki, Len Brown
Back to the original patch [1] sleep_state was defined as
a custom acpi_integer type variable. Nowadays it's plain
u64. No need to have casting for it anymore.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=1415 [1]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/acpi/wakeup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c
index b02bf770aead..ff6dc957bc11 100644
--- a/drivers/acpi/wakeup.c
+++ b/drivers/acpi/wakeup.c
@@ -42,7 +42,7 @@ void acpi_enable_wakeup_devices(u8 sleep_state)
list_for_each_entry_safe(dev, tmp, &acpi_wakeup_device_list,
wakeup_list) {
if (!dev->wakeup.flags.valid
- || sleep_state > (u32) dev->wakeup.sleep_state
+ || sleep_state > dev->wakeup.sleep_state
|| !(device_may_wakeup(&dev->dev)
|| dev->wakeup.prepare_count))
continue;
@@ -67,7 +67,7 @@ void acpi_disable_wakeup_devices(u8 sleep_state)
list_for_each_entry_safe(dev, tmp, &acpi_wakeup_device_list,
wakeup_list) {
if (!dev->wakeup.flags.valid
- || sleep_state > (u32) dev->wakeup.sleep_state
+ || sleep_state > dev->wakeup.sleep_state
|| !(device_may_wakeup(&dev->dev)
|| dev->wakeup.prepare_count))
continue;
--
2.47.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v1 2/5] ACPI: proc: Use correct format specifier and drop casting
2025-06-12 20:11 [PATCH v1 0/5] ACPI: proc: A few cleanups Andy Shevchenko
2025-06-12 20:11 ` [PATCH v1 1/5] ACPI: wakeup: Drop unneeded casting for sleep_state Andy Shevchenko
@ 2025-06-12 20:11 ` Andy Shevchenko
2025-06-12 20:11 ` [PATCH v1 3/5] ACPI: proc: Remove unused header Andy Shevchenko
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2025-06-12 20:11 UTC (permalink / raw)
To: Andy Shevchenko, linux-acpi, linux-kernel; +Cc: Rafael J. Wysocki, Len Brown
The format string in acpi_system_wakeup_device_seq_show() uses incorrect
specifier along with explicit (unneeded) casting. Drop the latter and
update the former.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/acpi/proc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c
index 4322f2da6d10..48215ba09193 100644
--- a/drivers/acpi/proc.c
+++ b/drivers/acpi/proc.c
@@ -30,9 +30,9 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
if (!dev->wakeup.flags.valid)
continue;
- seq_printf(seq, "%s\t S%d\t",
+ seq_printf(seq, "%s\t S%llu\t",
dev->pnp.bus_id,
- (u32) dev->wakeup.sleep_state);
+ dev->wakeup.sleep_state);
mutex_lock(&dev->physical_node_lock);
--
2.47.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v1 3/5] ACPI: proc: Remove unused header
2025-06-12 20:11 [PATCH v1 0/5] ACPI: proc: A few cleanups Andy Shevchenko
2025-06-12 20:11 ` [PATCH v1 1/5] ACPI: wakeup: Drop unneeded casting for sleep_state Andy Shevchenko
2025-06-12 20:11 ` [PATCH v1 2/5] ACPI: proc: Use correct format specifier and drop casting Andy Shevchenko
@ 2025-06-12 20:11 ` Andy Shevchenko
2025-06-12 20:11 ` [PATCH v1 4/5] ACPI: proc: Use str_enabled_disabled() helper Andy Shevchenko
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2025-06-12 20:11 UTC (permalink / raw)
To: Andy Shevchenko, linux-acpi, linux-kernel; +Cc: Rafael J. Wysocki, Len Brown
With `make W=1` build we get a warning:
drivers/acpi/proc.c: warning: EXPORT_SYMBOL() is not used, but #include <linux/export.h> is present
Fix it by removing unused inclusion.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/acpi/proc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c
index 48215ba09193..8ae85b06c422 100644
--- a/drivers/acpi/proc.c
+++ b/drivers/acpi/proc.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
-#include <linux/export.h>
#include <linux/suspend.h>
#include <linux/bcd.h>
#include <linux/acpi.h>
--
2.47.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v1 4/5] ACPI: proc: Use str_enabled_disabled() helper
2025-06-12 20:11 [PATCH v1 0/5] ACPI: proc: A few cleanups Andy Shevchenko
` (2 preceding siblings ...)
2025-06-12 20:11 ` [PATCH v1 3/5] ACPI: proc: Remove unused header Andy Shevchenko
@ 2025-06-12 20:11 ` Andy Shevchenko
2025-06-12 20:11 ` [PATCH v1 5/5] ACPI: proc: Prefer to use octal permission Andy Shevchenko
2025-06-24 14:04 ` [PATCH v1 0/5] ACPI: proc: A few cleanups Andy Shevchenko
5 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2025-06-12 20:11 UTC (permalink / raw)
To: Andy Shevchenko, linux-acpi, linux-kernel; +Cc: Rafael J. Wysocki, Len Brown
Replace ternary (condition ? "enabled" : "disabled") with
str_enabled_disabled() from string_choices.h to improve readability,
maintain uniform string usage, and reduce binary size through linker
deduplication.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/acpi/proc.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c
index 8ae85b06c422..440150c67ba6 100644
--- a/drivers/acpi/proc.c
+++ b/drivers/acpi/proc.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
+#include <linux/string_choices.h>
#include <linux/suspend.h>
#include <linux/bcd.h>
#include <linux/acpi.h>
@@ -38,8 +39,7 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
if (!dev->physical_node_count) {
seq_printf(seq, "%c%-8s\n",
dev->wakeup.flags.valid ? '*' : ' ',
- device_may_wakeup(&dev->dev) ?
- "enabled" : "disabled");
+ str_enabled_disabled(device_may_wakeup(&dev->dev)));
} else {
struct device *ldev;
list_for_each_entry(entry, &dev->physical_node_list,
@@ -54,9 +54,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
seq_printf(seq, "%c%-8s %s:%s\n",
dev->wakeup.flags.valid ? '*' : ' ',
- (device_may_wakeup(&dev->dev) ||
- device_may_wakeup(ldev)) ?
- "enabled" : "disabled",
+ str_enabled_disabled(device_may_wakeup(ldev) ||
+ device_may_wakeup(&dev->dev)),
ldev->bus ? ldev->bus->name :
"no-bus", dev_name(ldev));
put_device(ldev);
--
2.47.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v1 5/5] ACPI: proc: Prefer to use octal permission
2025-06-12 20:11 [PATCH v1 0/5] ACPI: proc: A few cleanups Andy Shevchenko
` (3 preceding siblings ...)
2025-06-12 20:11 ` [PATCH v1 4/5] ACPI: proc: Use str_enabled_disabled() helper Andy Shevchenko
@ 2025-06-12 20:11 ` Andy Shevchenko
2025-06-24 14:04 ` [PATCH v1 0/5] ACPI: proc: A few cleanups Andy Shevchenko
5 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2025-06-12 20:11 UTC (permalink / raw)
To: Andy Shevchenko, linux-acpi, linux-kernel; +Cc: Rafael J. Wysocki, Len Brown
Octal permissions are preferred over the symbolics ones
for readbility. This ceases warning message pointed by checkpatch.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/acpi/proc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c
index 440150c67ba6..c08ead07252b 100644
--- a/drivers/acpi/proc.c
+++ b/drivers/acpi/proc.c
@@ -139,6 +139,5 @@ static const struct proc_ops acpi_system_wakeup_device_proc_ops = {
void __init acpi_sleep_proc_init(void)
{
/* 'wakeup device' [R/W] */
- proc_create("wakeup", S_IFREG | S_IRUGO | S_IWUSR,
- acpi_root_dir, &acpi_system_wakeup_device_proc_ops);
+ proc_create("wakeup", 0644, acpi_root_dir, &acpi_system_wakeup_device_proc_ops);
}
--
2.47.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v1 0/5] ACPI: proc: A few cleanups
2025-06-12 20:11 [PATCH v1 0/5] ACPI: proc: A few cleanups Andy Shevchenko
` (4 preceding siblings ...)
2025-06-12 20:11 ` [PATCH v1 5/5] ACPI: proc: Prefer to use octal permission Andy Shevchenko
@ 2025-06-24 14:04 ` Andy Shevchenko
2025-06-26 19:10 ` Rafael J. Wysocki
5 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2025-06-24 14:04 UTC (permalink / raw)
To: linux-acpi, linux-kernel; +Cc: Rafael J. Wysocki, Len Brown
On Thu, Jun 12, 2025 at 11:11:24PM +0300, Andy Shevchenko wrote:
> While looking into warning related to export.h inclusion, I took
> the opportunity to make the module up-to-date to the modern APIs.
> Hence this mini-series. Note, the first patch is to make the used
> type consistent across the files.
Hmm... Any comments on this? Do I need to do anything?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v1 0/5] ACPI: proc: A few cleanups
2025-06-24 14:04 ` [PATCH v1 0/5] ACPI: proc: A few cleanups Andy Shevchenko
@ 2025-06-26 19:10 ` Rafael J. Wysocki
0 siblings, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2025-06-26 19:10 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-acpi, linux-kernel, Rafael J. Wysocki, Len Brown
On Tue, Jun 24, 2025 at 4:04 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Jun 12, 2025 at 11:11:24PM +0300, Andy Shevchenko wrote:
> > While looking into warning related to export.h inclusion, I took
> > the opportunity to make the module up-to-date to the modern APIs.
> > Hence this mini-series. Note, the first patch is to make the used
> > type consistent across the files.
>
> Hmm... Any comments on this? Do I need to do anything?
Nope. All queued up for 6.17, thanks!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-06-26 19:10 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12 20:11 [PATCH v1 0/5] ACPI: proc: A few cleanups Andy Shevchenko
2025-06-12 20:11 ` [PATCH v1 1/5] ACPI: wakeup: Drop unneeded casting for sleep_state Andy Shevchenko
2025-06-12 20:11 ` [PATCH v1 2/5] ACPI: proc: Use correct format specifier and drop casting Andy Shevchenko
2025-06-12 20:11 ` [PATCH v1 3/5] ACPI: proc: Remove unused header Andy Shevchenko
2025-06-12 20:11 ` [PATCH v1 4/5] ACPI: proc: Use str_enabled_disabled() helper Andy Shevchenko
2025-06-12 20:11 ` [PATCH v1 5/5] ACPI: proc: Prefer to use octal permission Andy Shevchenko
2025-06-24 14:04 ` [PATCH v1 0/5] ACPI: proc: A few cleanups Andy Shevchenko
2025-06-26 19:10 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).