All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-kernel@vger.kernel.org
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org,
	Jean Delvare <jdelvare@suse.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-efi@vger.kernel.org, Zhenyu Wang <zhenyuw@linux.intel.com>,
	Zhi Wang <zhi.wang.linux@gmail.com>,
	intel-gvt-dev@lists.freedesktop.org,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	linux-pm@vger.kernel.org, Luis Chamberlain <mcgrof@kernel.org>,
	linux-modules@vger.kernel.org
Subject: [PATCH 0/2] Deduplicate bin_attribute simple read() callbacks
Date: Sat, 6 Apr 2024 15:52:00 +0200	[thread overview]
Message-ID: <cover.1712410202.git.lukas@wunner.de> (raw)

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

 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


WARNING: multiple messages have this Message-ID (diff)
From: Lukas Wunner <lukas@wunner.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-kernel@vger.kernel.org
Cc: intel-gvt-dev@lists.freedesktop.org, linux-efi@vger.kernel.org,
	Zhi Wang <zhi.wang.linux@gmail.com>,
	linux-pm@vger.kernel.org,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Zhenyu Wang <zhenyuw@linux.intel.com>,
	linux-acpi@vger.kernel.org, Luis Chamberlain <mcgrof@kernel.org>,
	Jean Delvare <jdelvare@suse.com>,
	linuxppc-dev@lists.ozlabs.org, Ard Biesheuvel <ardb@kernel.org>,
	linux-modules@vger.kernel.org
Subject: [PATCH 0/2] Deduplicate bin_attribute simple read() callbacks
Date: Sat, 6 Apr 2024 15:52:00 +0200	[thread overview]
Message-ID: <cover.1712410202.git.lukas@wunner.de> (raw)

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

 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


             reply	other threads:[~2024-04-06 13:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-06 13:52 Lukas Wunner [this message]
2024-04-06 13:52 ` [PATCH 0/2] Deduplicate bin_attribute simple read() callbacks Lukas Wunner
2024-04-06 13:52 ` [PATCH 1/2] sysfs: Add sysfs_bin_attr_simple_read() helper Lukas Wunner
2024-04-06 13:52   ` Lukas Wunner
2024-04-11 13:07   ` Greg Kroah-Hartman
2024-04-11 13:07     ` Greg Kroah-Hartman
2024-04-06 13:52 ` [PATCH 2/2] treewide: Use " Lukas Wunner
2024-04-06 13:52   ` Lukas Wunner
2024-04-08 10:42   ` Zhi Wang
2024-04-08 10:42     ` Zhi Wang
2024-04-08 11:11   ` Michael Ellerman
2024-04-08 11:11     ` Michael Ellerman
2024-05-23  2:51   ` Guenter Roeck
2024-05-23  2:51     ` Guenter Roeck
2024-05-23  6:51     ` Greg Kroah-Hartman
2024-05-23  6:51       ` Greg Kroah-Hartman
2024-05-23 11:00       ` [PATCH] sysfs: Unbreak the build around sysfs_bin_attr_simple_read() Lukas Wunner
2024-05-23 11:00         ` Lukas Wunner
2024-05-23 11:13         ` Rafael J. Wysocki
2024-05-23 11:13           ` Rafael J. Wysocki
2024-05-23 14:23         ` Guenter Roeck
2024-05-23 14:23           ` Guenter Roeck
2024-04-08  8:42 ` [PATCH 0/2] Deduplicate bin_attribute simple read() callbacks Ard Biesheuvel
2024-04-08  8:42   ` Ard Biesheuvel
2024-04-08 15:01 ` Rafael J. Wysocki
2024-04-08 15:01   ` Rafael J. Wysocki
2024-04-11 13:07 ` Greg Kroah-Hartman
2024-04-11 13:07   ` Greg Kroah-Hartman
2024-04-11 13:39   ` Lukas Wunner
2024-04-11 13:39     ` Lukas Wunner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1712410202.git.lukas@wunner.de \
    --to=lukas@wunner.de \
    --cc=ardb@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jdelvare@suse.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mcgrof@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=rafael@kernel.org \
    --cc=zhenyuw@linux.intel.com \
    --cc=zhi.wang.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.