Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1205092lqe; Mon, 8 Apr 2024 01:42:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXBXsrIUkG2LgHQ81fquQcDXOOLyKuPee4l8QTtSgUshXIuO4aBLEgEskysDt+zR5DdOaN8i6qV+CtIRpFErmhd+fCKk+aatQbHPlt4dQ== X-Google-Smtp-Source: AGHT+IEA4HbpfWbdTXAzPjcKd2Otyl7DZ1eVYhgC6oEr/F50T9GmG1rZQNFFdcornxccsez7h7MI X-Received: by 2002:ac2:48a4:0:b0:513:c95c:4dc4 with SMTP id u4-20020ac248a4000000b00513c95c4dc4mr5631764lfg.7.1712565759262; Mon, 08 Apr 2024 01:42:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712565759; cv=pass; d=google.com; s=arc-20160816; b=lPYpVxl3vI+fPmXvK1fKzDqIBpV9Czei4qXBccUZtMUVNmZvbrhfvIx+jSLpzV2YVe EvgKv9D7oXQvgbDcNLhQNNCoHtQ1dcinxKH/kUY85TbzCv9ArZq8Z0G9l2hMcg/bsJTI OWOlIWFdKtQHe6UXzgZhHA1/CoLiASlEKajNEc9jO7dtMuwmGRJCekesho7r9l379/RO 3I4rEbKE1UmSHnwBE1msBi06uDW011BgElUNQgPB+tPKXrO2a5Oc9PvMWNSxd9kOzahC hND+Uixs8IWZwg1ysTcFQz1LiXZmKRzzFZicgI5iAVvHwvrAcBd4qTb+LAEPjUMePf6f iBBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=FQokU1JusBsW27sxni2ZdOK8FBwnyFHlVAAuIJ7awpY=; fh=odeKpHo/6bItcc1NoUxnf/8FV/LrdoGnD8rU2RXzMKg=; b=rz5scC/vt9qzmzikU2i5HwmE8FQxC9Vqt1n6PtjPELN2jGdP+Dti9ip0fnnjAKgG7+ k+WSlR3XTkThGd+CK1omIG8FwELJGFswGKyZkIXWlW01dSZ+YoH261ywulOTKVMvQZn/ qXhjhJCAsuNd7TOOuejaZhlhswysgq9gRA31KckMKnRz09Xs2Z8RzGwyqmPDgg/GbNQ7 8oH7A+LwwL2JYhSzxc5M0LJ1JZAjcNL+Pyu24uXP276k2dhJ47RDwohh5Vr7WPwpQZ8k WIL7Hh/LRx0gKQIBsGxG+m7dttS+LHRlzQkYyDNDwZjCyGg1OkVmD4O9arOC+K5qTVs1 yDWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="j+qi3BU/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135057-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135057-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gn41-20020a1709070d2900b00a51d83c1af6si638076ejc.126.2024.04.08.01.42.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 01:42:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135057-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="j+qi3BU/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135057-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135057-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 002421F22D8D for ; Mon, 8 Apr 2024 08:42:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C78913A1A1; Mon, 8 Apr 2024 08:42:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="j+qi3BU/" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DBD6D2A8DA; Mon, 8 Apr 2024 08:42:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712565746; cv=none; b=tSmtB8maf/npoGPE8n4GlEy+aZ+DAVOK91ABGRBlsHryDKC6Hkm2585v7MDebXDLBh1pqQj8eCDXl4eE8J/PIH4h3tWlSG/HsWuhzWlcplIkaawJXgA8ikcgO1EDFbcjXj/Ut06khVk6lVyUd3Zfa+79D8I5nBY46HkwZZei1E4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712565746; c=relaxed/simple; bh=x5uAG/ltu+aXdeMkNcec1QhqHWClHSds/cSLz1O5N+g=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ZT/fGoGwQyBaa7rWv9GNT9/qhrtLMGgiYyfgCHw05zl4mAx9jMipSp0EjxpbBuprT8zeOcYHp/e0Ui8O9GIE6rbN+vNxlVcBI+Fi6q+8nvoOpl65yJqoRZkqJ2bXpA/khmqdVQEZ/Q0UTHgJ/2pqCcMdqGYUhggYf4yEJMi9BpI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j+qi3BU/; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66F0CC433B2; Mon, 8 Apr 2024 08:42:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712565745; bh=x5uAG/ltu+aXdeMkNcec1QhqHWClHSds/cSLz1O5N+g=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=j+qi3BU/XayOJEtk+zUWGNNXQZwmsfv+7aRrjOixLWr9b8aDnkabQa9KH3L/LY6DI m+NUPCrWQD+jJhcuDStJoFGhTxPISCbmLKbIMwc1bFdbxldPGeFotZRP6XX6Yyd1Sw 8wW/P/+K3Tm/krPTPGekFenbgHv7BnAJwy+LJocFCu1wAm/93oF6WXorKLzFVtb796 5Q/i+69eFIPDnCr0eBPH58O33gEBpxh53m0HOGjCTGWk4+u1OXRHXOZLCw5h7+TNm8 xz7Or05SIZ89ACo+2Vey5KDI9TxFEUmkyU6UxNShLs+ZjjGIyqQbPR5Gy+6aw56pgm UQ1Y0TfhTn4wg== Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2d8129797fcso56246301fa.1; Mon, 08 Apr 2024 01:42:25 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCXHW8otahrjrLLKh9J4WLXrl0zC74rJD2KqhK2M7odqLJVeRJxSYoq81uYvwmkreoN4X50RogjkAAPpKtfjar5iOWBF1mxJYwuGWmDiSdUbwLsQarYDrhSU42isJLV2+mXWkW3wGWJAx6xQgLkQAJRx8GhC2+rkSrZSlKn6ov9RbYC+4mjaKt/vvljwuTEU33okZRTFUanGHRatLTB4iBTJ3FVCJcmvu719ajLMQw6yDozrwyVq5dy/pBQiLw== X-Gm-Message-State: AOJu0Yy92AjzvoA49OSpu1/HpsCJ70hwuWcRj6qYl6KenfOkQU9UBiKM saiF0PmCf4JU9tKcqmsYG47Z5BsiS2TkK6qlVgLPTU6x4m8G9LDTy9NjNyWIy1dsuTz4ghjiHA8 V8+sAoB9/MKS5JrMZ/6YmZQjNEOM= X-Received: by 2002:a2e:8911:0:b0:2d8:713f:817b with SMTP id d17-20020a2e8911000000b002d8713f817bmr4768893lji.26.1712565743595; Mon, 08 Apr 2024 01:42:23 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Ard Biesheuvel Date: Mon, 8 Apr 2024 10:42:12 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/2] Deduplicate bin_attribute simple read() callbacks To: Lukas Wunner Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, Jean Delvare , linux-efi@vger.kernel.org, Zhenyu Wang , Zhi Wang , intel-gvt-dev@lists.freedesktop.org, Daniel Lezcano , linux-pm@vger.kernel.org, Luis Chamberlain , linux-modules@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Sat, 6 Apr 2024 at 15:52, Lukas Wunner wrote: > > For my upcoming PCI device authentication v2 patches, I have the need > to expose a simple buffer in virtual memory as a bin_attribute. > > It turns out we've duplicated the ->read() callback for such simple > buffers a fair number of times across the tree. > > So instead of reinventing the wheel, I decided to introduce a common > helper and eliminate all duplications I could find. > > I'm open to a bikeshedding discussion on the sysfs_bin_attr_simple_read() > name. ;) > > Lukas Wunner (2): > sysfs: Add sysfs_bin_attr_simple_read() helper > treewide: Use sysfs_bin_attr_simple_read() helper > Acked-by: Ard Biesheuvel > arch/powerpc/platforms/powernv/opal.c | 10 +------- > drivers/acpi/bgrt.c | 9 +------- > drivers/firmware/dmi_scan.c | 12 ++-------- > drivers/firmware/efi/rci2-table.c | 10 +------- > drivers/gpu/drm/i915/gvt/firmware.c | 26 +++++---------------- > .../intel/int340x_thermal/int3400_thermal.c | 9 +------- > fs/sysfs/file.c | 27 ++++++++++++++++++++++ > include/linux/sysfs.h | 15 ++++++++++++ > init/initramfs.c | 10 +------- > kernel/module/sysfs.c | 13 +---------- > 10 files changed, 56 insertions(+), 85 deletions(-) > > -- > 2.43.0 >