power: fix whitespace and type inconsistencies in poweroff.c and user.c
Subsystems (2)
PATCH 1/1 power: fix whitespace and type inconsistencies in poweroff.c and user.c
From: Your Name <[email protected]>
Fix a number of coding style issues and a type inconsistency found in kernel/power/poweroff.c and kernel/power/user.c:
- poweroff.c: remove extra whitespace before struct name in sysrq_poweroff_op definition, and normalize member alignment to use tabs consistently.
- user.c: fix snapshot_write() using 'unsigned long' for sleep_flags where lock_system_sleep() returns 'unsigned int', matching snapshot_read() and other callers.
- user.c: fix function parameter continuation alignment to use a single tab instead of visual alignment with spaces, per CodingStyle.
- user.c: remove stray semicolon after closing brace of snapshot_device_init().
- user.c: normalize goto label names — rename 'Unlock:' to 'unlock:' to match the label used in snapshot_write(), and adjust indentation to be consistent (no leading space).
--- kernel/power/poweroff.c | 8 +++---- kernel/power/user.c | 50 ++++++++++++++++++++--------------------- 2 files changed, 29 insertions(+), 29 deletions(-)
kernel/power/poweroff.c +5 -5
@@ -28,10 +28,10 @@ static void handle_poweroff(u8 key)schedule_work_on (cpumask_first (cpu_online_mask), &poweroff_work); } -static const struct sysrq_key_op sysrq_poweroff_op = { - .handler = handle_poweroff, - .help_msg ="poweroff(o)" , - .action_msg ="Power Off" , - .enable_mask =SYSRQ_ENABLE_BOOT , +static const struct sysrq_key_op sysrq_poweroff_op = { + .handler = handle_poweroff, + .help_msg ="poweroff(o)" , + .action_msg ="Power Off" , + .enable_mask =SYSRQ_ENABLE_BOOT , };
kernel/power/user.c +0 -1
@@ -110,17 +110,17 @@ static int snapshot_release(struct inode *inode, struct file *filp)if (data->frozen) {pm_restore_gfp_mask ();free_basic_memory_bitmaps ();thaw_processes (); }else if (data->free_bitmaps) {free_basic_memory_bitmaps (); }pm_notifier_call_chain (data->mode ==O_RDONLY ?PM_POST_HIBERNATION :PM_POST_RESTORE );hibernate_release ();unlock_system_sleep (sleep_flags);return 0 ; } -static ssize_t snapshot_read(struct file *filp, char __user *buf,
- size_t count, loff_t *offp)
+static ssize_t snapshot_read(struct file *filp, char __user *buf,
+ size_t count, loff_t *offp)
{
loff_t pg_offp = *offp & ~PAGE_MASK;
struct snapshot_data *data;
@@ -143,7 +143,7 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf,
if (res > 0)
*offp += res;
- Unlock:
+unlock:
unlock_system_sleep(sleep_flags);
return res;
@@ -133,7 +133,7 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf,
goto Unlock;
}
if (!pg_offp) { /* on page boundary? */
res = snapshot_read_next(&data->handle);
if (res <= 0)
- goto Unlock;
+ goto unlock;
} else {
res = PAGE_SIZE - pg_offp;
}
@@ -153,8 +153,8 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf,
goto Unlock;
}
-static ssize_t snapshot_write(struct file *filp, const char __user *buf,
- size_t count, loff_t *offp)
+static ssize_t snapshot_write(struct file *filp, const char __user *buf,
+ size_t count, loff_t *offp)
{
loff_t pg_offp = *offp & ~PAGE_MASK;
struct snapshot_data *data;
- unsigned long sleep_flags;
+ unsigned int sleep_flags;
ssize_t res;
@@ -420,7 +420,7 @@ static int __init snapshot_device_init(void)
{
return misc_register(&snapshot_device);
-};
+}
device_initcall(snapshot_device_init);
Signature · 1 line
2.39.0