Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35554469rwd; Mon, 10 Jul 2023 09:03:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlEG21dwrAFfxm0z6LDyFlwbhGRtI/HoCQS+Vs7hlazscfkGuvcNMQQlqRQf3Gh7qibV/hB/ X-Received: by 2002:a17:902:d4ca:b0:1b8:936f:c346 with SMTP id o10-20020a170902d4ca00b001b8936fc346mr23944343plg.30.1689005026023; Mon, 10 Jul 2023 09:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689005026; cv=none; d=google.com; s=arc-20160816; b=C1+jNKzj0prlu6K12Q1JWHooY8AG4r1Up/PgDFG5BKvJBTq9bNzrFSO/cWY8fSHgeB Vd2UBLIYgQtNqigmNbFbe929F8WZXksHYH0qG0sdZUQliD1aUnIXr7u3a7QebWOHGEb2 vejbxZ0j7vXumRpfg+Bajxac/hSsDyr/Li+6CmnyAlMJHoaYdVsZ2duOAEv9JtlS3/CG FsIbQm+LA+KdtlNhWZJLTA0DcaruMLgjeZrlCQY4zgjwdBxPfh6djMKRb6pKW9e8jQOR hEcFT6JAVW6xt0D6QVqzlNpVttxKPnAloSB2fyAnrFkEiUhECaPug0Za+9hUS3to5RTN HU6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ECLAvl1mSEryVlCd64h7dkI/H4oLCmS1Sp3JftYHCLY=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=WSHHWNASNdoknfE3yiCD10V5vZDpZet24pV3SjEzAZlf8zkDYcYspg1D9pCSuGMSKz i0wpRKq+a6HMWszttpxy4lcRYsopsWR/P8Im8+S1ukFZGy1QBP5LX2AvIYLLxFiR1TK0 cNONjtFhilcwMyKrfJ2JHRis8dwdffcbNwKFgOtoYqH3N93Cj+PqRzU0QhhJKUQmevQG CPPw+EJIB+llZuXz+RySVAMIdczJva2ypdZRznnLXrkd0nT5ivQPKpU9w+jOKsthp5El gc2i8pGYGJtKG/7/Acs5D8fSNCB1dEcy7SPx+PDjNF0uLEoEB7eBOqC800tK7jiVu7W/ vN3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=afsTSj0f; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x13-20020a170902ec8d00b001b973681493si80297plg.16.2023.07.10.09.03.34; Mon, 10 Jul 2023 09:03:45 -0700 (PDT) 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=pass header.i=@intel.com header.s=Intel header.b=afsTSj0f; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233439AbjGJPuF (ORCPT + 99 others); Mon, 10 Jul 2023 11:50:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233595AbjGJPtu (ORCPT ); Mon, 10 Jul 2023 11:49:50 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E58A18D; Mon, 10 Jul 2023 08:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004188; x=1720540188; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KmPI7TYMCxCRb9tm8UqoN5rT6jb9j7EvGYVTFPfVpOU=; b=afsTSj0fdpe/Ia8kaRxJlyPSYbaNp+4K2i3lQet0NfkfQM+VvF1a2nBD GwcgeIX8+NoZk8y/vxERpYpYffLr1JomjvMZRsEUf7fxBUQY9TxN1Tdyb IJOs3DHAaV7HBktvRlRZJCw8QXM6hFjZZv+42nnHNnqHktP/RpLgNejyw oCWOeziG/5iVrjYKX6U44q2yGD3NCzY9ASi+bViV9lMNVIg5XMLWXzUIE 748PlyoICC7HGOCmwwUonhv3Gpuy4piYs5V2BEtcYxitpow9i2MsLFw7N D9WzPTr35YMOecydEg3NekLDjzyn8ouQruP1fhF3p0AdErYdZgXN7JEAB Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="349185430" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="349185430" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 08:49:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="844921857" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="844921857" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 10 Jul 2023 08:49:33 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 77C76604; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-trace-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Sanjay R Mehta , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 06/15] spi: Use sysfs_emit() to instead of s*printf() Date: Mon, 10 Jul 2023 18:49:23 +0300 Message-Id: <20230710154932.68377-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230710154932.68377-1-andriy.shevchenko@linux.intel.com> References: <20230710154932.68377-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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: Andy Shevchenko --- drivers/spi/spi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 46cbda383228..cfb1c985d940 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -64,7 +64,7 @@ modalias_show(struct device *dev, struct device_attribute *a, char *buf) if (len != -ENODEV) return len; - return sprintf(buf, "%s%s\n", SPI_MODULE_PREFIX, spi->modalias); + return sysfs_emit(buf, "%s%s\n", SPI_MODULE_PREFIX, spi->modalias); } static DEVICE_ATTR_RO(modalias); @@ -89,7 +89,7 @@ static ssize_t driver_override_show(struct device *dev, ssize_t len; device_lock(dev); - len = snprintf(buf, PAGE_SIZE, "%s\n", spi->driver_override ? : ""); + len = sysfs_emit(buf, "%s\n", spi->driver_override ? : ""); device_unlock(dev); return len; } @@ -2782,8 +2782,7 @@ static ssize_t slave_show(struct device *dev, struct device_attribute *attr, struct device *child; child = device_find_any_child(&ctlr->dev); - return sprintf(buf, "%s\n", - child ? to_spi_device(child)->modalias : NULL); + return sysfs_emit(buf, "%s\n", child ? to_spi_device(child)->modalias : NULL); } static ssize_t slave_store(struct device *dev, struct device_attribute *attr, -- 2.40.0.1.gaa8946217a0b