Received: by 2002:ab2:5c0e:0:b0:1ef:a325:1205 with SMTP id i14csp284014lqk; Thu, 14 Mar 2024 03:04:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUjX45LQbWfLoBC3XyDQH+EYPW4h73hQSrINXup61yN9wGG+jXms3r+4nUcKdS81vSA6xv/h9tqKF95Gz+km0/o4nH2Ges+wHZhCT2iyA== X-Google-Smtp-Source: AGHT+IH1bDMRR0f7FymCuvPW2qTp+uaejdaMDvVcImqe6VG7P6Tam2EgMfa0ECRIY/MrSgT8MIZ1 X-Received: by 2002:a17:903:22c6:b0:1de:c6d:ce23 with SMTP id y6-20020a17090322c600b001de0c6dce23mr1219963plg.2.1710410679702; Thu, 14 Mar 2024 03:04:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710410679; cv=pass; d=google.com; s=arc-20160816; b=VkWalaQu8FYpKjnPpPexbwcLPrZW6sP74YjVEr4XTaeNQKk3BotMQ2tsnoCRKMCNoa X3r6wx7L8PyoMe/OGP1nqVgkrTmu6h9dtc8SM84pFgw+L27ZT5HgXi74WekTfLUoaazP 35d1KRlJqGRYvkRCohitrk9r5ezON+PxTRVA2CpOWeaZCmj190n6BgXpCXOYCjMc5nhZ wrNpNzTQC2GNQbddp+FHEfL7sy10NbA+MVg+Nv6qnFbO8k4Z77SHiOZqz+RDIHrsbLfz oyYpGUTyQecA0TqqQ/oA7vyam4VFPxA5wAxfOrR9e+1JQWEEz4IfPX/TcLvFxxEhMf1g pqGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Wngl3GLJSTx5BLCJbYool3rft3t4VAmjq6cHLvTJiRI=; fh=fKXj61oYNw1Qw/KCnTkqcJxx91xkSyuDe0WKqe4OlRY=; b=YnoLYnM3zz719l63MgDtbDV0Rebh7fPmcdOkrFWp+nUUtj14YIM4BX0+podpDXmgMr dG8d7aBN0bP78xCileVcZAVRqaHvuVHL1Ff0GCtle3YhMCKr7r1JHdmnLiaOM2Pfgect ZiRSwXhtTdoIXRdDDgDVqlB+rQCtZQfr4FKN9MPO1ovpQJBLZdKByRJ//SFWGswuK91z gzmc1d+7x59kuFEHv+Gj07AaNAkc6uNHxazVwYv5PRgD8mdfXAdiDZ5tYuHWwgpj8vnd PBltt/A+3xHtLSmEpUhrXBEGs2VA/M8/7Ar5tPZE83E0OjxrYJBKP/H+7hjbj7DNmNqQ gshg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@fujitsu.com header.s=fj2 header.b=QKv1H+JN; arc=pass (i=1 spf=pass spfdomain=fujitsu.com dkim=pass dkdomain=fujitsu.com dmarc=pass fromdomain=fujitsu.com); spf=pass (google.com: domain of linux-kernel+bounces-103091-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103091-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id u12-20020a170902b28c00b001dd5bd47f95si1138401plr.143.2024.03.14.03.04.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 03:04:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103091-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@fujitsu.com header.s=fj2 header.b=QKv1H+JN; arc=pass (i=1 spf=pass spfdomain=fujitsu.com dkim=pass dkdomain=fujitsu.com dmarc=pass fromdomain=fujitsu.com); spf=pass (google.com: domain of linux-kernel+bounces-103091-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103091-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=fujitsu.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 182DFB20EAE for ; Thu, 14 Mar 2024 10:04:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 27FA96DCEA; Thu, 14 Mar 2024 10:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fujitsu.com header.i=@fujitsu.com header.b="QKv1H+JN" Received: from esa3.hc1455-7.c3s2.iphmx.com (esa3.hc1455-7.c3s2.iphmx.com [207.54.90.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DBE46BFB5 for ; Thu, 14 Mar 2024 10:04:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.54.90.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710410664; cv=none; b=IvsEWydC6Rlce3a5a1Cs+gPEoe36tfUs4yZg8HWJgS229sfTTP30y/Dyu2nkqn62VpNE8gtA4KNN2E/nqz927UnuIU+I5yWc6GJ4z7sfUVzg40ucWwtEKX56gHmuJ3JOqn/Yp7Jb5N5GgKUpjlWGd40D2m/TKrvo1Nb4oY66vQE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710410664; c=relaxed/simple; bh=AFhsiaSN1eedmSccQpHaGcchUo0RMHyh4duqmQyuRlA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RTluTWifGl2IwYSQOYfdoqPQDWzycep6JTodww38RS9rU0196ww074hLP7qXbqbLYv8CWI18lA6/Ocrz7rpyRhmKD8ua7sOgrjo8cIu1ocNlNPr/vG8UWl9wUtMG0RYIgDzclM1L6e2FNwcobGq2KZYHsY0UUQEKUEHeJ/259TY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fujitsu.com; spf=pass smtp.mailfrom=fujitsu.com; dkim=pass (2048-bit key) header.d=fujitsu.com header.i=@fujitsu.com header.b=QKv1H+JN; arc=none smtp.client-ip=207.54.90.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fujitsu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fujitsu.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1710410662; x=1741946662; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AFhsiaSN1eedmSccQpHaGcchUo0RMHyh4duqmQyuRlA=; b=QKv1H+JNxrW2oN7SNayuouXwo/zuDQwT3KrDw7HJQyRw0OMKwAhoTaFY JQLn8XI4ep5cR8YTA16i+mdcnmxFA1QFEbfM64k4TSD+8mYJHBKwwKt5N FL6sUvNCGlg8SkVv5TmeCJvJtLTuFBMiQKbliG2g4uayse3epPV8U6fvr NqY5SkDB0iLHNzTqtdqwETCcZ2/xPvwMdPhFGxmo4hMJBLqjUaw999Xea qFOcpNiJomW9iKYyEMUeecu1W0D8X1SrQ4EOAnJ18CcJCWm8L3BW8fq0G Lygbwki3heY6hXyq4A2LphTiDU4ha5R54ywhBAruusqmB6epatWqqT29R A==; X-IronPort-AV: E=McAfee;i="6600,9927,11012"; a="152241877" X-IronPort-AV: E=Sophos;i="6.07,125,1708354800"; d="scan'208";a="152241877" Received: from unknown (HELO yto-r4.gw.nic.fujitsu.com) ([218.44.52.220]) by esa3.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2024 19:04:19 +0900 Received: from yto-m2.gw.nic.fujitsu.com (yto-nat-yto-m2.gw.nic.fujitsu.com [192.168.83.65]) by yto-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id 5E437D772F for ; Thu, 14 Mar 2024 19:04:17 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by yto-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id 8B640DCCAD for ; Thu, 14 Mar 2024 19:04:16 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id 2044B20099547 for ; Thu, 14 Mar 2024 19:04:16 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by edo.cn.fujitsu.com (Postfix) with ESMTP id B30D11A006D; Thu, 14 Mar 2024 18:04:15 +0800 (CST) From: Li Zhijian To: linux-kernel@vger.kernel.org Cc: Li Zhijian , Thomas Gleixner Subject: [PATCH 2/2] clockevents: Convert sprintf/snprintf to sysfs_emit Date: Thu, 14 Mar 2024 18:04:02 +0800 Message-Id: <20240314100402.1326582-2-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240314100402.1326582-1-lizhijian@fujitsu.com> References: <20240314100402.1326582-1-lizhijian@fujitsu.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-28250.006 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-28250.006 X-TMASE-Result: 10--6.201400-10.000000 X-TMASE-MatchedRID: e6WPXQD7Ri84ibokZ3+Q0CoiRKlBVkYIBXngI6jFvpfDqO6/8R69QE8U roFNOGp7a6aAZTOwtJmRloiW1Kgftd2ZdKe8BPbS/sUSFaCjTLxN8rmPQRlvK7oFQ8GRC1Prs1w waYBQLgs9/vFVBxxqgB0XJlVTsEsboYY7KoErjW8ReM8i8p3vgEyQ5fRSh2656hUULKzHRgQLm6 NncNkETaGvCFqoKSwTgDLqnrRlXrbIDt27MLDp0t0H8LFZNFG7bkV4e2xSge7btc58sZd4JWtX0 +U6nf33BNN/GR02l6mieABoRFLqcl8I4oUq5Vga X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 Per filesystems/sysfs.rst, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. coccinelle complains that there are still a couple of functions that use snprintf(). Convert them to sysfs_emit(). sprintf() will be converted as weel if they have. Generally, this patch is generated by make coccicheck M= MODE=patch \ COCCI=scripts/coccinelle/api/device_attr_show.cocci No functional change intended CC: Thomas Gleixner Signed-off-by: Li Zhijian --- This is a part of the work "Fix coccicheck device_attr_show warnings"[1] Split them per subsystem so that the maintainer can review it easily [1] https://lore.kernel.org/lkml/20240116041129.3937800-1-lizhijian@fujitsu.com/ --- kernel/time/clockevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index a7ca458cdd9c..60a6484831b1 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -677,7 +677,7 @@ static ssize_t current_device_show(struct device *dev, raw_spin_lock_irq(&clockevents_lock); td = tick_get_tick_dev(dev); if (td && td->evtdev) - count = snprintf(buf, PAGE_SIZE, "%s\n", td->evtdev->name); + count = sysfs_emit(buf, "%s\n", td->evtdev->name); raw_spin_unlock_irq(&clockevents_lock); return count; } -- 2.29.2