From patchwork Wed Oct 13 03:26:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?546L5pOO?= X-Patchwork-Id: 12554383 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A8D5C433EF for ; Wed, 13 Oct 2021 03:27:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F09960551 for ; Wed, 13 Oct 2021 03:27:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229526AbhJMD3M (ORCPT ); Tue, 12 Oct 2021 23:29:12 -0400 Received: from mail-eopbgr1300111.outbound.protection.outlook.com ([40.107.130.111]:36864 "EHLO APC01-HK2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237477AbhJMD3L (ORCPT ); Tue, 12 Oct 2021 23:29:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dUOnmfW5lp+mUZg4NQ3p0Q0I2M54Mte9lTPCw1j8XzBhrMBAHYPjHecLu3F2jfI/ANiR6xClHN0W2rc6io8mO2jNuMPla9fzUYQBMJXegJYKtN4CLweCshYejbSHI099A3h2GfRgy4B5+8Q3rkuiXA7lFJaWVBuZEwsL+pHhbLdviPNCVNlVpEFCytvXO2fMqum3rmMzFINlqOGTq7nM7ozIbojehwkWyRnG3Z8mQ2SxpKpvOCyhhMEzsvmJ3/bKWqzLiUXec+qygBbX8C5vyd483brV41gYBzxBRSKClKP8hGlGHIDBYJ6YoHhcMJnKq/63QpKVL7A44Jjkx9EEcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GenKSiIsPYbxQtkO6HJUWv8A4R7OdeoZUusW9bW8gQE=; b=jKH05/52+dIkqCqCAvGaY/d19M+HNGpPniqmM8lvQmvBuf40iqjwyQE2aRKsRlajWM/FY7OQlkZLetTXSIrqbLsAJbUl79DClKQE3PVw+RgwLuO85benMFxNY/2QDuIVETMg+EITTG85ngif58BWkDU9+ljBLLNwW7CRxNpucPVR3JGcrp/1JtSPMWiYOs7wo9GEOIwFGaiVYFBN+2/UAf6asQubQPJc4klQXRuCUyFen20puEa4Vp09dUjFBoWq9Kp/ArPmhetK5nxV+d0bgC/nJi6lFBPgGcMB7s5nSItjCgNkWZH3L1Vs2urKKwWxJs5XJMaoRv+egXb2TPSqOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo0.onmicrosoft.com; s=selector2-vivo0-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GenKSiIsPYbxQtkO6HJUWv8A4R7OdeoZUusW9bW8gQE=; b=VdjgPjgQwMqZArCD3XR5MC73bg42rxRmoE4AS446j/LSxS9ltyP33oWsvzqPy6jGi1SaEdeOe1cbEQrSsPY76BBBCnAN4KJoEYAFRHxxZU6At4K4TCKJ6lWPtbQz74dso3VVxOtTYcxeqL0/Ka0vd5vEpjvXCM4huCOsv05Uquk= Authentication-Results: foss.st.com; dkim=none (message not signed) header.d=none;foss.st.com; dmarc=none action=none header.from=vivo.com; Received: from SL2PR06MB3082.apcprd06.prod.outlook.com (2603:1096:100:37::17) by SL2PR06MB3243.apcprd06.prod.outlook.com (2603:1096:100:35::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18; Wed, 13 Oct 2021 03:27:07 +0000 Received: from SL2PR06MB3082.apcprd06.prod.outlook.com ([fe80::4c9b:b71f:fb67:6414]) by SL2PR06MB3082.apcprd06.prod.outlook.com ([fe80::4c9b:b71f:fb67:6414%6]) with mapi id 15.20.4587.024; Wed, 13 Oct 2021 03:27:07 +0000 From: Qing Wang To: Fabrice Gasnier , William Breathitt Gray , Maxime Coquelin , Alexandre Torgue , linux-iio@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Qing Wang Subject: [PATCH] counter: replace snprintf in show functions with sysfs_emit Date: Tue, 12 Oct 2021 20:26:59 -0700 Message-Id: <1634095619-4174-1-git-send-email-wangqing@vivo.com> X-Mailer: git-send-email 2.7.4 X-ClientProxiedBy: HKAPR03CA0032.apcprd03.prod.outlook.com (2603:1096:203:c9::19) To SL2PR06MB3082.apcprd06.prod.outlook.com (2603:1096:100:37::17) MIME-Version: 1.0 Received: from ubuntu.localdomain (103.220.76.181) by HKAPR03CA0032.apcprd03.prod.outlook.com (2603:1096:203:c9::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4608.4 via Frontend Transport; Wed, 13 Oct 2021 03:27:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 72721946-a903-4ae6-6942-08d98df95592 X-MS-TrafficTypeDiagnostic: SL2PR06MB3243: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1443; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OLuurFMi7K2z3qM61jL3QF2mLpoyjNTATrirETwX/2pXAuvRIXwPFP+Q2/asvDXdsARiMlkEYVj88LMDuJK2IAsPXXUsmsLcj/9oj5IOxgsDVcan8p6Kia8Rrjs4QzX7+a3rajj4B89o+A3KtsE8Of+nrM5EranO4P8i2Z1mWjNy7Tup2JsnxM5wzkhoSqeuBMzrrDOpkhZg6gnJmtgfMwq6bI74K+hADn/FQSJrK/2dIl1d16uGFvAicrfqes/JeLTRDBDtpZMfs95/ZK5qq6SGvjOvOYPRhc7VWuDLTU4Hv3PNPt7NkB3tzu8dhNceTt6goMpXWIWX/6xKBLTRfcz7WQH1PhFjUTX5PFGS6rOIUhC9lKhlGvdjrTcEIzHufVrIRUbiIhw2mC6R03LJu7WFnxXJCGNn1gG7vJ+Wg1g8tLbRsVDBH9e5C2PEI9FeiCft9Swb7T8rLlgUbaQfVdt7LuPJoP/uAGzKcgWA4T4RWhOSAx5ZC+up3V1OJFBgUFyACblih+1Z+XVLx81f4AuE1q9l0eS63s6X7qviWzFRKSXJmcOM4e0oG325WvftBd//W9LqXLtXycgza01pJIzk3bhHQ1zNMK30UUsAhNrdIpNUiilfs2rcY0dx4M/IEHbXxHPZWiXGHbxE30Ffwm6EhcXyBUqp6XapsTPLow61N1eeuIsroUAqxj7yDNEUQHlY5fetS//Q+yi54GPoiw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SL2PR06MB3082.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(508600001)(2906002)(26005)(6512007)(4326008)(66946007)(8676002)(36756003)(66476007)(83380400001)(38100700002)(6666004)(66556008)(38350700002)(107886003)(316002)(52116002)(186003)(8936002)(6486002)(5660300002)(6506007)(110136005)(956004)(2616005)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kFH0Wp4cSJcSDaT519U5cKm607ItOJzBSlMK2W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vEZlfEOv9bigjHUAQQ2yhg6cDHS5Du9f8fbZovk8PGqL3ijRHecHevBlPd+huHU/NDuo5gAa2ZcJU2nazrU1XgGaK+NmEDVW7rgxj1RueA3ivkwGyrR5VGdsbpmf/IRREJDcsD97uvL/e+UTMmq6S4u1/r49th0IbXrCzHWQPXxoYFrRCmMvsvCKzI0zQ09WlvDIfZl8K3KR2HJ4DAaemjOuzNuHPvkUoMLPonvBI X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72721946-a903-4ae6-6942-08d98df95592 X-MS-Exchange-CrossTenant-AuthSource: SL2PR06MB3082.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2021 03:27:07.3236 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mLhohVsJOuEUQilbrIRgbSe3HhqHD6Lfc/2H061VC1rQcKGmTzQo2VRLu2kDONcCieNzf/l8RtKZXlAc2Bl6mQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SL2PR06MB3243 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org coccicheck complains about the use of snprintf() in sysfs show functions. Fix the following coccicheck warning: drivers/counter/stm32-lptimer-cnt.c:265:8-16: WARNING: use scnprintf or sprintf. drivers/counter/stm32-lptimer-cnt.c:176:8-16: WARNING: use scnprintf or sprintf. Use sysfs_emit instead of scnprintf or sprintf makes more sense. Signed-off-by: Qing Wang --- drivers/counter/stm32-lptimer-cnt.c | 2 +- drivers/counter/stm32-timer-cnt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lptimer-cnt.c index c19d998..6f1113a 100644 --- a/drivers/counter/stm32-lptimer-cnt.c +++ b/drivers/counter/stm32-lptimer-cnt.c @@ -262,7 +262,7 @@ static ssize_t stm32_lptim_cnt_ceiling_read(struct counter_device *counter, { struct stm32_lptim_cnt *const priv = counter->priv; - return snprintf(buf, PAGE_SIZE, "%u\n", priv->ceiling); + return sysfs_emit(buf, "%u\n", priv->ceiling); } static ssize_t stm32_lptim_cnt_ceiling_write(struct counter_device *counter, diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c index 603b30a..e772586 100644 --- a/drivers/counter/stm32-timer-cnt.c +++ b/drivers/counter/stm32-timer-cnt.c @@ -173,7 +173,7 @@ static ssize_t stm32_count_ceiling_read(struct counter_device *counter, regmap_read(priv->regmap, TIM_ARR, &arr); - return snprintf(buf, PAGE_SIZE, "%u\n", arr); + return sysfs_emit(buf, "%u\n", arr); } static ssize_t stm32_count_ceiling_write(struct counter_device *counter,