Message ID | 202212071537405832465@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp38066wrr; Tue, 6 Dec 2022 23:40:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf7WjhbP4P9D7uFa9G10xiiKSxX4cMhWm0INB1yxg7tA+TmcUUyElkbZi90e0cVu+I4XBbHg X-Received: by 2002:a05:6402:444c:b0:462:2e27:3bf2 with SMTP id o12-20020a056402444c00b004622e273bf2mr80875376edb.13.1670398831797; Tue, 06 Dec 2022 23:40:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670398831; cv=none; d=google.com; s=arc-20160816; b=zr7ly9Q54EpuXZ3sr7o58XoD8z1p+pvmPqfgfs0DJM9VvDJkVaQxyV3Q8P5o23qkab D1yi2py3+f6HbAlpBMlNijmed4fPlFSjQucWCtU65pRJof8r9giUOCahwexJiwkySkmS sBVhNgPPHkidGEprrq7ksnw77+jR6z/vTue5zfkCQv3VUGeku35AxZZiX1vhEhtXYQsM K+i3UFOir0I+iLc1r8mzdieufc7GonqlDSuIXu+tVlHr+L0D6ruhjjaVx33dCKNDept2 MdZ99ZSpNTj1cLrY79VJ3dbxd6kHwYMSHxCjeRl5PRKE83qf04o7ZrXxWwSBqp/PT/rJ +kCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=tUToXMzRpC4jIAviKpumySwGuysGch97mFtJ659chY0=; b=cQ7rzJt+FCdXY36+UaWQlbrOuTRP8nJraddvQM/BT2psn7q4KNItza/gmLBrnf7lNq fEkxbcTR8RRTv2NsfeIBKyGHkNlKQgSWIGkWVFx+Np+sjYRoG2O/3lhYWXrv4tr0EQTV l2h3G2gJb0U5myMRZuWFjkolA7aHU+1jmsF1/TTzOa0CweDsRQMtEkhD/frVqToPpDUB BOZ4ruXQGLw1CstqSYeDji6sxihtckK04x+bU5LXrzZql7npp+x1oq8js32YYRDufw1k fHdeWu3PfAGeHiP8qRIP5qqwOwtfZAxerskvUNiz8BEyDMu3DPyPomDvMMJ9Io1xNv54 2/GA== 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=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4-20020a170906794400b007878c9d73a2si17252250ejo.426.2022.12.06.23.40.08; Tue, 06 Dec 2022 23:40:31 -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=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229572AbiLGHhx (ORCPT <rfc822;b08248@gmail.com> + 99 others); Wed, 7 Dec 2022 02:37:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbiLGHhq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 7 Dec 2022 02:37:46 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8654A15A29; Tue, 6 Dec 2022 23:37:43 -0800 (PST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4NRpzB4NJ6z4xVnf; Wed, 7 Dec 2022 15:37:42 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl1.zte.com.cn with SMTP id 2B77bc9r055311; Wed, 7 Dec 2022 15:37:38 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Wed, 7 Dec 2022 15:37:40 +0800 (CST) Date: Wed, 7 Dec 2022 15:37:40 +0800 (CST) X-Zmail-TransId: 2af9639042c45db7c2cb X-Mailer: Zmail v1.0 Message-ID: <202212071537405832465@zte.com.cn> Mime-Version: 1.0 From: <ye.xingchen@zte.com.cn> To: <jic23@kernel.org> Cc: <lars@metafoo.de>, <andriy.shevchenko@linux.intel.com>, <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: =?utf-8?q?=5BPATCH=5D_iio=3A_health=3A_afe440x=3A_Convert_to_use_sy?= =?utf-8?q?sfs=5Femit=5Fat=28=29_API?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2B77bc9r055311 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 639042C6.000 by FangMail milter! X-FangMail-Envelope: 1670398662/4NRpzB4NJ6z4xVnf/639042C6.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/<ye.xingchen@zte.com.cn> X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 639042C6.000/4NRpzB4NJ6z4xVnf X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751540125378443674?= X-GMAIL-MSGID: =?utf-8?q?1751540125378443674?= |
Series |
iio: health: afe440x: Convert to use sysfs_emit_at() API
|
|
Commit Message
ye.xingchen@zte.com.cn
Dec. 7, 2022, 7:37 a.m. UTC
From: ye xingchen <ye.xingchen@zte.com.cn> Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> --- drivers/iio/health/afe440x.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Comments
On Wed, 7 Dec 2022 15:37:40 +0800 (CST) <ye.xingchen@zte.com.cn> wrote: > From: ye xingchen <ye.xingchen@zte.com.cn> > > Follow the advice of the Documentation/filesystems/sysfs.rst and show() > should only use sysfs_emit() or sysfs_emit_at() when formatting the > value to be returned to user space. > > Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn> > --- > drivers/iio/health/afe440x.h | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h > index 0adea0047eba..7750b1adc423 100644 > --- a/drivers/iio/health/afe440x.h > +++ b/drivers/iio/health/afe440x.h > @@ -122,9 +122,7 @@ static ssize_t _name ## _show(struct device *dev, \ > int i; \ > \ > for (i = 0; i < ARRAY_SIZE(_table); i++) \ > - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06u ", \ > - _table[i].integer, \ > - _table[i].fract); \ > + len += sysfs_emit_at(buf, len, "%d.%06u ", _table[i].integer, _table[i].fract); \ Please keep to the shorter original wrapping on this. It's fine to go above 80 chars (below 100) if it makes a significant improvement to readability. I don't think that's true here, so better to stick to the shorter length. > \ > buf[len - 1] = '\n'; \ > \
diff --git a/drivers/iio/health/afe440x.h b/drivers/iio/health/afe440x.h index 0adea0047eba..7750b1adc423 100644 --- a/drivers/iio/health/afe440x.h +++ b/drivers/iio/health/afe440x.h @@ -122,9 +122,7 @@ static ssize_t _name ## _show(struct device *dev, \ int i; \ \ for (i = 0; i < ARRAY_SIZE(_table); i++) \ - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06u ", \ - _table[i].integer, \ - _table[i].fract); \ + len += sysfs_emit_at(buf, len, "%d.%06u ", _table[i].integer, _table[i].fract); \ \ buf[len - 1] = '\n'; \ \