Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp548958rwl; Sun, 25 Dec 2022 02:31:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXuMd2rQft5lF4HaarQd28McQFzH/kJiyOXVZ5OyHzNAxfu9Ov/qDBbHs7rnwaBGxHy9arBB X-Received: by 2002:a05:6402:914:b0:479:dc9c:1144 with SMTP id g20-20020a056402091400b00479dc9c1144mr13930101edz.24.1671964260316; Sun, 25 Dec 2022 02:31:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671964260; cv=none; d=google.com; s=arc-20160816; b=YJp0XywIHzEjXDUcDKcOT5EJFz5+Hi3/O1N1h8tXXC38Hh+5OpDD5cRfjCKIzy+YVw cyxORefiCePXPsVlK8iGvGNS0PHybFcPBcDTp+KE2mtxpNi+A06s2DHjceFzfEywt88I Wqa0qyKsgrYFfIFIiIY7m3ojJY6u9J3FujClX5cnTcCDrRGdW001BsxTUjt8m0hK7ZQl RhfNpsns4MMfko/MdZsIAJPcb7x86fSVKTXJQsBTIuujRglJXbbQq1WpfkUOINbwk1bu xa1XScvQQvmV2MC2pjxeU3sifAKnKpZez2QqhUseYmfNg8L11O5gwAkzBqq4I7QRKDS3 IOpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=BWvXWPMzwSTCxxpqcQW0gI5RZCl8AYztczo9joCpUdA=; b=kVDjtpYlbSIt6hF/1vEd4opEL+h2lIeoGrC76xTr7MzARMdZwO7NNoFjSwzRJXOFo4 2AxfQ33amAFIIkJdIc53gjv2uypy7KjZB7OjvYYvEKfPlvOJkYOhRKA1ohmsy9/OD5Ji GglCrOkdcJX3ZcNXzfLFWeR6m4k4o9kHh/KtQaxa6lc+zML0SOpmn32JZ9qRsNUJ0gq8 b3T0jegCrT7qPCs5wgoMbb9gvJrHrkoRzEhoWNvf7fePZLsuDauSCVIicZi01I6tgjKI ItoUp/z/b5Ser0vSHfRY5NUT4Prjc44pouEQcIWddL+rpBWogpE1h7I0khubePp3YBT6 Xr2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b="GWMRd/sU"; 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=mailo.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w13-20020a50fa8d000000b0046b1c4b8199si6260870edr.82.2022.12.25.02.30.43; Sun, 25 Dec 2022 02:31:00 -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; dkim=fail header.i=@mailo.com header.s=mailo header.b="GWMRd/sU"; 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=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230510AbiLYJCf (ORCPT + 67 others); Sun, 25 Dec 2022 04:02:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbiLYJC3 (ORCPT ); Sun, 25 Dec 2022 04:02:29 -0500 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F32CCC2 for ; Sun, 25 Dec 2022 01:02:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1671958933; bh=Ikp0bAciUuHR4CMbH20GjbpUaRxlCiAZvcXlyc9waLo=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=GWMRd/sU0xw0RjY/sfGybZ415xUmj9CIVv+p28PHWmtDPlOrqOxqBGj1PkikxEUkq R+Trdr7wUiEwD8sCNDULm1P4vj4Qar/txZTOvNi3Z2xnHRcDD+784fOPKm4LyCz125 XM4/Rwg9IfkbUAF5WeMCLJYg4i9VMxZ8kKyNyIGc= Received: by b-6.in.mailobj.net [192.168.90.16] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sun, 25 Dec 2022 10:02:13 +0100 (CET) X-EA-Auth: Z6P0qwhHoWnu0O6GC4KeXSFonqwCrW85IJg5SHY+V8thx9eg+ci2uMF9OuzEX4B+nQ56UEBNnAqMBeIPZ5eNEs+/JG8CxndQ Date: Sun, 25 Dec 2022 14:32:08 +0530 From: Deepak R Varma To: Ben Skeggs , Karol Herbst , Lyude Paul , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: [PATCH] drm/nouveau/hwmon: Use sysfs_emit in show function callsbacks Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 According to Documentation/filesystems/sysfs.rst, the show() callback function of kobject attributes should strictly use sysfs_emit() instead of sprintf() family functions. So, make this change. Issue identified using the coccinelle device_attr_show.cocci script. Signed-off-by: Deepak R Varma --- drivers/gpu/drm/nouveau/nouveau_hwmon.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c index a7db7c31064b..e844be49e11e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c +++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c @@ -41,7 +41,7 @@ static ssize_t nouveau_hwmon_show_temp1_auto_point1_pwm(struct device *d, struct device_attribute *a, char *buf) { - return snprintf(buf, PAGE_SIZE, "%d\n", 100); + return sysfs_emit(buf, "%d\n", 100); } static SENSOR_DEVICE_ATTR(temp1_auto_point1_pwm, 0444, nouveau_hwmon_show_temp1_auto_point1_pwm, NULL, 0); @@ -54,8 +54,8 @@ nouveau_hwmon_temp1_auto_point1_temp(struct device *d, struct nouveau_drm *drm = nouveau_drm(dev); struct nvkm_therm *therm = nvxx_therm(&drm->client.device); - return snprintf(buf, PAGE_SIZE, "%d\n", - therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST) * 1000); + return sysfs_emit(buf, "%d\n", + therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST) * 1000); } static ssize_t nouveau_hwmon_set_temp1_auto_point1_temp(struct device *d, @@ -87,8 +87,8 @@ nouveau_hwmon_temp1_auto_point1_temp_hyst(struct device *d, struct nouveau_drm *drm = nouveau_drm(dev); struct nvkm_therm *therm = nvxx_therm(&drm->client.device); - return snprintf(buf, PAGE_SIZE, "%d\n", - therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST) * 1000); + return sysfs_emit(buf, "%d\n", + therm->attr_get(therm, NVKM_THERM_ATTR_THRS_FAN_BOOST_HYST) * 1000); } static ssize_t nouveau_hwmon_set_temp1_auto_point1_temp_hyst(struct device *d, -- 2.34.1