From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D9E9C4332F for ; Sun, 11 Dec 2022 11:57:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230098AbiLKL5i (ORCPT ); Sun, 11 Dec 2022 06:57:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230057AbiLKL5d (ORCPT ); Sun, 11 Dec 2022 06:57:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C8D3EE17; Sun, 11 Dec 2022 03:57:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DD1E960DC9; Sun, 11 Dec 2022 11:57:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 216F2C433D2; Sun, 11 Dec 2022 11:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670759852; bh=mWMkULjKxBFFnGTfZ+MLCpvFKUSoafn+wfGvflQmGqM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=V9/2QCl2+/dX9s4wmGfcKzs8hZVsTlpp7vUYeCKOZI5hgDb+oYjjKuGKN/hkk5H+F 2g84VQhf5/cCC55ZmCLul6CKTRlqXXwHpIOQoX0HSYiiPTsUYrIk1uq77cJ/l1XZlb tWHRofg8Zakjq7ygl/zIni6W9Xx7WdgfVKnEwW1Rz/ZSLva0IsKlQR9iZkHP9wAzzs uB4H2EaSZgKC6JaQiWM5b7tFDysVKT0zxN4nskF4OdzDImgsecH1DoBuwClClcn7mW YYUSFtrF06M0l4sgmz5jfhZ3gzjTTf+q+vxPenPtCoF1FGVdqt0HoIIPJKIfLWriN9 SWk4lnV6nQlAg== Date: Sun, 11 Dec 2022 12:10:26 +0000 From: Jonathan Cameron To: Cc: , , , Subject: Re: [PATCH] iio: health: afe440x: Convert to use sysfs_emit_at() API Message-ID: <20221211121026.10920c57@jic23-huawei> In-Reply-To: <202212071537405832465@zte.com.cn> References: <202212071537405832465@zte.com.cn> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.35; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 7 Dec 2022 15:37:40 +0800 (CST) wrote: > From: ye xingchen > > 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 > --- > 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'; \ > \