Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3344362rwb; Wed, 30 Nov 2022 19:48:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf5PiIPoNVKhhy1Gqlgr8t/jRAkOQVxUD3Jw56p4gl7L/8ZfYMW82Bf/gIECSzH1uzkSAkdw X-Received: by 2002:a17:906:348d:b0:7bc:4375:1d93 with SMTP id g13-20020a170906348d00b007bc43751d93mr26980284ejb.665.1669866484331; Wed, 30 Nov 2022 19:48:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669866484; cv=none; d=google.com; s=arc-20160816; b=RJ0E5dGl3RXMo/ElTTf8Mr5of0XoHnVOdaLXjSBB7zqD+sojAmVbMg9seuPDZGYT1O rEBrfgHc9DWFuqdXv2Q8zRlBb3xKcPt1SXw/NHiL2ZziXwFhYN3ekR1RROthYUjINIBo 3oj+lNeTXy3+eR0tTApqu/V+GiOtz4ToznscPm8ImF+n9GZj8G03bnb0PdRqxevbLpQQ gDdeb+raBi1mvDs3Ap925/NhUj/FuTWK0ZIrWgXU0hCemQG0WtSZLSCYRm/1wV1YJUuG 8yKlklpoFMg8Zsh0NOQDQQdm4kshPMLhMtyIJn2+9KgGfJtdgi/YmKRZEAlBdjeABH6i OSmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=NqdKoYMb79UgQLMYg9CEYARTcXMGaxovk8x8jdqx9Sc=; b=zlET15hBL2HJnSFzouFKPS72BFJP+wc67nKuA5yJXNFWDtD+Wujs6BtQFCszxBd618 iP6DH5S2kmuzRAaiLXFaYV6+FYJ1KZtpkvp6doE4le7EZBHMg8vfH7wqiaAuCw5mK/Re dLxcmi0DXdLokrvrbAcjxb4s1TMFCAfMRC3FUJI58pvHPjQmPulhIEz97S6Zh1zW9zHv aHVJdSwq+ihLkENPuOKWugLRRni/4hbMEAXYdG0kdw2FVCOyV2oX2DbrtS9qPVI35dPR ifI0MTuxNyZaoIP5GN0sOwM+COENyoG/Rie4ooHWju9z/o5LKMOx/rYvjcnCs/Ge9Kz2 AhmQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ft31-20020a170907801f00b007bfdadb58e7si1851254ejc.546.2022.11.30.19.47.45; Wed, 30 Nov 2022 19:48:04 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229757AbiLADak (ORCPT + 82 others); Wed, 30 Nov 2022 22:30:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbiLADaj (ORCPT ); Wed, 30 Nov 2022 22:30:39 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CC0F5BD69; Wed, 30 Nov 2022 19:30:38 -0800 (PST) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (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 4NN1mr3BP4z4xyCG; Thu, 1 Dec 2022 11:30:36 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl2.zte.com.cn with SMTP id 2B13UUSP049820; Thu, 1 Dec 2022 11:30:30 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Thu, 1 Dec 2022 11:30:31 +0800 (CST) Date: Thu, 1 Dec 2022 11:30:31 +0800 (CST) X-Zmail-TransId: 2af963881fd7ffffffffa9070c69 X-Mailer: Zmail v1.0 Message-ID: <202212011130317080061@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , Subject: =?UTF-8?B?W1BBVENIXSBod21vbjogdXNlIHN5c2ZzX2VtaXQoKSB0byBpbnN0ZWFkIG9mIHNjbnByaW50Zigp?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 2B13UUSP049820 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 63881FDC.001 by FangMail milter! X-FangMail-Envelope: 1669865436/4NN1mr3BP4z4xyCG/63881FDC.001/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63881FDC.001/4NN1mr3BP4z4xyCG X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY 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 From: ye xingchen Replace the open-code with sysfs_emit() to simplify the code. Signed-off-by: ye xingchen --- drivers/hwmon/ds1621.c | 2 +- drivers/hwmon/lm73.c | 6 +++--- drivers/hwmon/sht3x.c | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index 0886abf6ebab..e803d6393b9e 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c @@ -269,7 +269,7 @@ static ssize_t update_interval_show(struct device *dev, struct device_attribute *da, char *buf) { struct ds1621_data *data = dev_get_drvdata(dev); - return scnprintf(buf, PAGE_SIZE, "%hu\n", data->update_interval); + return sysfs_emit(buf, "%hu\n", data->update_interval); } static ssize_t update_interval_store(struct device *dev, diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c index 1346b3b3f463..b6433ae2d75c 100644 --- a/drivers/hwmon/lm73.c +++ b/drivers/hwmon/lm73.c @@ -92,7 +92,7 @@ static ssize_t temp_show(struct device *dev, struct device_attribute *da, /* use integer division instead of equivalent right shift to guarantee arithmetic shift and preserve the sign */ temp = (((s16) err) * 250) / 32; - return scnprintf(buf, PAGE_SIZE, "%d\n", temp); + return sysfs_emit(buf, "%d\n", temp); } static ssize_t convrate_store(struct device *dev, struct device_attribute *da, @@ -137,7 +137,7 @@ static ssize_t convrate_show(struct device *dev, struct device_attribute *da, int res; res = (data->ctrl & LM73_CTRL_RES_MASK) >> LM73_CTRL_RES_SHIFT; - return scnprintf(buf, PAGE_SIZE, "%hu\n", lm73_convrates[res]); + return sysfs_emit(buf, "%hu\n", lm73_convrates[res]); } static ssize_t maxmin_alarm_show(struct device *dev, @@ -154,7 +154,7 @@ static ssize_t maxmin_alarm_show(struct device *dev, data->ctrl = ctrl; mutex_unlock(&data->lock); - return scnprintf(buf, PAGE_SIZE, "%d\n", (ctrl >> attr->index) & 1); + return sysfs_emit(buf, "%d\n", (ctrl >> attr->index) & 1); abort: mutex_unlock(&data->lock); diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c index 3f279aa1cee5..8305e44d9ab2 100644 --- a/drivers/hwmon/sht3x.c +++ b/drivers/hwmon/sht3x.c @@ -320,7 +320,7 @@ static ssize_t temp1_limit_show(struct device *dev, u8 index = to_sensor_dev_attr(attr)->index; int temperature_limit = data->temperature_limits[index]; - return scnprintf(buf, PAGE_SIZE, "%d\n", temperature_limit); + return sysfs_emit(buf, "%d\n", temperature_limit); } static ssize_t humidity1_limit_show(struct device *dev, @@ -331,7 +331,7 @@ static ssize_t humidity1_limit_show(struct device *dev, u8 index = to_sensor_dev_attr(attr)->index; u32 humidity_limit = data->humidity_limits[index]; - return scnprintf(buf, PAGE_SIZE, "%u\n", humidity_limit); + return sysfs_emit(buf, "%u\n", humidity_limit); } /* @@ -483,7 +483,7 @@ static ssize_t temp1_alarm_show(struct device *dev, if (ret) return ret; - return scnprintf(buf, PAGE_SIZE, "%d\n", !!(buffer[0] & 0x04)); + return sysfs_emit(buf, "%d\n", !!(buffer[0] & 0x04)); } static ssize_t humidity1_alarm_show(struct device *dev, @@ -498,7 +498,7 @@ static ssize_t humidity1_alarm_show(struct device *dev, if (ret) return ret; - return scnprintf(buf, PAGE_SIZE, "%d\n", !!(buffer[0] & 0x08)); + return sysfs_emit(buf, "%d\n", !!(buffer[0] & 0x08)); } static ssize_t heater_enable_show(struct device *dev, @@ -513,7 +513,7 @@ static ssize_t heater_enable_show(struct device *dev, if (ret) return ret; - return scnprintf(buf, PAGE_SIZE, "%d\n", !!(buffer[0] & 0x20)); + return sysfs_emit(buf, "%d\n", !!(buffer[0] & 0x20)); } static ssize_t heater_enable_store(struct device *dev, @@ -550,7 +550,7 @@ static ssize_t update_interval_show(struct device *dev, { struct sht3x_data *data = dev_get_drvdata(dev); - return scnprintf(buf, PAGE_SIZE, "%u\n", + return sysfs_emit(buf, "%u\n", mode_to_update_interval[data->mode]); } -- 2.25.1