From patchwork Thu Dec 1 07:51:42 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: 28228 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp130757wrr; Wed, 30 Nov 2022 23:57:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf46iuLc3CsSIRnXFSy/ZE6Ec2r8mKuauk7rkkMgNVitY/1LCVFrx/aSbul1DuhS+XZEECQT X-Received: by 2002:a17:90a:fb89:b0:218:ec4a:782e with SMTP id cp9-20020a17090afb8900b00218ec4a782emr40579205pjb.7.1669881473256; Wed, 30 Nov 2022 23:57:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669881473; cv=none; d=google.com; s=arc-20160816; b=uvZOUHwAp7bwow8gbm1goHMTyw1ErXPm046qIP3QrLuE1xWm5St+gKoLeBzfHkCtO3 Y5/cVU6eNwYV16YqmtrAsFbWTJMTu0s0+VEpKXLMjsyqZZrVfVlBNfDfmiHOX0in++dS fMwrstQ4+ALNTKtrkjTKETgquis5rC6fwOEJpPMpHLzKR5r71Yj+Gzu96NF/Q7kpPQGZ CtWC4B3/jNLo7JbUwPh0oYiPgD8Gim5iknSVYKfTwQ8RMe8zeZuFCdVjdBt4X9iDEjhP wIWPmYjuVTviUn3HBtOM5ytrFpRxYSHOo88v36Bl8MehhRQl7ziMckFEmidf6IToEGiB ueWg== 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=XlVNV/LHqL030ITJ53GyXvPTq+wVWw26Jk/MOsTov+I=; b=yxffixhdyOWei9lNn57DlWtvDOwmI5+QnNPfYDYcnHsIozVaaW8WxzHWjoq69aEpRg i9yzuf4A1+p2P+hFv1FjdJwoawySyEanjv4kgVt6FdTcfPc9k/Eaa0vFOzPaEMe9Z2pd xx/6ZDiI/k4Ky9Ua7SHYKHyVVSCUw+H0Uh7+sr14cc1OcLA+YzVyHxL61kuS2ikusSEr zmeDZoqONEwhfyBI3fJdEoZNQqtDPFMqLWqZI8/6SU3u6TIf6QHo9GomHYzlaaUCrXiI nXblz3/TWEKiRYCtDnkQxBBz3LB8dOyRU2/dlRkrRunUJuSSO17f6I810tzCrA8l7+JX SYUA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a056a00181200b0056bcb93e983si4611357pfa.17.2022.11.30.23.57.36; Wed, 30 Nov 2022 23:57:53 -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 S229757AbiLAHwD (ORCPT + 99 others); Thu, 1 Dec 2022 02:52:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbiLAHwB (ORCPT ); Thu, 1 Dec 2022 02:52:01 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CCB946675; Wed, 30 Nov 2022 23:52:00 -0800 (PST) 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 mxhk.zte.com.cn (FangMail) with ESMTPS id 4NN7ZQ6R5hz8RV6M; Thu, 1 Dec 2022 15:51:58 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl1.zte.com.cn with SMTP id 2B17pefB008289; Thu, 1 Dec 2022 15:51:40 +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:51:42 +0800 (CST) Date: Thu, 1 Dec 2022 15:51:42 +0800 (CST) X-Zmail-TransId: 2af963885d0e1b8131f0 X-Mailer: Zmail v1.0 Message-ID: <202212011551429834598@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , Subject: =?utf-8?q?=5BPATCH=5D_Input=3A_rmi4=3A_use_sysfs=5Femit=28=29_to_in?= =?utf-8?q?stead_of_scnprintf=28=29?= X-MAIL: mse-fl1.zte.com.cn 2B17pefB008289 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 63885D1E.001 by FangMail milter! X-FangMail-Envelope: 1669881118/4NN7ZQ6R5hz8RV6M/63885D1E.001/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63885D1E.001/4NN7ZQ6R5hz8RV6M X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750997635857237920?= X-GMAIL-MSGID: =?utf-8?q?1750997635857237920?= From: ye xingchen Replace the open-code with sysfs_emit() to simplify the code. Signed-off-by: ye xingchen --- drivers/input/rmi4/rmi_f01.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c index d7603c50f864..7b56bb70b393 100644 --- a/drivers/input/rmi4/rmi_f01.c +++ b/drivers/input/rmi4/rmi_f01.c @@ -267,7 +267,7 @@ static ssize_t rmi_driver_manufacturer_id_show(struct device *dev, struct rmi_driver_data *data = dev_get_drvdata(dev); struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); - return scnprintf(buf, PAGE_SIZE, "%d\n", + return sysfs_emit(buf, "%d\n", f01->properties.manufacturer_id); } @@ -280,7 +280,7 @@ static ssize_t rmi_driver_dom_show(struct device *dev, struct rmi_driver_data *data = dev_get_drvdata(dev); struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); - return scnprintf(buf, PAGE_SIZE, "%s\n", f01->properties.dom); + return sysfs_emit(buf, "%s\n", f01->properties.dom); } static DEVICE_ATTR(date_of_manufacture, 0444, rmi_driver_dom_show, NULL); @@ -292,7 +292,7 @@ static ssize_t rmi_driver_product_id_show(struct device *dev, struct rmi_driver_data *data = dev_get_drvdata(dev); struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); - return scnprintf(buf, PAGE_SIZE, "%s\n", f01->properties.product_id); + return sysfs_emit(buf, "%s\n", f01->properties.product_id); } static DEVICE_ATTR(product_id, 0444, rmi_driver_product_id_show, NULL); @@ -304,7 +304,7 @@ static ssize_t rmi_driver_firmware_id_show(struct device *dev, struct rmi_driver_data *data = dev_get_drvdata(dev); struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); - return scnprintf(buf, PAGE_SIZE, "%d\n", f01->properties.firmware_id); + return sysfs_emit(buf, "%d\n", f01->properties.firmware_id); } static DEVICE_ATTR(firmware_id, 0444, rmi_driver_firmware_id_show, NULL); @@ -318,7 +318,7 @@ static ssize_t rmi_driver_package_id_show(struct device *dev, u32 package_id = f01->properties.package_id; - return scnprintf(buf, PAGE_SIZE, "%04x.%04x\n", + return sysfs_emit(buf, "%04x.%04x\n", package_id & 0xffff, (package_id >> 16) & 0xffff); }