Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4769906rwb; Sun, 4 Dec 2022 07:55:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf6kbNm2IorzK+Uwcu7n2G3CjfQo8dFlcwgShmPUiGFfWHvyaA+NoTQBjrpaQ7a9Oh/mih9y X-Received: by 2002:a17:90b:784:b0:218:fa11:5f87 with SMTP id l4-20020a17090b078400b00218fa115f87mr53519018pjz.25.1670169329128; Sun, 04 Dec 2022 07:55:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670169329; cv=none; d=google.com; s=arc-20160816; b=QfCsK2/lk39JgO3rxeiu5xWWf3PgzmNL8q1WZGDC88Kh7dFSNyPhpef5kx1HR4EtSm V+ljIi92L+RGnhS53dKy98Vgz0xdM5VN/ibH3BTA2DaUbxk/bPraDgEs8AXHT081808k qNOorJGQhiJcTMEuQBdov+SxXpSLL9DmTUdjpn9q5sX3zoWcxZnXyrVd3iUN6L7zH0f2 Sc3ZCVxc9Htmt8mFlIF3LoE3DIT/BfXF4HOq+uz0fIkiHw8I2n1m90QXZvAdW3YZggaH 5lEhVVE3jLU/3t6g8XoIfsdrcHwWj9U/+je45kiLsXh0kVHv/6YckD363Ljn5LX64Mfs zjsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=tb3vCzVaEY7fYmsOQPG/40QnAODhx4PVU1+5g9gLlo8=; b=nT3sCo6Qp1kVQDT9GvBqkDMgTUdrtwCg4IQf1F8WDJwnDpMz2G8nwcQjN4XdzxJtUm uEy8Gw7XYvl6l5NJYbQwnQNH/wZ4zDYBxxKz73d7yxaNPgf0guAtQa1PUUYJFqRViuzU opK3PE7wfo//8iihnTgFdbEi6yHSsArAtJB1ltNsENlW96mLFWwHsXGCwKLu5A1mzGhW oUBa/GNKZQCDUmyY2zsUbNDo+lcfAiwiaLJ1k8geAFnR7LyEy6dCR8FyeBsZMm8soSz8 HgAbwQedbgjgWyu4PrKwCHDXr+AXjhQ2tLgmJeAPR2xxGwVV2mTLhtcludiEzBBg9m7X OMwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AcdaVFn+; 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 e30-20020a631e1e000000b004786b79642dsi10672170pge.276.2022.12.04.07.55.17; Sun, 04 Dec 2022 07:55:29 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AcdaVFn+; 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 S230110AbiLDPgY (ORCPT + 82 others); Sun, 4 Dec 2022 10:36:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbiLDPgX (ORCPT ); Sun, 4 Dec 2022 10:36:23 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFE1A120AD; Sun, 4 Dec 2022 07:36:22 -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 ams.source.kernel.org (Postfix) with ESMTPS id 97FAFB8069A; Sun, 4 Dec 2022 15:36:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA343C433D6; Sun, 4 Dec 2022 15:36:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670168180; bh=O1qz95Pb9I33OjCFKXFJFaZ1swHQCaILsdIKSNUsTXQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=AcdaVFn+XsCZU68UuyVbj1DApCZlidCw051GrEbvZJkN96yChqqMbapkEWDWHcNnq 3lE0zYNmltqurZCfKQ+LLS5wCk/5jqCxiIa2UdBbkjrqeGmh6hN/BSGKEbboRQCYXV 7UKc9mrT6Klha7FKcr9BR7EjnkRZs3uRsGN6RYgBOd6txTUFJyZxKk85jXH5TAcO2X Cya/98xgxMlwbaONATZu2plgZ4b0ZXUAUqRieVPqlmaYtRgfvxl4yKdzbahb3ulQme P4nZODS2GeM5vI8h+qcm7vojQFPdbl5x1+XW/Q1xiPG7t1Tj/jho5hIgu+2Sth3rTe 57xG8XyCUKAbA== Date: Sun, 4 Dec 2022 15:49:06 +0000 From: Jonathan Cameron To: Cc: , , , , Sudeep Holla , Cristian Marussi Subject: Re: [PATCH] iio: common: scmi_iio: use sysfs_emit() to instead of scnprintf() Message-ID: <20221204154906.163c9c02@jic23-huawei> In-Reply-To: <202212011156314630626@zte.com.cn> References: <202212011156314630626@zte.com.cn> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 1 Dec 2022 11:56:31 +0800 (CST) wrote: > From: ye xingchen > > Replace the open-code with sysfs_emit() to simplify the code. > > Signed-off-by: ye xingchen Applied. Cc'd scmi people as well just in case they are interested. > --- > drivers/iio/common/scmi_sensors/scmi_iio.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/common/scmi_sensors/scmi_iio.c b/drivers/iio/common/scmi_sensors/scmi_iio.c > index d92f7f651f7b..0c2caf3570db 100644 > --- a/drivers/iio/common/scmi_sensors/scmi_iio.c > +++ b/drivers/iio/common/scmi_sensors/scmi_iio.c > @@ -400,12 +400,12 @@ static ssize_t scmi_iio_get_raw_available(struct iio_dev *iio_dev, > rem = do_div(resolution, > int_pow(10, abs(exponent)) > ); > - len = scnprintf(buf, PAGE_SIZE, > + len = sysfs_emit(buf, > "[%lld %llu.%llu %lld]\n", min_range, > resolution, rem, max_range); > } else { > resolution = resolution * int_pow(10, exponent); > - len = scnprintf(buf, PAGE_SIZE, "[%lld %llu %lld]\n", > + len = sysfs_emit(buf, "[%lld %llu %lld]\n", > min_range, resolution, max_range); > } > }