Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp428659rwb; Thu, 1 Dec 2022 04:08:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ef2PxvcJT0IzzRlBRJvfyRX9ctk64Ze3brqaigHUp1zLYpRXyEWLTkzushhVzRnc3PBDP X-Received: by 2002:a62:31c4:0:b0:56e:989d:7410 with SMTP id x187-20020a6231c4000000b0056e989d7410mr47290984pfx.1.1669896533212; Thu, 01 Dec 2022 04:08:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669896533; cv=none; d=google.com; s=arc-20160816; b=FH21IaAW2SW/ZiotwZ7ARq9geNLHA+Bw2RuVTI0peUGJ2o6+a/xJbbh5DJFqeDD4Ye JYfKN46bYuX4w4ZxQqDJPcmZvEkv2sm1fGKBaQZBqiAp+MAqh2Iup84bAqzIxWcFQRen chpwbhbIt9B+2itPuv+aM+2Kd/hqgp87dM7pkpFvfG7YU1a/bodJi51FgR56ID/M8pMF 6AFiCxyj9JXZWwe9Ebjd1rHFTjXgKkgTPQPxGpTkldedj1/Ot7LSE3TL1AY40qYX91ML gq3uW2e+IVK+bV4JLqHyss9t/k4e7wYI0NhArPx4KG6K1h9UWE0djYT99nlaO8tYNVVL lrcA== 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=lHyx4+R+Yay7NzJ/X0sF2345SRlnw1uM42W6bMpKsZs=; b=p+Mo4qqCxm0/8o8l5xQRc7GMAF+oAPTBtzoZXeRRepNxGqMHu/ZPk2xsds/erXruHn DtnXwRA5bPek5qRsSyletX1hKZ97pFcpFWGIDeEO1nauyJvOCC8XNxuiFdHUZQ0h39xy VCbJ+BEbBa9C/4Wx3+uXGPrd7ZqIZ+3/0yNd56wPFO/KCGRmaxftHplVGVLtmwHRDLie 0U+7aYEErit4kM2XQHEOCVJKWwMM6508QwL2Ck5qyOZf6Lyw7DJlDy/htrffAn2TQHOt pyG0JSN6AnD0LCt2gYmA9wh9nsuyHq6GjePMROZ9NO0C50cVw1ZBABZW9TnBCbZ1Uddn /D/w== 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 nk11-20020a17090b194b00b0020a755f2b83si7196740pjb.100.2022.12.01.04.08.38; Thu, 01 Dec 2022 04:08: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 S229984AbiLAL2O (ORCPT + 82 others); Thu, 1 Dec 2022 06:28:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229722AbiLAL2N (ORCPT ); Thu, 1 Dec 2022 06:28:13 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3F2250D70; Thu, 1 Dec 2022 03:28:09 -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 4NNDMr3pKmz4xVnf; Thu, 1 Dec 2022 19:28:08 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl2.zte.com.cn with SMTP id 2B1BRunB071769; Thu, 1 Dec 2022 19:27:56 +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 19:27:59 +0800 (CST) Date: Thu, 1 Dec 2022 19:27:59 +0800 (CST) X-Zmail-TransId: 2af963888fbf0b577f89 X-Mailer: Zmail v1.0 Message-ID: <202212011927592559291@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , Subject: =?UTF-8?B?W1BBVENIXSBtZWRpYTogcHZydXNiMjogdXNlIHN5c2ZzX2VtaXQoKSB0byBpbnN0ZWFkIG9mIHNjbnByaW50Zigp?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 2B1BRunB071769 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 63888FC8.000 by FangMail milter! X-FangMail-Envelope: 1669894088/4NNDMr3pKmz4xVnf/63888FC8.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63888FC8.000/4NNDMr3pKmz4xVnf 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 Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: ye xingchen --- drivers/media/usb/pvrusb2/pvrusb2-sysfs.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c b/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c index 3e42e209be37..81c8b65bd9ef 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c @@ -81,7 +81,7 @@ static ssize_t show_name(struct device *class_dev, pvr2_sysfs_trace("pvr2_sysfs(%p) show_name(cid=%d) is %s", cip->chptr, cip->ctl_id, name); if (!name) return -EINVAL; - return scnprintf(buf, PAGE_SIZE, "%s\n", name); + return sysfs_emit(buf, "%s\n", name); } static ssize_t show_type(struct device *class_dev, @@ -102,7 +102,7 @@ static ssize_t show_type(struct device *class_dev, } pvr2_sysfs_trace("pvr2_sysfs(%p) show_type(cid=%d) is %s", cip->chptr, cip->ctl_id, name); - return scnprintf(buf, PAGE_SIZE, "%s\n", name); + return sysfs_emit(buf, "%s\n", name); } static ssize_t show_min(struct device *class_dev, @@ -115,7 +115,7 @@ static ssize_t show_min(struct device *class_dev, val = pvr2_ctrl_get_min(cip->cptr); pvr2_sysfs_trace("pvr2_sysfs(%p) show_min(cid=%d) is %ld", cip->chptr, cip->ctl_id, val); - return scnprintf(buf, PAGE_SIZE, "%ld\n", val); + return sysfs_emit(buf, "%ld\n", val); } static ssize_t show_max(struct device *class_dev, @@ -128,7 +128,7 @@ static ssize_t show_max(struct device *class_dev, val = pvr2_ctrl_get_max(cip->cptr); pvr2_sysfs_trace("pvr2_sysfs(%p) show_max(cid=%d) is %ld", cip->chptr, cip->ctl_id, val); - return scnprintf(buf, PAGE_SIZE, "%ld\n", val); + return sysfs_emit(buf, "%ld\n", val); } static ssize_t show_def(struct device *class_dev, @@ -551,7 +551,7 @@ static ssize_t v4l_minor_number_show(struct device *class_dev, struct pvr2_sysfs *sfp; sfp = dev_get_drvdata(class_dev); if (!sfp) return -EINVAL; - return scnprintf(buf,PAGE_SIZE,"%d\n", + return sysfs_emit(buf, "%d\n", pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, pvr2_v4l_type_video)); } @@ -563,7 +563,7 @@ static ssize_t bus_info_show(struct device *class_dev, struct pvr2_sysfs *sfp; sfp = dev_get_drvdata(class_dev); if (!sfp) return -EINVAL; - return scnprintf(buf,PAGE_SIZE,"%s\n", + return sysfs_emit(buf, "%s\n", pvr2_hdw_get_bus_info(sfp->channel.hdw)); } @@ -574,7 +574,7 @@ static ssize_t hdw_name_show(struct device *class_dev, struct pvr2_sysfs *sfp; sfp = dev_get_drvdata(class_dev); if (!sfp) return -EINVAL; - return scnprintf(buf,PAGE_SIZE,"%s\n", + return sysfs_emit(buf, "%s\n", pvr2_hdw_get_type(sfp->channel.hdw)); } @@ -585,7 +585,7 @@ static ssize_t hdw_desc_show(struct device *class_dev, struct pvr2_sysfs *sfp; sfp = dev_get_drvdata(class_dev); if (!sfp) return -EINVAL; - return scnprintf(buf,PAGE_SIZE,"%s\n", + return sysfs_emit(buf, "%s\n", pvr2_hdw_get_desc(sfp->channel.hdw)); } @@ -597,7 +597,7 @@ static ssize_t v4l_radio_minor_number_show(struct device *class_dev, struct pvr2_sysfs *sfp; sfp = dev_get_drvdata(class_dev); if (!sfp) return -EINVAL; - return scnprintf(buf,PAGE_SIZE,"%d\n", + return sysfs_emit(buf, "%d\n", pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, pvr2_v4l_type_radio)); } @@ -609,7 +609,7 @@ static ssize_t unit_number_show(struct device *class_dev, struct pvr2_sysfs *sfp; sfp = dev_get_drvdata(class_dev); if (!sfp) return -EINVAL; - return scnprintf(buf,PAGE_SIZE,"%d\n", + return sysfs_emit(buf, "%d\n", pvr2_hdw_get_unit_number(sfp->channel.hdw)); } -- 2.25.1