From: Armin Wolf <W_Armin@gmx.de>
To: "Thomas Weißschuh" <linux@weissschuh.net>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Christophe Leroy" <christophe.leroy@csgroup.eu>,
"Naveen N Rao" <naveen@kernel.org>,
"Madhavan Srinivasan" <maddy@linux.ibm.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Luis Chamberlain" <mcgrof@kernel.org>,
"Petr Pavlu" <petr.pavlu@suse.com>,
"Sami Tolvanen" <samitolvanen@google.com>,
"Daniel Gomez" <da.gomez@samsung.com>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"John Fastabend" <john.fastabend@gmail.com>,
"KP Singh" <kpsingh@kernel.org>,
"Stanislav Fomichev" <sdf@fomichev.me>,
"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linux-modules@vger.kernel.org,
platform-driver-x86@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH 2/4] platform/x86: wmi-bmof: Switch to sysfs_bin_attr_simple_read()
Date: Fri, 13 Dec 2024 01:21:37 +0100 [thread overview]
Message-ID: <2fbf5d9d-8cfe-4ce4-a268-ec84c261d1bd@gmx.de> (raw)
In-Reply-To: <20241205-sysfs-const-bin_attr-simple-v1-2-4a4e4ced71e3@weissschuh.net>
Am 05.12.24 um 18:35 schrieb Thomas Weißschuh:
> The generic function from the sysfs core can replace the custom one.
Sorry for taking quite a bit to respond, i totally overlooked this patch.
This patch is superseded by a patch of mine: https://lore.kernel.org/platform-driver-x86/20241206215650.2977-1-W_Armin@gmx.de/
This reworks the binary attribute handling inside the driver to use the new .bin_size() callback. This allows the
driver to have a static binary attribute which does not need a memory allocation.
Because i think we cannot use sysfs_bin_attr_simple_read() anymore. So maybe you can just drop this patch?
Thanks,
Armin Wolf
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> drivers/platform/x86/wmi-bmof.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/platform/x86/wmi-bmof.c b/drivers/platform/x86/wmi-bmof.c
> index df6f0ae6e6c7904f97c125297a21166f56d0b1f0..e6c217d70086a2896dc70cf8ac1c27dafb501a95 100644
> --- a/drivers/platform/x86/wmi-bmof.c
> +++ b/drivers/platform/x86/wmi-bmof.c
> @@ -25,15 +25,6 @@ struct bmof_priv {
> struct bin_attribute bmof_bin_attr;
> };
>
> -static ssize_t read_bmof(struct file *filp, struct kobject *kobj, struct bin_attribute *attr,
> - char *buf, loff_t off, size_t count)
> -{
> - struct bmof_priv *priv = container_of(attr, struct bmof_priv, bmof_bin_attr);
> -
> - return memory_read_from_buffer(buf, count, &off, priv->bmofdata->buffer.pointer,
> - priv->bmofdata->buffer.length);
> -}
> -
> static int wmi_bmof_probe(struct wmi_device *wdev, const void *context)
> {
> struct bmof_priv *priv;
> @@ -60,7 +51,8 @@ static int wmi_bmof_probe(struct wmi_device *wdev, const void *context)
> sysfs_bin_attr_init(&priv->bmof_bin_attr);
> priv->bmof_bin_attr.attr.name = "bmof";
> priv->bmof_bin_attr.attr.mode = 0400;
> - priv->bmof_bin_attr.read = read_bmof;
> + priv->bmof_bin_attr.read_new = sysfs_bin_attr_simple_read;
> + priv->bmof_bin_attr.private = priv->bmofdata->buffer.pointer;
> priv->bmof_bin_attr.size = priv->bmofdata->buffer.length;
>
> ret = device_create_bin_file(&wdev->dev, &priv->bmof_bin_attr);
>
next prev parent reply other threads:[~2024-12-13 0:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 17:35 [PATCH 0/4] sysfs: constify bin_attribute argument of sysfs_bin_attr_simple_read() Thomas Weißschuh
2024-12-05 17:35 ` [PATCH 1/4] " Thomas Weißschuh
2024-12-05 17:35 ` [PATCH 2/4] platform/x86: wmi-bmof: Switch to sysfs_bin_attr_simple_read() Thomas Weißschuh
2024-12-13 0:21 ` Armin Wolf [this message]
2024-12-13 7:43 ` Thomas Weißschuh
2024-12-05 17:35 ` [PATCH 3/4] btf: Switch vmlinux BTF attribute " Thomas Weißschuh
2024-12-09 17:43 ` Andrii Nakryiko
2024-12-05 17:35 ` [PATCH 4/4] btf: Switch module " Thomas Weißschuh
2024-12-09 17:45 ` Andrii Nakryiko
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=2fbf5d9d-8cfe-4ce4-a268-ec84c261d1bd@gmx.de \
--to=w_armin@gmx.de \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=da.gomez@samsung.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=haoluo@google.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=martin.lau@linux.dev \
--cc=mcgrof@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=npiggin@gmail.com \
--cc=petr.pavlu@suse.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=samitolvanen@google.com \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®