linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Capella <sebastian.capella@linaro.org>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-pm@vger.kernel.org, linaro-kernel@lists.linaro.org,
	patches@linaro.org
Cc: Sebastian Capella <sebastian.capella@linaro.org>,
	Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: [PATCH v7 2/3] trivial: PM / Hibernate: clean up checkpatch in hibernate.c
Date: Tue,  4 Feb 2014 12:43:50 -0800	[thread overview]
Message-ID: <1391546631-7715-3-git-send-email-sebastian.capella@linaro.org> (raw)
In-Reply-To: <1391546631-7715-1-git-send-email-sebastian.capella@linaro.org>

Checkpatch reports several warnings in hibernate.c
printk use removed, long lines wrapped, whitespace cleanup,
extend short msleeps, while loops on two lines.

Signed-off-by: Sebastian Capella <sebastian.capella@linaro.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Len Brown <len.brown@intel.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
---
 kernel/power/hibernate.c |   62 ++++++++++++++++++++++++----------------------
 1 file changed, 32 insertions(+), 30 deletions(-)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 0121dab..cd1e30c 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -94,7 +94,7 @@ EXPORT_SYMBOL(system_entering_hibernation);
 #ifdef CONFIG_PM_DEBUG
 static void hibernation_debug_sleep(void)
 {
-	printk(KERN_INFO "hibernation debug: Waiting for 5 seconds.\n");
+	pr_info("hibernation debug: Waiting for 5 seconds.\n");
 	mdelay(5000);
 }
 
