Message ID | 588327734f374b5f5cb5c4d5725d884fdc83663e.1707654406.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-60727-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1900777dyd; Sun, 11 Feb 2024 04:30:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWGXSF+MDfUMdEwZ0lUIr/wBnwWfvaRParcbM8MdVThgwyyvItTIReJJQtThQv07wnmEqQCIA6+KOOJGCvjTIEI2d6Zqw== X-Google-Smtp-Source: AGHT+IHcFZMnDk3U/ptIyaFfs+N05t1SgeZSpfOGPEE1LLnFpPxXjWUmvrCJMVjS+zRqrf+Mxumq X-Received: by 2002:a62:d41d:0:b0:6e0:6a53:e380 with SMTP id a29-20020a62d41d000000b006e06a53e380mr3434589pfh.22.1707654602131; Sun, 11 Feb 2024 04:30:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707654602; cv=pass; d=google.com; s=arc-20160816; b=O1FN33o1M+5LkwjSIGTa6xSBOR777OpxTSVllU0FZ/j7GI2wKKueHdo/sr+wU+wyig atV8ERtrDLJv8wJSKEdB+fJS26hX1rLBxcyXdekbggXEwDv11ccoCTfhxlMY+I6Bjb5g 7HWtTaIjFzeN5USff/y58coF8bXvbGmPQiyoaUtutiy4cE3sB0QLvb0E14g1ULNVSgHL nJsGXGRbssTIWcZ2MJssOZYJwVNlMJ7dL2t1d6qPVOtJVfVJaLH0xRTYksowBfm3xDor AI+w7LGLPJqNbiPnyUuh+PSPhKuOjUEQl5Fh1nSWYbXbvRp+X7CW6+s69D0v/mJGMUfd xx6A== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=yjTdCUQsFTSNm5Ev7xNn7axY7MBZ0FtXX9CI5fLO26M=; fh=o5foh8s1DADND90gSb00XhCqLKs99SLaMOmcqmMGI60=; b=aCdXQjrQf9BhrlGUI62gexmNsOuvRlyXBIl/vszXSPNCE7NyKiu1ScoZAYxzbIzeEk 3fSFLsJkuCd1qbEPFHwC394Opes6VqPepVLOMNrgJhkag8PsES2z1aEpXgzO7i6AqoBG Xy5UOhQZInq8o1AXqcEnJRuVfV6wifncI9pcPV9BU5ndZJlN/X1V4vBmZHzH/UaFlvCl oL9PKC5nceCZrmcF3f4RFOP021l+wHWYXSzZuosupOhqLqXTluoMBG/ZbrtrPD/AdfER d8DLX2ikj18WCGHOFx0S6B6Dp4Bx6zU/NtQ0f0m5uynI+dx9EtuBKP7u6HCGuzCRBq5A 8PzA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=h3rFLLTL; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-60727-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60727-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr X-Forwarded-Encrypted: i=2; AJvYcCVclxZsDGi/+umtFwpP9k4+Ot2irvhjfTkDLrOX/3xE0th5xXLfW70SR+XAVGVBZFmu6EF5Z3v1gm49Z5B/EorReODbzg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id jw13-20020a056a00928d00b006e0ad616bcesi1885614pfb.123.2024.02.11.04.30.01 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 04:30:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60727-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=h3rFLLTL; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-60727-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60727-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr 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 28B93B20F0F for <ouuuleilei@gmail.com>; Sun, 11 Feb 2024 12:29:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64F435B202; Sun, 11 Feb 2024 12:29:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="h3rFLLTL" Received: from smtp.smtpout.orange.fr (smtp-13.smtpout.orange.fr [80.12.242.13]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1CB705A7A3 for <linux-kernel@vger.kernel.org>; Sun, 11 Feb 2024 12:28:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707654543; cv=none; b=eK4GROKQ9FqSVdiZbj7Gvgw28StgtkUY6BkmRhdAuY2cpHO/z23cO/M/H9FKSBhhKvtekSNcM7w2uLHQmrcHuB1yPh7+sn2cU2yirRALYUbQmEcyJhSywgq5gG03xiNPDbDYYdZZfUFSkndmT+HgBrqQgY/u7YHKv5f+oCuBOnI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707654543; c=relaxed/simple; bh=VDd0p4EgHd0V78fptXuQVp76nhioQUVgvT6c7xK6XB4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=aCfHFpX/v4l8XvPx5HUStVURE13PYgjudvx5ENiFOvl2RrmaS8l25gse02VPrOrizb5pgQF7Abo5t1oxqKsOF3UJk6oIQ6t/FJl2BQGcrJamEwz9Zr4jAriJzNpIIcZ2mh9pC9Wp2EzeyksyLqd7SmWo5UIFwnb2rpCRcgjXx2c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=h3rFLLTL; arc=none smtp.client-ip=80.12.242.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from fedora.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id Z8w2rS5yOymFYZ8w2rQ4zQ; Sun, 11 Feb 2024 13:27:50 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1707654470; bh=yjTdCUQsFTSNm5Ev7xNn7axY7MBZ0FtXX9CI5fLO26M=; h=From:To:Cc:Subject:Date; b=h3rFLLTLkMZjqWbUjtTisjdWyfYwJt1jHDbPkmO9jBbTFmmyaeFXdFUWb20lag9vH xu/FEycccHE+QoLhTHVsj9hX2XySe2SnitNm5vpnpLspP+WIHx3PrwY7VVHYyp90WT hIn8gbrZC3WiPGFvDHj8tw5IWIgjQbTSRW5HqlljriNKdv6M+yBPDXtDnpS7Yb4ahU /xj7tWW/QQHQm66zAIEEPiZfqN3d3frQv3xDsuwutuiYokfWYDxOJT2Ro3T/HBVNwF /fVwANHFr7Vybw9gnJ0tkEt+9iN3K9WONO+r95egNghqhFwPUJICCQRXp1b64N3pK3 ph1JfsJ3MSTmQ== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 11 Feb 2024 13:27:50 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, linux-staging@lists.linux.dev Subject: [PATCH] staging: axis-fifo: Use sysfs_emit() Date: Sun, 11 Feb 2024 13:27:10 +0100 Message-ID: <588327734f374b5f5cb5c4d5725d884fdc83663e.1707654406.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790605632063924564 X-GMAIL-MSGID: 1790605632063924564 |
Series |
staging: axis-fifo: Use sysfs_emit()
|
|
Commit Message
Christophe JAILLET
Feb. 11, 2024, 12:27 p.m. UTC
sysfs_read() is anly called from _show() functions declared by
DEVICE_ATTR_RW().
Using sysfs_emit() is the preferred style and here, it saves a useless
copy and a temporary buffer in the stack.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/staging/axis-fifo/axis-fifo.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c index 727b956aa231..c51818c56dd2 100644 --- a/drivers/staging/axis-fifo/axis-fifo.c +++ b/drivers/staging/axis-fifo/axis-fifo.c @@ -165,14 +165,9 @@ static ssize_t sysfs_read(struct device *dev, char *buf, { struct axis_fifo *fifo = dev_get_drvdata(dev); unsigned int read_val; - unsigned int len; - char tmp[32]; read_val = ioread32(fifo->base_addr + addr_offset); - len = snprintf(tmp, sizeof(tmp), "0x%x\n", read_val); - memcpy(buf, tmp, len); - - return len; + return sysfs_emit(buf, "0x%x\n", read_val); } static ssize_t isr_store(struct device *dev, struct device_attribute *attr,