From patchwork Thu Oct 3 21:10:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Capella X-Patchwork-Id: 20819 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E9816266EC for ; Thu, 3 Oct 2013 21:11:09 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id x20sf5757872qcv.3 for ; Thu, 03 Oct 2013 14:11:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state: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=z/vfkxxQDFX3D1s2T352LxLciMW9/grWzdsmf2EaKhY=; b=VPoCwDTeULpaVX0JLLMXt+Jurgy6PIfJOGUjMWXfVskdEpFtW3H3+ESni590XdoLA9 g2Du+Dk9oRxSSHbYnkumxfjTfV3VvAdHCL+k9NjSwdSixD3jeRnFhSHj09biIZq2wJJs orRYn+g45ZNg+GhXjEdCsJ0Jtc67I99kNBBMXB9BM4LbHTf7pqhgSs+sgO8JKPEB6L8F XjJCEIlQoiJZk9uF5Z5Gh3DkeTHCXGBTn4mdjKg1ZC99I/y+TvrzHlKj/lY/myHwbQWb EQ6WxvayikeLnrH+xXJtp7z0ubmksSe3F5VeZb01XZYnbnJMChqEeRPrhgQGU1MThvUE 1i/Q== X-Received: by 10.58.221.6 with SMTP id qa6mr1697463vec.33.1380834669759; Thu, 03 Oct 2013 14:11:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.99.106 with SMTP id ep10ls1172887qeb.59.gmail; Thu, 03 Oct 2013 14:11:09 -0700 (PDT) X-Received: by 10.52.108.230 with SMTP id hn6mr2632675vdb.28.1380834669649; Thu, 03 Oct 2013 14:11:09 -0700 (PDT) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id nr7si2169640vec.103.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Oct 2013 14:11:09 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.50; Received: by mail-vb0-f50.google.com with SMTP id x14so1851928vbb.23 for ; Thu, 03 Oct 2013 14:11:09 -0700 (PDT) X-Gm-Message-State: ALoCoQkNP1/C9tz91GK8ejgQntVKzMf4HuHh4edgU/RZ7OYCK5RftpIPWczL9fZLXiEUFtBAIoDo X-Received: by 10.52.113.99 with SMTP id ix3mr7676931vdb.22.1380834669503; Thu, 03 Oct 2013 14:11:09 -0700 (PDT) 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 u4csp210093vcz; Thu, 3 Oct 2013 14:11:09 -0700 (PDT) X-Received: by 10.67.4.197 with SMTP id cg5mr11657559pad.10.1380834667978; Thu, 03 Oct 2013 14:11:07 -0700 (PDT) Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) by mx.google.com with ESMTPS id 5si7526290pax.323.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Oct 2013 14:11:07 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.175 is neither permitted nor denied by best guess record for domain of sebastian.capella@linaro.org) client-ip=209.85.192.175; Received: by mail-pd0-f175.google.com with SMTP id q10so3046536pdj.34 for ; Thu, 03 Oct 2013 14:11:07 -0700 (PDT) X-Received: by 10.66.145.4 with SMTP id sq4mr4432728pab.178.1380834667460; Thu, 03 Oct 2013 14:11:07 -0700 (PDT) Received: from localhost (rrcs-108-178-170-106.west.biz.rr.com. [108.178.170.106]) by mx.google.com with ESMTPSA id og5sm10267775pbb.10.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 03 Oct 2013 14:11:06 -0700 (PDT) From: Sebastian Capella To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, patches@linaro.org Cc: Sebastian Capella , Len Brown , "Rafael J. Wysocki" Subject: [PATCH v3 2/2] PM / Hibernate: use name_to_dev_t to parse resume Date: Thu, 3 Oct 2013 14:10:38 -0700 Message-Id: <1380834638-24035-3-git-send-email-sebastian.capella@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1380834638-24035-1-git-send-email-sebastian.capella@linaro.org> References: <1380834638-24035-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.212.50 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: , Use the name_to_dev_t call to parse the device name echo'd to to /sys/power/resume. This imitates the method used in hibernate.c in software_resume, and allows the resume partition to be specified using other equivalent device formats as well. By allowing /sys/debug/resume to accept the same syntax as the resume=device parameter, we can parse the resume=device in the init script and use the resume device directly from the kernel command line. Signed-off-by: Sebastian Capella Acked-by: Pavel Machek Cc: Len Brown Cc: "Rafael J. Wysocki" --- kernel/power/hibernate.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index c9c759d..a29d2a7 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c @@ -972,16 +972,11 @@ static ssize_t resume_show(struct kobject *kobj, struct kobj_attribute *attr, static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t n) { - unsigned int maj, min; dev_t res; - int ret = -EINVAL; - if (sscanf(buf, "%u:%u", &maj, &min) != 2) - goto out; - - res = MKDEV(maj,min); - if (maj != MAJOR(res) || min != MINOR(res)) - goto out; + res = name_to_dev_t(buf); + if (res == 0) + return -EINVAL; lock_system_sleep(); swsusp_resume_device = res; @@ -989,9 +984,7 @@ static ssize_t resume_store(struct kobject *kobj, struct kobj_attribute *attr, printk(KERN_INFO "PM: Starting manual resume from disk\n"); noresume = 0; software_resume(); - ret = n; - out: - return ret; + return n; } power_attr(resume);