Message ID | 202212071003192805636@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 q4csp3162987wrr; Tue, 6 Dec 2022 18:08:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf7OfzGpUsbPSjOQPiE/0sfgK6S6N+0AAraiF6Ff/OVNEy78TeRtxPP8IkPwYWlcZTdn2Q4j X-Received: by 2002:a17:906:7f90:b0:7c0:ba2c:a4e8 with SMTP id f16-20020a1709067f9000b007c0ba2ca4e8mr3967616ejr.642.1670378903490; Tue, 06 Dec 2022 18:08:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670378903; cv=none; d=google.com; s=arc-20160816; b=vGsebjgEKqFYCuOTaCPEE3Nh6lB+CdFMxUpJBsKDH5LYqJopOrpb+4nhaeDiINT19u 7P0mzAxMHWbYpaSxzXEi+nxQfZBa5O/S7QMpta008K9jnpEXlahFW1vkJK8+Huhx0WTs cGbIWqGQY75YYNFv38IVSpHgen3q8LYiQRUtKExUl0RcRyTTg1t/UFT1wU7rqAAdaRrE 0KcEzW3fMBXuDsdWPF5dnkocNXZMVBA88YK19fA8Z6YcLnoi8V4/yiNK05RSv5XYrrAu vacsbtk8fnsKgwX1XAWUOnr8U/XQhnz3gUpa7ua6eNsFHYTItChNOCAgv6dLr4YyioTB qrig== 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=wZg4+j78iHeGi7WS4IoNwZ5zlcY4/GNmyJwAr0a9PDg=; b=abL+qtessR2cK7ivBSUhboNlTzs2hOLGUvCiVEMtDcuKOYjw9i0JhilbW91HH2EDBS GMGAYEyQefSwk6TF4CfJfvt0PDGMqCNd3uV7xCj2cdzJfyDNt4TVzYTw5HFoDYeRaWD1 EYWvIQDf2OMwpK8YCMAtr0LUDz2+QzKGyrIGQIXLvu57m0laZ5kxpitM1M0seSyQXpIS u5RhF+Y21s4hjKGCMx9rbocuY4oWh+qKRAy0MmwvhWkt1saEA1ubJ8aYYYa5ZrGlzdRP mOZyEOLQVjbmXZ9cUyuW2HzQceoy8p4lZ2FGeZbRI+1OO48eNYzGd55Zjo4DQzixauDt bkqQ== 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 xd10-20020a170907078a00b007c10ac7fe46si3133505ejb.19.2022.12.06.18.08.00; Tue, 06 Dec 2022 18:08:23 -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 S229719AbiLGCDh (ORCPT <rfc822;b08248@gmail.com> + 99 others); Tue, 6 Dec 2022 21:03:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229605AbiLGCDf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 6 Dec 2022 21:03:35 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FD0B31EDC; Tue, 6 Dec 2022 18:03:34 -0800 (PST) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4NRgYd031tz501Qj; Wed, 7 Dec 2022 10:03:33 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl2.zte.com.cn with SMTP id 2B723I0T034447; Wed, 7 Dec 2022 10:03:18 +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 10:03:19 +0800 (CST) Date: Wed, 7 Dec 2022 10:03:19 +0800 (CST) X-Zmail-TransId: 2af9638ff4670360af95 X-Mailer: Zmail v1.0 Message-ID: <202212071003192805636@zte.com.cn> Mime-Version: 1.0 From: <ye.xingchen@zte.com.cn> To: <andriy.shevchenko@linux.intel.com>, <jic23@kernel.org> Cc: <lars@metafoo.de>, <u.kleine-koenig@pengutronix.de>, <petrm@nvidia.com>, <olteanv@gmail.com>, <ddrokosov@sberdevices.ru>, <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: =?utf-8?q?=5BPATCH=5D_iio=3A_bma180=3A_Convert_to_use_sysfs=5Femit?= =?utf-8?q?=5Fat=28=29_API?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 2B723I0T034447 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 638FF475.000 by FangMail milter! X-FangMail-Envelope: 1670378613/4NRgYd031tz501Qj/638FF475.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/<ye.xingchen@zte.com.cn> X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 638FF475.000/4NRgYd031tz501Qj 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?1751519228724717798?= X-GMAIL-MSGID: =?utf-8?q?1751519228724717798?= |
Series |
iio: bma180: Convert to use sysfs_emit_at() API
|
|
Commit Message
ye.xingchen@zte.com.cn
Dec. 7, 2022, 2:03 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/accel/bma180.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Comments
On Wed, Dec 07, 2022 at 10:03:19AM +0800, 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> I think it would be better, if you provide one cover letter as 0/3 patch and three nested real patches to each iio/accel driver which you want to rework: adxl372, bma180, mma8452. Or fix all iio drivers (no only accel) and send all of these changes as nested patches for one cover letter. Please refer to https://www.kernel.org/doc/html/latest/process/submitting-patches.html and use the following commands to generate such patches hierarchy: $ git format-patch --cover-letter -o patches ... $ git send-email \ --annotate \ --to="john.doe@kernel.org" \ --cc="linux-iio@vger.kernel.org" \ --cc="linux-kernel@vger.kernel.org" \ --smtp-debug 1 \ patches/* > --- > drivers/iio/accel/bma180.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c > index eb697eeb4301..9e3e5dfdded7 100644 > --- a/drivers/iio/accel/bma180.c > +++ b/drivers/iio/accel/bma180.c > @@ -488,8 +488,7 @@ static ssize_t bma180_show_avail(char *buf, const int *vals, unsigned int n, > for (i = 0; i < n; i++) { > if (!vals[i]) > continue; > - len += scnprintf(buf + len, PAGE_SIZE - len, > - micros ? "0.%06d " : "%d ", vals[i]); > + len += sysfs_emit_at(buf, len, micros ? "0.%06d " : "%d ", vals[i]); > } > buf[len - 1] = '\n'; > > -- > 2.25.1
On Wed, 7 Dec 2022 12:56:14 +0300 Dmitry Rokosov <ddrokosov@sberdevices.ru> wrote: > On Wed, Dec 07, 2022 at 10:03:19AM +0800, 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> > > I think it would be better, if you provide one cover letter as 0/3 patch > and three nested real patches to each iio/accel driver which you want to > rework: adxl372, bma180, mma8452. Or fix all iio drivers (no only accel) > and send all of these changes as nested patches for one cover letter. > > Please refer to https://www.kernel.org/doc/html/latest/process/submitting-patches.html > > and use the following commands to generate such patches hierarchy: > > $ git format-patch --cover-letter -o patches ... > $ git send-email \ > --annotate \ > --to="john.doe@kernel.org" \ > --cc="linux-iio@vger.kernel.org" \ > --cc="linux-kernel@vger.kernel.org" \ > --smtp-debug 1 \ > patches/* Second this comment - also mark it at least v3 as some of these patches will be on their 3rd version. One major advantage of such a series is that a reply to the cover letter can be used to indicate that someone is giving a tag for all the patches underneath it. Right now they'd have to reply to every single email. So please send a v3 with all the similar IIO patches under a single cover letter. Make sure to gather tags from earlier versions. Thanks, Jonathan > > > --- > > drivers/iio/accel/bma180.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c > > index eb697eeb4301..9e3e5dfdded7 100644 > > --- a/drivers/iio/accel/bma180.c > > +++ b/drivers/iio/accel/bma180.c > > @@ -488,8 +488,7 @@ static ssize_t bma180_show_avail(char *buf, const int *vals, unsigned int n, > > for (i = 0; i < n; i++) { > > if (!vals[i]) > > continue; > > - len += scnprintf(buf + len, PAGE_SIZE - len, > > - micros ? "0.%06d " : "%d ", vals[i]); > > + len += sysfs_emit_at(buf, len, micros ? "0.%06d " : "%d ", vals[i]); > > } > > buf[len - 1] = '\n'; > > > > -- > > 2.25.1 >
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index eb697eeb4301..9e3e5dfdded7 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c @@ -488,8 +488,7 @@ static ssize_t bma180_show_avail(char *buf, const int *vals, unsigned int n, for (i = 0; i < n; i++) { if (!vals[i]) continue; - len += scnprintf(buf + len, PAGE_SIZE - len, - micros ? "0.%06d " : "%d ", vals[i]); + len += sysfs_emit_at(buf, len, micros ? "0.%06d " : "%d ", vals[i]); } buf[len - 1] = '\n';