Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1534637rwb; Thu, 1 Dec 2022 19:46:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf7oJGHlJESftZrd8V4Q4NLU9pnu+GB5Kv+16BIrRHuxbfQZoF2K9wVZpcihWnnRAcuvb57O X-Received: by 2002:a17:906:27d8:b0:7bd:6264:a022 with SMTP id k24-20020a17090627d800b007bd6264a022mr26121486ejc.693.1669952816933; Thu, 01 Dec 2022 19:46:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669952816; cv=none; d=google.com; s=arc-20160816; b=W0xb9f+5SUVJRkLrtQNINnOOwuCYi64KgrNu/l7JTGfUtf8KIJC8mk78WhrUi/Gprk /ekjBlq8XWf5DwtNg4BrSynivtLDLPg0prxZ3+sdnmDU8yIKZaRbkxeLWTAXJPg+rKUD hZZr4s44X1v/P5MOi1kxXmf0eudNAX0vBPQmOHyKUxON7kSp8L2liGPMi8z6BbLucmFQ 6T1mfV618kJ2S9sT3ABeWTwIJ1x3Ua9MDA8q4XWIakfFK6y3zgexpm7CoN/hPLt5C2zH tIQ1+Mp43RogUALA68Ypiqs6qOmnIljMwSyWLKHWhiWWwMhpvGL8xuFdhuCZSKU994Lt /TnA== 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=5b6lTDOpxh+ZVjBH2jX5rmfphNCmmMZ6N8608C3dJdo=; b=dN3J6sI/Ym0IoKVvEyH/RhNWyTUj+opqokLd1JBVQtnptJXFbIi925Y9/8sfeshLNd rNzLx8+lSqfwATDtYBlu9/p3tfGDoF/TKMU3uRM3XsNH8clfw8rndAd34W9sGi2ZFLb+ 3aYsJ2gOLRilLYEJAopQ36w9mBqqCr0asAjIJfCKCEItYUo6yTMktDPTo+RVoRdjNT78 JaYJ2TfKYysgLZHIgx14y74D+dbQt9kIY4j06xqC2aO0PcaU+1Xe+vedquET6GGiEmBQ /ArK2wREpoq6m9wVGi62Kw9G64pvxc6uUk5M2WnN9gGiva55CbFSvhQfLO/BjSKgB6a2 vQ4g== 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 hv11-20020a17090760cb00b0077547abf08fsi5684632ejc.169.2022.12.01.19.46.37; Thu, 01 Dec 2022 19:46:56 -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 S232267AbiLBDgl (ORCPT + 81 others); Thu, 1 Dec 2022 22:36:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232249AbiLBDgW (ORCPT ); Thu, 1 Dec 2022 22:36:22 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 841C6DFB6E; Thu, 1 Dec 2022 19:33:45 -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 mxct.zte.com.cn (FangMail) with ESMTPS id 4NNdnz5vVGz501Qq; Fri, 2 Dec 2022 11:33:43 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl1.zte.com.cn with SMTP id 2B23XcpA051832; Fri, 2 Dec 2022 11:33:38 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Fri, 2 Dec 2022 11:33:39 +0800 (CST) Date: Fri, 2 Dec 2022 11:33:39 +0800 (CST) X-Zmail-TransId: 2af9638972134f291fb0 X-Mailer: Zmail v1.0 Message-ID: <202212021133398847947@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , Subject: =?UTF-8?B?W1BBVENIIHYyXSBJbnB1dDogdXNlIHN5c2ZzX2VtaXQoKSB0byBpbnN0ZWFkIG9mIHNjbnByaW50Zigp?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2B23XcpA051832 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 63897217.002 by FangMail milter! X-FangMail-Envelope: 1669952023/4NNdnz5vVGz501Qq/63897217.002/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63897217.002/4NNdnz5vVGz501Qq 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 --- v1 -> v2 Fix the code style. drivers/input/input.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index ca2e3dd7188b..c061bbe96086 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -1362,8 +1362,8 @@ static ssize_t input_dev_show_##name(struct device *dev, \ { \ struct input_dev *input_dev = to_input_dev(dev); \ \ - return scnprintf(buf, PAGE_SIZE, "%s\n", \ - input_dev->name ? input_dev->name : ""); \ + return sysfs_emit(buf, "%s\n", \ + input_dev->name ? input_dev->name : ""); \ } \ static DEVICE_ATTR(name, S_IRUGO, input_dev_show_##name, NULL) @@ -1455,7 +1455,7 @@ static ssize_t inhibited_show(struct device *dev, { struct input_dev *input_dev = to_input_dev(dev); - return scnprintf(buf, PAGE_SIZE, "%d\n", input_dev->inhibited); + return sysfs_emit(buf, "%d\n", input_dev->inhibited); } static ssize_t inhibited_store(struct device *dev, @@ -1502,7 +1502,7 @@ static ssize_t input_dev_show_id_##name(struct device *dev, \ char *buf) \ { \ struct input_dev *input_dev = to_input_dev(dev); \ - return scnprintf(buf, PAGE_SIZE, "%04x\n", input_dev->id.name); \ + return sysfs_emit(buf, "%04x\n", input_dev->id.name); \ } \ static DEVICE_ATTR(name, S_IRUGO, input_dev_show_id_##name, NULL) -- 2.25.1