Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp128661pxb; Tue, 2 Feb 2021 00:44:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/YHuGRGAee10lHc8+h+l0X9wufoxsa7uCXUivzeh5OS/QhyRPU+puKU01SO7N7Y0lZafc X-Received: by 2002:a17:906:3649:: with SMTP id r9mr9868238ejb.202.1612255492187; Tue, 02 Feb 2021 00:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612255492; cv=none; d=google.com; s=arc-20160816; b=amFy65ecxzLP89k8MqTO9mEV0QG5ZkO3O03L0g4kB0HnwdebsnaZ57/Q0RnCTAXpE9 67Krbg01xHuDQtP6IZv6O2k0QmyIDo6WLNiI+PbFKI2OehjJCoFnr+MCAovb0RE35NDX Kgd2vMhVr+EUKlVsKawigfK1xVs5bCcMGfRLE/ExnfGavnXbr8lvqOT2ntCwMb7B9QHl QtdjleOMubcpWH0d0PUFXqRHvB0q9g2dpoDPEcKWdp5z6Hjg081bx8H57ePji3ZQkNgh lZ2/+GAsIOTl255WSC0NdGx8SboXglost7prM7mVwHQQu0Jh8vPglUBtnjGB8MJYoQEy qlhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=u7UZjso2Si4tixYQldbfK5Voeeih4yAhGTJLJC1UxR8=; b=dS6XuUxQMJQtUiLwLaoJe6HiHyAtCffvODKTWqyjnHjNt48yfGrBptEZA2wFM+V7PJ cdobq9qQKkvq5sQrFv7Asszej5VUQjYZO/lB12Rf0QRFULTm5xwn9iNZSwv+PDFh33VJ Y0BInBdhXSITK2B90bldGO340eCzhOHcsPRNH4KfnPRtHAe1ONDikMUthynebVyDNjwU 3yzjuwzYbJ+OXrFX2RGDHmVnBii7SW1dPE4PDbaxvUu/PUWGUApv+VXeeVrX5/VK5lhc b9VFgtNiDjNqZY1j5aOd3T0E4ZlCIlSZsHrL1Bu2vHtipcxTlJfvETL2vK24chxuO8vL TGuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j20si11760818ejy.38.2021.02.02.00.44.25; Tue, 02 Feb 2021 00:44:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232716AbhBBIkf (ORCPT + 99 others); Tue, 2 Feb 2021 03:40:35 -0500 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:52645 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232701AbhBBIk1 (ORCPT ); Tue, 2 Feb 2021 03:40:27 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04420;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0UNfe22u_1612255158; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0UNfe22u_1612255158) by smtp.aliyun-inc.com(127.0.0.1); Tue, 02 Feb 2021 16:39:24 +0800 From: Jiapeng Chong To: linux@roeck-us.net Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong Subject: [PATCH] hwmon: (pmbus) convert sysfs sprintf/snprintf family to sysfs_emit Date: Tue, 2 Feb 2021 16:39:17 +0800 Message-Id: <1612255157-40897-1-git-send-email-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix the following coccicheck warning: ./drivers/hwmon/pmbus/inspur-ipsps.c:73:8-16: WARNING: use scnprintf or sprintf. ./drivers/hwmon/pmbus/inspur-ipsps.c:114:9-17: WARNING: use scnprintf or sprintf. ./drivers/hwmon/pmbus/inspur-ipsps.c:94:8-16: WARNING: use scnprintf or sprintf. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- drivers/hwmon/pmbus/inspur-ipsps.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/hwmon/pmbus/inspur-ipsps.c b/drivers/hwmon/pmbus/inspur-ipsps.c index 88c5865..c1f8526 100644 --- a/drivers/hwmon/pmbus/inspur-ipsps.c +++ b/drivers/hwmon/pmbus/inspur-ipsps.c @@ -70,7 +70,7 @@ static ssize_t ipsps_string_show(struct device *dev, p = memscan(data, '#', rc); *p = '\0'; - return snprintf(buf, PAGE_SIZE, "%s\n", data); + return sysfs_emit(buf, "%s\n", data); } static ssize_t ipsps_fw_version_show(struct device *dev, @@ -91,9 +91,9 @@ static ssize_t ipsps_fw_version_show(struct device *dev, if (rc != 6) return -EPROTO; - return snprintf(buf, PAGE_SIZE, "%u.%02u%u-%u.%02u\n", - data[1], data[2]/* < 100 */, data[3]/*< 10*/, - data[4], data[5]/* < 100 */); + return sysfs_emit(buf, "%u.%02u%u-%u.%02u\n", + data[1], data[2]/* < 100 */, data[3]/*< 10*/, + data[4], data[5]/* < 100 */); } static ssize_t ipsps_mode_show(struct device *dev, @@ -111,19 +111,19 @@ static ssize_t ipsps_mode_show(struct device *dev, switch (rc) { case MODE_ACTIVE: - return snprintf(buf, PAGE_SIZE, "[%s] %s %s\n", - MODE_ACTIVE_STRING, - MODE_STANDBY_STRING, MODE_REDUNDANCY_STRING); + return sysfs_emit(buf, "[%s] %s %s\n", + MODE_ACTIVE_STRING, + MODE_STANDBY_STRING, MODE_REDUNDANCY_STRING); case MODE_STANDBY: - return snprintf(buf, PAGE_SIZE, "%s [%s] %s\n", - MODE_ACTIVE_STRING, - MODE_STANDBY_STRING, MODE_REDUNDANCY_STRING); + return sysfs_emit(buf, "%s [%s] %s\n", + MODE_ACTIVE_STRING, + MODE_STANDBY_STRING, MODE_REDUNDANCY_STRING); case MODE_REDUNDANCY: - return snprintf(buf, PAGE_SIZE, "%s %s [%s]\n", - MODE_ACTIVE_STRING, - MODE_STANDBY_STRING, MODE_REDUNDANCY_STRING); + return sysfs_emit(buf, "%s %s [%s]\n", + MODE_ACTIVE_STRING, + MODE_STANDBY_STRING, MODE_REDUNDANCY_STRING); default: - return snprintf(buf, PAGE_SIZE, "unspecified\n"); + return sysfs_emit(buf, "unspecified\n"); } } -- 1.8.3.1