Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2580089rwb; Fri, 2 Dec 2022 11:47:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf6LXgjpbUFCjINKHyjkMNX1BrZwdKlq0PGR75rFshQExjLQzDfuXCW56NdRpOTczIgoKEFK X-Received: by 2002:a17:906:8922:b0:7bd:3aaa:466d with SMTP id fr34-20020a170906892200b007bd3aaa466dmr29784823ejc.1.1670010420826; Fri, 02 Dec 2022 11:47:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670010420; cv=none; d=google.com; s=arc-20160816; b=QJjYM6LrEGrDfDRn21FEby+ylRkemtcb3D3cw+KbZgXOEoycMx8jbkW7Xism3NhuxE 2b7PvG9vBHYgEaqGm38XXKuFJv1UEJW1/JWr8iOWBjo8xGfFCI4dV6IGQBh8/1BaeIon AIRnCQRFKCoWsvy0oEthCe5FbVzNQ4BChfwdTZXHjLzZmpuNm0cBSI51rkhHE0xMQWMX 4DcmstmA4PFA418hhXTA+WsuWFLMMiPM0SLMtehq1aTLN04s5jHdDdX7xlXmeUz0TCC/ dm9McxFvnY5jZYZ2aq52FMrnG4Q9ZMIL/FrTbCgZlRJDVlyggtQRcuT4Si3PlvM5af74 N8fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=cxqOAYX+EWKb+h7rdw206KR111U/KmrZPjRc5PMfRR4=; b=gf9qMZsawGUOYJBUsBDjBNR3DTaT89bzGG0qEk5Nz9yt6WcVxqmMfkU67l95d3mepK 87ynUVsVVOJIsTY0FxhnqvIiMVxntgG+LQ5Qw1CCARloxgHJgMvADnrR78nQj/cqsYDv 1zYtZz6RhaW5sDXEGNtrVFFta1VD/6FKbrfA8VGqqQTQVFXq4DVk5tF1Ag6E1wgKC+qP QtU+5iaLa7ROsQ/ZpYlG+dSlfyqAiQUbX9qTTRQLh0rjo9YiXJMQPmbwvusv4lsq5sS1 FuIfWAuQzk0JZ1VvFlgjeNYa3+0hf1Ura8R3v9+VA0zMDQIMEP+hqzUdr5wctWczs53f m4Zg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ch25-20020a0564021bd900b00461dca37cd0si3838651edb.126.2022.12.02.11.46.40; Fri, 02 Dec 2022 11:47:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234781AbiLBT0Y (ORCPT + 84 others); Fri, 2 Dec 2022 14:26:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234302AbiLBT0T (ORCPT ); Fri, 2 Dec 2022 14:26:19 -0500 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 569EAF289C; Fri, 2 Dec 2022 11:26:18 -0800 (PST) Received: by mail-qt1-f175.google.com with SMTP id y15so6577550qtv.5; Fri, 02 Dec 2022 11:26:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cxqOAYX+EWKb+h7rdw206KR111U/KmrZPjRc5PMfRR4=; b=I5D1xoKretWOe3Vq7nyv/48xRYdDZWxr+zOj6Nub8d5XOpaKTkELKyMUiCJ68NF/yb tLqnir8Jd0JdulU+BDrSGq06Sn//09P+ZYscpsqbA5SsLiijaIwjwYEomx65PKPu1ksv LtgwBc/AQMQd1ALdnGmWLqn4p7rhPm5K5ywsaHeN5ExrMX3TuR9nK87QtFnsXTNH03H4 8mYLDDVoDppWtl6m9Ny46kPZz4K54X0D7uTtGreGTT0Z9mgEk+Yf7iDfYsv+4OiAhP4e ph2L3ntI2j1Bk170PGUNhhsTkZN5nOZPQUHsdTGnmPKlhCBB/n9QntbSS2iwM7rQOa+y 9jZg== X-Gm-Message-State: ANoB5pmkJ5xKlBvWxkxr/dDkpai49BnsZS9QBdcq6o9eT1YufEaFT1Xa RjeS8rqMs0r1sIUFW2x+1fpO5dDYPlYNiMLdS6LHjBoS X-Received: by 2002:a05:620a:51ca:b0:6ec:fa04:d97c with SMTP id cx10-20020a05620a51ca00b006ecfa04d97cmr47184706qkb.764.1670009177509; Fri, 02 Dec 2022 11:26:17 -0800 (PST) MIME-Version: 1.0 References: <202211301616083499042@zte.com.cn> In-Reply-To: <202211301616083499042@zte.com.cn> From: "Rafael J. Wysocki" Date: Fri, 2 Dec 2022 20:26:06 +0100 Message-ID: Subject: Re: [PATCH v2] ACPI: use sysfs_emit() to instead of scnprintf() To: ye.xingchen@zte.com.cn Cc: rafael@kernel.org, lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 30, 2022 at 9:16 AM wrote: > > From: ye xingchen > > Replace the open-code with sysfs_emit() to simplify the code. > > Signed-off-by: ye xingchen > --- > v1 -> v2 > combine patchs in drivers/acpi/. > drivers/acpi/acpi_pad.c | 4 ++-- > drivers/acpi/cppc_acpi.c | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c > index edbb28faee2a..02f1a1b1143c 100644 > --- a/drivers/acpi/acpi_pad.c > +++ b/drivers/acpi/acpi_pad.c > @@ -287,7 +287,7 @@ static ssize_t rrtime_store(struct device *dev, > static ssize_t rrtime_show(struct device *dev, > struct device_attribute *attr, char *buf) > { > - return scnprintf(buf, PAGE_SIZE, "%d\n", round_robin_time); > + return sysfs_emit(buf, "%d\n", round_robin_time); > } > static DEVICE_ATTR_RW(rrtime); > > @@ -309,7 +309,7 @@ static ssize_t idlepct_store(struct device *dev, > static ssize_t idlepct_show(struct device *dev, > struct device_attribute *attr, char *buf) > { > - return scnprintf(buf, PAGE_SIZE, "%d\n", idle_pct); > + return sysfs_emit(buf, "%d\n", idle_pct); > } > static DEVICE_ATTR_RW(idlepct); > > diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c > index 093675b1a1ff..0f17b1c32718 100644 > --- a/drivers/acpi/cppc_acpi.c > +++ b/drivers/acpi/cppc_acpi.c > @@ -148,7 +148,7 @@ __ATTR(_name, 0444, show_##_name, NULL) > if (ret) \ > return ret; \ > \ > - return scnprintf(buf, PAGE_SIZE, "%llu\n", \ > + return sysfs_emit(buf, "%llu\n", \ > (u64)st_name.member_name); \ > } \ > define_one_cppc_ro(member_name) > @@ -174,7 +174,7 @@ static ssize_t show_feedback_ctrs(struct kobject *kobj, > if (ret) > return ret; > > - return scnprintf(buf, PAGE_SIZE, "ref:%llu del:%llu\n", > + return sysfs_emit(buf, "ref:%llu del:%llu\n", > fb_ctrs.reference, fb_ctrs.delivered); > } > define_one_cppc_ro(feedback_ctrs); > -- Applied as 6.2 material, thanks!