Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1309913lqa; Mon, 29 Apr 2024 05:10:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUKs2BfPpPeNXeBBTwb0xIVCSW4m7d8YYzd2EcxrSJiNzgdvHDFjWj7DYRN2pbfKAV/mdgYBamPtxijpPiSOAV8TLMrVfnqObrsVCKEpg== X-Google-Smtp-Source: AGHT+IF5eKvEeXDxhYkpXpS7eUCprLmqT1pb1vWUJPi2yceSqk6bBCFK/ul7bBoiPgT7kfgunqr0 X-Received: by 2002:a05:6808:23cc:b0:3c7:d8c:75c5 with SMTP id bq12-20020a05680823cc00b003c70d8c75c5mr12705580oib.20.1714392635820; Mon, 29 Apr 2024 05:10:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714392635; cv=pass; d=google.com; s=arc-20160816; b=oPHz1JMQZ+TZpT+vlqx/PqKgbi8XTta1ZLlNcvubs0rBZFhDhq+vIBs2AK96XkMey9 /2c0hCb2i1Qzc1ZlD5DuQSQrMW3ZnZmK9EwZYuBqMZ340ZGFlIhYrdWY+HhZlODCd9IV 9IsbmBGPmGWbqDD7yvySilZd6l2pH75/nSSNGiFfwcC8YJ2A57v9BxALP+6qPRoMTQVP skrzR0I0xouVo6PSp9GjdFTyDZgHTydMEVTXI5KAhCDYJbuj3gEaNaGSz4v+9XhdqGQx 1Bk2Jwj5Z0CxeULppC1k6bV5SG77DPuYJQZv08MO8wOu5UDSeNEUsDAmTdac51H/Ak7b mLyw== 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=ktvbWUznVJSELfLwC8H1TMbLSJswWVDw6ZtWTkIbdfw=; fh=5zyRijiIagQQSu9jCSMyks547Zjny4I4RcR1YIsUbTs=; b=Npx8fwEHhG3eei/ds4nVRUMbq+tSm1JYYjDU+HH8md9eSdYTQgJbFozis5HcUJY2Dw 8bzhbQ/hxV9hWSkHg2UbuQBRt90Iqfb+8av2zpFa+EsdMKr0GVxSGk5OW1qPcFbE3zmx yoOapCXCtfGMD2E9PxKKGAjSWJsvcpdW36ly5WoNIubjEvdzpkaFfv21Rsd6jbdOX45D tkDYCcGGFHxmKMFZ8IfTUlFR0k0uBx8ZQeF9+XHw4KH+7PFN6dVtBeWy2wfcvEuW103o 4lltDwdbqQYbfM0mDIwfDwSz3HFjHoPbEMMzMhKvVjFCdfXaKP7ZU5JgUp6OVJNSty1Q 0YyQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="U4/0xUXY"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-162196-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162196-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jo24-20020a056214501800b006a0c765cc1dsi3792526qvb.376.2024.04.29.05.10.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 05:10:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162196-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="U4/0xUXY"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-162196-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162196-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 87C481C21B7B for ; Mon, 29 Apr 2024 12:10:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4DF326A348; Mon, 29 Apr 2024 12:09:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="U4/0xUXY" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 3EEFC54919 for ; Mon, 29 Apr 2024 12:09:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714392568; cv=none; b=aEiajFyDwpcxyZwa1jZinIHoSHA4uXqD7vCLziuX3vCHO9CtRkk22dPycoynvlw32AAOJQxedTudJYwGLifwUszR/+MWpZTiSyTyArGtzFwNdPlBJFPIR7husU11uzJAbkYfeVQexQdD/KCYFG9AN0STcSHJNzsXwVpCDklAtxs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714392568; c=relaxed/simple; bh=NfZcypoD1CZ34fuMUBVKQlaVjj4H35Y4xSOcxQL65lQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lv9iBMjKCkPh1N4b1rJiQ6PqEEatc4sAvVZK29luI4WDG96PtTTWKK+WsZIMcyDqA44+gD2pM6rJnFQzUKrFp9URhQPZJsVYkMwuLLkSuIwh0Lx1wOGL1a2h1AAYv1cx0KgzlAzH/cXS95qj4jUMmdoLwM/aWGKgjZxev0888WA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=U4/0xUXY; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714392568; x=1745928568; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NfZcypoD1CZ34fuMUBVKQlaVjj4H35Y4xSOcxQL65lQ=; b=U4/0xUXYLiXM7tNClTzaDxPtFeskchT9N6RhKnyac69XFnlY+UHug5uC LNkN/7wn+X4NgBXcvccKWTbbrRpGI/GHKDdNRmzYSDJ+BmAJoJSvbLZeY TjnxSu++GQVOJuW+IsdivWlv41XMlURlvKHzTrNNkXHZODIrlvpBDhwYv Bq9n5/VqpcRuWPl/qQ+ZGciDzH/95X54axJ5JDW1np28qAA2zhalz9yLU 5eE84w03H3lq+yxmEOshTOJwhBa/t7iAE/do1TGkgRblboCyE1BkoWI91 RGcgrxXQBPVkxt5x+jinnjSmyoRPUN53Er7iW/DxNSxmeaoVGNg0OLBaU g==; X-CSE-ConnectionGUID: EcZN3ZbzTg2eaxRl6hf3tw== X-CSE-MsgGUID: Glqko+JXSh+dIZBPspGETw== X-IronPort-AV: E=McAfee;i="6600,9927,11057"; a="9908249" X-IronPort-AV: E=Sophos;i="6.07,239,1708416000"; d="scan'208";a="9908249" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2024 05:09:27 -0700 X-CSE-ConnectionGUID: jGbHB7zUSOm2Cra/AexmAQ== X-CSE-MsgGUID: d4ABijVXQX+IkYWI/rcQBA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,239,1708416000"; d="scan'208";a="26166625" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmviesa010.fm.intel.com with ESMTP; 29 Apr 2024 05:09:25 -0700 From: Alexander Shishkin To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Li Zhijian , Alexander Shishkin , Andy Shevchenko Subject: [PATCH 06/14] intel_th: Convert sprintf/snprintf to sysfs_emit Date: Mon, 29 Apr 2024 15:09:00 +0300 Message-ID: <20240429120908.3723458-7-alexander.shishkin@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240429120908.3723458-1-alexander.shishkin@linux.intel.com> References: <20240429120908.3723458-1-alexander.shishkin@linux.intel.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 From: Li Zhijian 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 Signed-off-by: Li Zhijian Signed-off-by: Alexander Shishkin Reviewed-by: Andy Shevchenko --- drivers/hwtracing/intel_th/gth.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hwtracing/intel_th/gth.c b/drivers/hwtracing/intel_th/gth.c index b3308934a687..3883f99fd5d5 100644 --- a/drivers/hwtracing/intel_th/gth.c +++ b/drivers/hwtracing/intel_th/gth.c @@ -154,9 +154,9 @@ static ssize_t master_attr_show(struct device *dev, spin_unlock(>h->gth_lock); if (port >= 0) - count = snprintf(buf, PAGE_SIZE, "%x\n", port); + count = sysfs_emit(buf, "%x\n", port); else - count = snprintf(buf, PAGE_SIZE, "disabled\n"); + count = sysfs_emit(buf, "disabled\n"); return count; } @@ -332,8 +332,8 @@ static ssize_t output_attr_show(struct device *dev, pm_runtime_get_sync(dev); spin_lock(>h->gth_lock); - count = snprintf(buf, PAGE_SIZE, "%x\n", - gth_output_parm_get(gth, oa->port, oa->parm)); + count = sysfs_emit(buf, "%x\n", + gth_output_parm_get(gth, oa->port, oa->parm)); spin_unlock(>h->gth_lock); pm_runtime_put(dev); -- 2.43.0