@@ -239,7 +239,7 @@ void swsusp_show_speed(struct timeval *start, struct timeval *stop,
 		centisecs = 1;	/* avoid div-by-zero */
 	k = nr_pages * (PAGE_SIZE / 1024);
 	kps = (k * 100) / centisecs;
-	printk(KERN_INFO "PM: %s %d kbytes in %d.%02d seconds (%d.%02d MB/s)\n",
+	pr_info("PM: %s %d kbytes in %d.%02d seconds (%d.%02d MB/s)\n",
 			msg, k,
 			centisecs / 100, centisecs % 100,
 			kps / 1000, (kps % 1000) / 10);
@@ -260,8 +260,7 @@ static int create_image(int platform_mode)
 
 	error = dpm_suspend_end(PMSG_FREEZE);
 	if (error) {
-		printk(KERN_ERR "PM: Some devices failed to power down, "
-			"aborting hibernation\n");
+		pr_err("PM: Some devices failed to power down, aborting hibernation\n");
 		return error;
 	}
 
@@ -277,8 +276,7 @@ static int create_image(int platform_mode)
 
 	error = syscore_suspend();
 	if (error) {
-		printk(KERN_ERR "PM: Some system devices failed to power down, "
-			"aborting hibernation\n");
+		pr_err("PM: Some system devices failed to power down, aborting hibernation\n");
 		goto Enable_irqs;
 	}
 
@@ -289,8 +287,7 @@ static int create_image(int platform_mode)
 	save_processor_state();
 	error = swsusp_arch_suspend();
 	if (error)
-		printk(KERN_ERR "PM: Error %d creating hibernation image\n",
-			error);
+		pr_err("PM: Error %d creating hibernation image\n", error);
 	/* Restore control flow magically appears here */
 	restore_processor_state();
 	if (!in_suspend) {
@@ -413,8 +410,7 @@ static int resume_target_kernel(bool platform_mode)
 
 	error = dpm_suspend_end(PMSG_QUIESCE);
 	if (error) {
-		printk(KERN_ERR "PM: Some devices failed to power down, "
-			"aborting resume\n");
+		pr_err("PM: Some devices failed to power down, aborting resume\n");
 		return error;
 	}
 
@@ -550,7 +546,8 @@ int hibernation_platform_enter(void)
 
 	hibernation_ops->enter();
 	/* We should never get here */
-	while (1);
+	while (1)
+		;
 
  Power_up:
 	syscore_resume();
@@ -611,8 +608,7 @@ static void power_down(void)
 		 */
 		error = swsusp_unmark();
 		if (error)
-			printk(KERN_ERR "PM: Swap will be unusable! "
-			                "Try swapon -a.\n");
+			pr_err("PM: Swap will be unusable! Try swapon -a.\n");
 		return;
 #endif
 	}
@@ -621,8 +617,9 @@ static void power_down(void)
 	 * Valid image is on the disk, if we continue we risk serious data
 	 * corruption after resume.
 	 */
-	printk(KERN_CRIT "PM: Please power down manually\n");
-	while(1);
+	pr_crit("PM: Please power down manually\n");
+	while (1)
+		;
 }
 
 /**
@@ -644,9 +641,9 @@ int hibernate(void)
 	if (error)
 		goto Exit;
 
-	printk(KERN_INFO "PM: Syncing filesystems ... ");
+	pr_info("PM: Syncing filesystems ... ");
 	sys_sync();
-	printk("done.\n");
+	pr_cont("done.\n");
 
 	error = freeze_processes();
 	if (error)
@@ -670,7 +667,7 @@ int hibernate(void)
 		if (nocompress)
 			flags |= SF_NOCOMPRESS_MODE;
 		else
-		        flags |= SF_CRC32_MODE;
+			flags |= SF_CRC32_MODE;
 
 		pr_debug("PM: writing image.\n");
 		error = swsusp_write(flags);
@@ -750,7 +747,7 @@ static int software_resume(void)
 	pr_debug("PM: Checking hibernation image partition %s\n", resume_file);
 
 	if (resume_delay) {
-		printk(KERN_INFO "Waiting %dsec before reading resume device...\n",
+		pr_info("Waiting %dsec before reading resume device...\n",
 			resume_delay);
 		ssleep(resume_delay);
 	}
@@ -765,7 +762,7 @@ static int software_resume(void)
 	if (isdigit(resume_file[0]) && resume_wait) {
 		int partno;
 		while (!get_gendisk(swsusp_resume_device, &partno))
-			msleep(10);
+			msleep(20);
 	}
 
 	if (!swsusp_resume_device) {
@@ -776,8 +773,9 @@ static int software_resume(void)
 		wait_for_device_probe();
 
 		if (resume_wait) {
-			while ((swsusp_resume_device = name_to_dev_t(resume_file)) == 0)
-				msleep(10);
+			while ((swsusp_resume_device =
+					name_to_dev_t(resume_file)) == 0)
+				msleep(20);
 			async_synchronize_full();
 		}
 
@@ -826,7 +824,7 @@ static int software_resume(void)
 	if (!error)
 		hibernation_restore(flags & SF_PLATFORM_MODE);
 
-	printk(KERN_ERR "PM: Failed to load hibernation image, recovering.\n");
+	pr_err("PM: Failed to load hibernation image, recovering.\n");
 	swsusp_free();
 	free_basic_memory_bitmaps();
  Thaw:
@@ -965,7 +963,7 @@ power_attr(disk);
 static ssize_t resume_show(struct kobject *kobj, struct kobj_attribute *attr,
 			   char *buf)
 {
-	return sprintf(buf,"%d:%d\n", MAJOR(swsusp_resume_device),
+	return sprintf(buf, "%d:%d\n", MAJOR(swsusp_resume_device),
 		       MINOR(swsusp_resume_device));
 }
 
@@ -986,7 +984,7 @@ static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr,
 	lock_system_sleep();
 	swsusp_resume_device = res;
 	unlock_system_sleep();
-	printk(KERN_INFO "PM: Starting manual resume from disk\n");
+	pr_info("PM: Starting manual resume from disk\n");
 	noresume = 0;
 	software_resume();
 	ret = n;
@@ -996,13 +994,15 @@ static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr,
 
 power_attr(resume);
 
-static ssize_t image_size_show(struct kobject *kobj, struct kobj_attribute *attr,
+static ssize_t image_size_show(struct kobject *kobj,
+			       struct kobj_attribute *attr,
 			       char *buf)
 {
 	return sprintf(buf, "%lu\n", image_size);
 }
 
-static ssize_t image_size_store(struct kobject *kobj, struct kobj_attribute *attr,
+static ssize_t image_size_store(struct kobject *kobj,
+				struct kobj_attribute *attr,
 				const char *buf, size_t n)
 {
 	unsigned long size;
@@ -1039,7 +1039,7 @@ static ssize_t reserved_size_store(struct kobject *kobj,
 
 power_attr(reserved_size);
 
-static struct attribute * g[] = {
+static struct attribute *g[] = {
 	&disk_attr.attr,
 	&resume_attr.attr,
 	&image_size_attr.attr,
@@ -1066,7 +1066,7 @@ static int __init resume_setup(char *str)
 	if (noresume)
 		return 1;
 
-	strncpy( resume_file, str, 255 );
+	strncpy(resume_file, str, 255);
 	return 1;
 }
 
@@ -1106,7 +1106,9 @@ static int __init resumewait_setup(char *str)
 
 static int __init resumedelay_setup(char *str)
 {
-	resume_delay = simple_strtoul(str, NULL, 0);
+	int ret = kstrtoint(str, 0, &resume_delay);
+	/* mask must_check warn; on failure, leaves resume_delay unchanged */
+	(void)ret;
 	return 1;
 }
 
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2014-02-04 20:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-04 20:43 [PATCH v7 0/3] hibernation related patches Sebastian Capella
2014-02-04 20:43 ` [PATCH v7 1/3] mm: add kstrdup_trimnl function Sebastian Capella
2014-02-05 21:50   ` Andrew Morton
2014-02-05 22:55     ` Sebastian Capella
2014-02-05 23:01       ` Andrew Morton
2014-02-06 23:48         ` Sebastian Capella
2014-02-04 20:43 ` Sebastian Capella [this message]
2014-02-04 21:21   ` [PATCH v7 2/3] trivial: PM / Hibernate: clean up checkpatch in hibernate.c Joe Perches
2014-02-04 22:05     ` Sebastian Capella
2014-02-04 23:45       ` Joe Perches
2014-02-04 21:36   ` Rafael J. Wysocki
2014-02-04 22:37     ` Sebastian Capella
2014-02-04 23:22       ` Sebastian Capella
2014-02-05  0:03         ` Rafael J. Wysocki
2014-02-05  0:06           ` Sebastian Capella
2014-02-05  0:28             ` Rafael J. Wysocki
2014-02-05  0:24               ` Sebastian Capella
2014-02-05 11:07                 ` Rafael J. Wysocki
2014-02-04 23:59       ` Rafael J. Wysocki
2014-02-04 20:43 ` [PATCH v7 3/3] PM / Hibernate: use name_to_dev_t to parse resume Sebastian Capella
2014-02-04 21:39   ` Rafael J. Wysocki
2014-02-04 23:17     ` Sebastian Capella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391546631-7715-3-git-send-email-sebastian.capella@linaro.org \
    --to=sebastian.capella@linaro.org \
    --cc=len.brown@intel.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).