From patchwork Tue Dec 11 16:20:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 10724143 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA2FE91E for ; Tue, 11 Dec 2018 16:21:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC3F62B2B8 for ; Tue, 11 Dec 2018 16:21:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FE382B31C; Tue, 11 Dec 2018 16:21:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30D4A2B370 for ; Tue, 11 Dec 2018 16:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727658AbeLKQU5 (ORCPT ); Tue, 11 Dec 2018 11:20:57 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:37602 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728558AbeLKQUw (ORCPT ); Tue, 11 Dec 2018 11:20:52 -0500 Received: by mail-pf1-f193.google.com with SMTP id y126so7359379pfb.4; Tue, 11 Dec 2018 08:20:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=A3iI1S+Om+sIC+ztdDR4tlO8XcxPCJfL/Men59gIMvQ=; b=Cf5+F2kMjt6Muf7oFm1DVU2B3fXKR0uFRgfsMlAQSqF+oSjv+aQezlHZ5LGu66uqaa dKmcKTDRuNpS8Qpvxi62p6CeiCFOZceUA6W4jqK3Qph/2SIxDHaeG02mqzNzMWTGQ0wN kD/tOAntXfK1DRD9SoU8jqN2Guj3ZJrmd7efycyxYgH7qt18lCJsL/VRtm0W3AMpRvVw 2iLAqwnLnr2stvfs2BOVxFypUU8Q9MB3cwt0GNHc/u0x4HbwD29DFn/+BkMt95QakBlR /7ckqkgH3xuObkxQsNpV3cYoiMHDWKNQni9g1OFleHrl0ruF0g45YW7OEsEdrBg88vEQ zLbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=A3iI1S+Om+sIC+ztdDR4tlO8XcxPCJfL/Men59gIMvQ=; b=ugHq1lWssVhC0T42EbtzFtEH6KIaGnMvZZ/gHTVgxEOSmLwj39i1BzJ018B8qii0DH 6Le4COE3pp25Z5xhE39GFv+JLB0L4fyL5+r/NSOz+SHRzNKZXJl9uqlt9L+hk0OuaExo 0B0Jologz0t4l9hs4yK6iYHZzjI+Sjt/4ivMpK+0SnajS5kfO7IRJAe6p4+cwMO3897K tmSu0rEGf4UsdxL12IFySzAD/7n/ekaXFSsP2fCU1HCibkJyY2SNciJj/HcHAkvBO08+ SmiZG1crWDOtP2gNy6PVfW01eYNL67e25jxpdy6YsIg1UNO9kk7OzugVnqKnfXU6b5Ez 5aPw== X-Gm-Message-State: AA+aEWYnTcjXodZADAesHQ/Sti1ad2Z9W4AQu5lhjHC7z53EEtdt/cBM 5D4OOIjvENOmCXcURQk7Cy8= X-Google-Smtp-Source: AFSGD/XHPa9Wb+AjqkSHaNk7ak3PlqBH4vjiGzS9ZiY8k8iQqpuSCMmZXChjCgsrecksj3QzYaoFtQ== X-Received: by 2002:a65:434d:: with SMTP id k13mr15206919pgq.269.1544545251250; Tue, 11 Dec 2018 08:20:51 -0800 (PST) Received: from localhost (68.168.130.77.16clouds.com. [68.168.130.77]) by smtp.gmail.com with ESMTPSA id s21sm27425932pfk.133.2018.12.11.08.20.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Dec 2018 08:20:50 -0800 (PST) From: Yangtao Li To: rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH] PM / sleep: convert to DEFINE_SHOW_ATTRIBUTE Date: Tue, 11 Dec 2018 11:20:48 -0500 Message-Id: <20181211162048.21906-1-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yangtao Li Acked-by: Pavel Machek --- kernel/power/main.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/kernel/power/main.c b/kernel/power/main.c index 35b50823d83b..98e76cad128b 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -318,23 +318,12 @@ static int suspend_stats_show(struct seq_file *s, void *unused) return 0; } - -static int suspend_stats_open(struct inode *inode, struct file *file) -{ - return single_open(file, suspend_stats_show, NULL); -} - -static const struct file_operations suspend_stats_operations = { - .open = suspend_stats_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(suspend_stats); static int __init pm_debugfs_init(void) { debugfs_create_file("suspend_stats", S_IFREG | S_IRUGO, - NULL, NULL, &suspend_stats_operations); + NULL, NULL, &suspend_stats_fops); return 0; }