Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp170976rwb; Thu, 1 Dec 2022 00:12:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Ob0ShgIbbDiiHP++ly/gvMCEo82H2tztGkYZ4DBSpfkVE2Hupr5ntLXsxLvg+X6MzuwmP X-Received: by 2002:a17:906:b809:b0:7be:71f5:3183 with SMTP id dv9-20020a170906b80900b007be71f53183mr19786005ejb.547.1669882331604; Thu, 01 Dec 2022 00:12:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669882331; cv=none; d=google.com; s=arc-20160816; b=bcBojKVT2c7lA6uiqUkBhT5ukkTz6MKXzn0LoNYZn+BjOU8QpGo2GR5D5QKSkb50Ki IpDbFiK8CreTzFwj7QT1Mom2l6J63IoD9GlbUkCScfypYfoZUtXCADqThEJ1fv2sNUan Wq9OndslDheszgztoUNLRt4Xavk/hbDRVtnoiIDTsALxaU9/PJq0rSVTg3kGKp+Mp74Y Cw9n3wSTWum8Vxbr+2KVvz64ulc2nY9OMh/2MMSOi6KEOTNNTOjAKpZM9YXMlLcCBJgj cLWd6Ay9WlRbXybXYQFqEVmsaJA3HnbqSZsHsLCQY7UL60FH2YE1UKZrMBs4V4O5msn9 Twcg== 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=Arw/un49tUYY+/ysyn1Ni3ZUh8Y82VAxVdvFJOiLZcw=; b=jo5pZfGvlWRhB3KMYxZ1PUmkD1GSK0lHDZh/pSUzPiVUuwjYRvo/wPO2sy7ed1R9uN mrURpYOjg04ZhYTx9wNcOtujkymwvwlix3xQRmhXPx94OHmdttE9VQ//UNARIdTpWe4g TwwjHtB55obJeTd67B8SFlULXop+vPMSSNGdFx5dLGqwd3QA4v5JS0Mbj+mOM0Lu7/Ls mZExzdQuRZ0OI4lbbczrCj5CcrrDnLMzCv8ZbCtoisE9SgYy0gc3T4311iK3586AtANa a7wvLOCKZxChicfDwsfwWtvprMFSId9AmLUBT5czmfX9OcTMnskeyLawn+aVqekDJc9g Tgzw== 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 b19-20020a056402351300b0046a31967739si3295525edd.96.2022.12.01.00.11.51; Thu, 01 Dec 2022 00:12:11 -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 S229551AbiLAHtC (ORCPT + 82 others); Thu, 1 Dec 2022 02:49:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbiLAHs7 (ORCPT ); Thu, 1 Dec 2022 02:48:59 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A544043858; Wed, 30 Nov 2022 23:48:48 -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 mxhk.zte.com.cn (FangMail) with ESMTPS id 4NN7Vk6t5yz4xVnZ; Thu, 1 Dec 2022 15:48:46 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl2.zte.com.cn with SMTP id 2B17maTK013822; Thu, 1 Dec 2022 15:48:36 +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 15:48:38 +0800 (CST) Date: Thu, 1 Dec 2022 15:48:38 +0800 (CST) X-Zmail-TransId: 2af963885c56ffffffff81a0d858 X-Mailer: Zmail v1.0 Message-ID: <202212011548387254492@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , Subject: =?UTF-8?B?W1BBVENIXSBJbnB1dDogbWlzYzogdXNlIHN5c2ZzX2VtaXQoKSB0byBpbnN0ZWFkIG9mIHNjbnByaW50Zigp?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 2B17maTK013822 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 63885C5E.000 by FangMail milter! X-FangMail-Envelope: 1669880926/4NN7Vk6t5yz4xVnZ/63885C5E.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63885C5E.000/4NN7Vk6t5yz4xVnZ 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/input/misc/ims-pcu.c | 10 +++++----- drivers/input/misc/iqs269a.c | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c index b2f1292e27ef..6e8cc28debd9 100644 --- a/drivers/input/misc/ims-pcu.c +++ b/drivers/input/misc/ims-pcu.c @@ -1050,7 +1050,7 @@ static ssize_t ims_pcu_attribute_show(struct device *dev, container_of(dattr, struct ims_pcu_attribute, dattr); char *field = (char *)pcu + attr->field_offset; - return scnprintf(buf, PAGE_SIZE, "%.*s\n", attr->field_length, field); + return sysfs_emit(buf, "%.*s\n", attr->field_length, field); } static ssize_t ims_pcu_attribute_store(struct device *dev, @@ -1206,7 +1206,7 @@ ims_pcu_update_firmware_status_show(struct device *dev, struct usb_interface *intf = to_usb_interface(dev); struct ims_pcu *pcu = usb_get_intfdata(intf); - return scnprintf(buf, PAGE_SIZE, "%d\n", pcu->update_firmware_status); + return sysfs_emit(buf, "%d\n", pcu->update_firmware_status); } static DEVICE_ATTR(update_firmware_status, S_IRUGO, @@ -1309,7 +1309,7 @@ static ssize_t ims_pcu_ofn_reg_data_show(struct device *dev, if (error) return error; - return scnprintf(buf, PAGE_SIZE, "%x\n", data); + return sysfs_emit(buf, "%x\n", data); } static ssize_t ims_pcu_ofn_reg_data_store(struct device *dev, @@ -1344,7 +1344,7 @@ static ssize_t ims_pcu_ofn_reg_addr_show(struct device *dev, int error; mutex_lock(&pcu->cmd_mutex); - error = scnprintf(buf, PAGE_SIZE, "%x\n", pcu->ofn_reg_addr); + error = sysfs_emit(buf, "%x\n", pcu->ofn_reg_addr); mutex_unlock(&pcu->cmd_mutex); return error; @@ -1397,7 +1397,7 @@ static ssize_t ims_pcu_ofn_bit_show(struct device *dev, if (error) return error; - return scnprintf(buf, PAGE_SIZE, "%d\n", !!(data & (1 << attr->nr))); + return sysfs_emit(buf, "%d\n", !!(data & (1 << attr->nr))); } static ssize_t ims_pcu_ofn_bit_store(struct device *dev, diff --git a/drivers/input/misc/iqs269a.c b/drivers/input/misc/iqs269a.c index a348247d3d38..e4d5cea51f39 100644 --- a/drivers/input/misc/iqs269a.c +++ b/drivers/input/misc/iqs269a.c @@ -1332,7 +1332,7 @@ static ssize_t counts_show(struct device *dev, if (error) return error; - return scnprintf(buf, PAGE_SIZE, "%u\n", le16_to_cpu(counts)); + return sysfs_emit(buf, "%u\n", le16_to_cpu(counts)); } static ssize_t hall_bin_show(struct device *dev, @@ -1369,7 +1369,7 @@ static ssize_t hall_bin_show(struct device *dev, return -EINVAL; } - return scnprintf(buf, PAGE_SIZE, "%u\n", val); + return sysfs_emit(buf, "%u\n", val); } static ssize_t hall_enable_show(struct device *dev, @@ -1377,7 +1377,7 @@ static ssize_t hall_enable_show(struct device *dev, { struct iqs269_private *iqs269 = dev_get_drvdata(dev); - return scnprintf(buf, PAGE_SIZE, "%u\n", iqs269->hall_enable); + return sysfs_emit(buf, "%u\n", iqs269->hall_enable); } static ssize_t hall_enable_store(struct device *dev, @@ -1407,7 +1407,7 @@ static ssize_t ch_number_show(struct device *dev, { struct iqs269_private *iqs269 = dev_get_drvdata(dev); - return scnprintf(buf, PAGE_SIZE, "%u\n", iqs269->ch_num); + return sysfs_emit(buf, "%u\n", iqs269->ch_num); } static ssize_t ch_number_store(struct device *dev, @@ -1435,7 +1435,7 @@ static ssize_t rx_enable_show(struct device *dev, { struct iqs269_private *iqs269 = dev_get_drvdata(dev); - return scnprintf(buf, PAGE_SIZE, "%u\n", + return sysfs_emit(buf, "%u\n", iqs269->ch_reg[iqs269->ch_num].rx_enable); } @@ -1475,7 +1475,7 @@ static ssize_t ati_mode_show(struct device *dev, if (error) return error; - return scnprintf(buf, PAGE_SIZE, "%u\n", val); + return sysfs_emit(buf, "%u\n", val); } static ssize_t ati_mode_store(struct device *dev, @@ -1508,7 +1508,7 @@ static ssize_t ati_base_show(struct device *dev, if (error) return error; - return scnprintf(buf, PAGE_SIZE, "%u\n", val); + return sysfs_emit(buf, "%u\n", val); } static ssize_t ati_base_store(struct device *dev, @@ -1541,7 +1541,7 @@ static ssize_t ati_target_show(struct device *dev, if (error) return error; - return scnprintf(buf, PAGE_SIZE, "%u\n", val); + return sysfs_emit(buf, "%u\n", val); } static ssize_t ati_target_store(struct device *dev, @@ -1568,7 +1568,7 @@ static ssize_t ati_trigger_show(struct device *dev, { struct iqs269_private *iqs269 = dev_get_drvdata(dev); - return scnprintf(buf, PAGE_SIZE, "%u\n", iqs269->ati_current); + return sysfs_emit(buf, "%u\n", iqs269->ati_current); } static ssize_t ati_trigger_store(struct device *dev, -- 2.25.1