From patchwork Tue Feb 4 20:43:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Capella X-Patchwork-Id: 24145 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f199.google.com (mail-yk0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7803A202FA for ; Tue, 4 Feb 2014 20:44:03 +0000 (UTC) Received: by mail-yk0-f199.google.com with SMTP id 142sf53983268ykq.2 for ; Tue, 04 Feb 2014 12:44:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=oWpbc3g4YG9OCn8DiQlmO2C9+O4L7ApYRM1bT3AreCY=; b=Sf5GmKSI5125s8PEhGHZuKP8JZ3ZBDn32WbSTnBrllDZFi3RYFfRD/o3vbAecyJv9v 1kk8DwtW8QHa9rR7YUdMmLVgdIrmhTyIaMUUnlpUk8LMUB+YcUUBMhiwyKwXP50PWTVr z+me7bZU/qbhYgpjk/8d4rnIRgAlESeS9MHI2nkgHR1XBZbR3J2XQDG6XzBaZ0RJrEGp Wdf7pQLF2M779i5UkU17YOQwv8vKxQJpso9HtSNvOpEjpu1V42viw3n0fizT6DvmLoog c9rne6+YyIVqFtCUvHI9v8maLJBzqoS/+6kWGFlH0NPxD4W4KDZL2J4BD47Mnx4S8G7Q e3qg== X-Gm-Message-State: ALoCoQm/x80Dj8enCpYwfU03/nf7+9nB3BQ1klcJQav7h5nlR6SEQm8HL7G0Te7P2LfkNoe4pDN0 X-Received: by 10.236.191.136 with SMTP id g8mr607778yhn.48.1391546641221; Tue, 04 Feb 2014 12:44:01 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.36.200 with SMTP id p66ls2393285qgp.74.gmail; Tue, 04 Feb 2014 12:44:01 -0800 (PST) X-Received: by 10.220.95.139 with SMTP id d11mr10663185vcn.21.1391546641125; Tue, 04 Feb 2014 12:44:01 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id vd4si8684539vdc.104.2014.02.04.12.44.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 12:44:01 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id cz12so6485912veb.15 for ; Tue, 04 Feb 2014 12:44:01 -0800 (PST) X-Received: by 10.52.30.167 with SMTP id t7mr2097531vdh.36.1391546641012; Tue, 04 Feb 2014 12:44:01 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp273872vcz; Tue, 4 Feb 2014 12:44:00 -0800 (PST) X-Received: by 10.68.178.66 with SMTP id cw2mr33059437pbc.89.1391546639956; Tue, 04 Feb 2014 12:43:59 -0800 (PST) Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by mx.google.com with ESMTPS id mj6si26089589pab.43.2014.02.04.12.43.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 12:43:59 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.44 is neither permitted nor denied by best guess record for domain of sebastian.capella@linaro.org) client-ip=209.85.160.44; Received: by mail-pb0-f44.google.com with SMTP id rq2so8943743pbb.31 for ; Tue, 04 Feb 2014 12:43:59 -0800 (PST) X-Received: by 10.67.12.200 with SMTP id es8mr45710798pad.3.1391546639497; Tue, 04 Feb 2014 12:43:59 -0800 (PST) Received: from localhost (cpe-76-93-135-111.san.res.rr.com. [76.93.135.111]) by mx.google.com with ESMTPSA id zc6sm178229437pab.18.2014.02.04.12.43.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 04 Feb 2014 12:43:58 -0800 (PST) From: Sebastian Capella 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 , Pavel Machek , Len Brown , "Rafael J. Wysocki" Subject: [PATCH v7 2/3] trivial: PM / Hibernate: clean up checkpatch in hibernate.c Date: Tue, 4 Feb 2014 12:43:50 -0800 Message-Id: <1391546631-7715-3-git-send-email-sebastian.capella@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1391546631-7715-1-git-send-email-sebastian.capella@linaro.org> References: <1391546631-7715-1-git-send-email-sebastian.capella@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sebastian.capella@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 Cc: Pavel Machek Cc: Len Brown Cc: "Rafael J. Wysocki" --- 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; }