From patchwork Wed Dec 7 07:55:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ye.xingchen@zte.com.cn X-Patchwork-Id: 13066731 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3422BC352A1 for ; Wed, 7 Dec 2022 07:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:Cc:To:From:Mime-Version: Message-ID:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=TTZ8bTr7l6Q7ZBBsXkgJ6U/wOhLBwsyhNbYl+MEBZj8=; b=Hdw hFqT6PGylhLvxPbZLiVaPP8TVeayOUaazbHDNQ3WwTfAy7REwOXcMtKcAi0ZEAuf7etSiWiVxyJZz iO3DZUO2/igeMUfEzOV+w4yvRCM3DuU1NanyjROByYgaTqQAWdS1YU3Oiioa41ijMTZz1dJY4wQ3w g4n8U3OZyTrX04LOU6+ed5jvWWc6hVJ3PK7yCGuLJKSr15mCLYLyvhv8Pi/B5jLVSTGeWHqIwINry OGHdVnS7ekeL2ORTZYlCXaCLJrUZgog1gn7XzoXXC5ZJJ4M5kV5uQeQE5Rjo/PDMTTniiMlum9onT R7Hy+C7+dxdbDF7nchgoMioysNbUazA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p2pHO-00ERtN-CD; Wed, 07 Dec 2022 07:55:46 +0000 Received: from mxct.zte.com.cn ([183.62.165.209]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p2pHJ-00ERaK-AV for linux-arm-kernel@lists.infradead.org; Wed, 07 Dec 2022 07:55:44 +0000 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 mxct.zte.com.cn (FangMail) with ESMTPS id 4NRqMp0yZcz4y0v1; Wed, 7 Dec 2022 15:55:34 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl1.zte.com.cn with SMTP id 2B77tJJv078722; Wed, 7 Dec 2022 15:55:19 +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:55:22 +0800 (CST) Date: Wed, 7 Dec 2022 15:55:22 +0800 (CST) X-Zmail-TransId: 2af9639046eaffffffffb86a0852 X-Mailer: Zmail v1.0 Message-ID: <202212071555220843038@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , , , Subject: =?utf-8?q?=5BPATCH=5D_iio=3A_trigger=3A_stm32-timer=3A_Convert_to_u?= =?utf-8?q?se_sysfs=5Femit=5Fat=28=29_API?= X-MAIL: mse-fl1.zte.com.cn 2B77tJJv078722 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 639046F6.000 by FangMail milter! X-FangMail-Envelope: 1670399734/4NRqMp0yZcz4y0v1/639046F6.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 639046F6.000/4NRqMp0yZcz4y0v1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221206_235541_572665_80F27C2A X-CRM114-Status: UNSURE ( 9.69 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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/trigger/stm32-timer-trigger.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c index 3643c4afae67..eadfb255f7b7 100644 --- a/drivers/iio/trigger/stm32-timer-trigger.c +++ b/drivers/iio/trigger/stm32-timer-trigger.c @@ -352,8 +352,7 @@ static ssize_t stm32_tt_show_master_mode_avail(struct device *dev, master_mode_max = MASTER_MODE_MAX; for (i = 0; i <= master_mode_max; i++) - len += scnprintf(buf + len, PAGE_SIZE - len, - "%s ", master_mode_table[i]); + len += sysfs_emit_at(buf, len, "%s ", master_mode_table[i]); /* replace trailing space by newline */ buf[len - 1] = '\n';