From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Lukas Wunner <lukas@wunner.de>,
"Rafael J. Wysocki" <rafael@kernel.org>,
linux-kernel@vger.kernel.org,
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: Re: [PATCH 2/2] treewide: Use sysfs_bin_attr_simple_read() helper
Date: Thu, 23 May 2024 08:51:49 +0200 [thread overview]
Message-ID: <2024052334-nape-wanting-0a2a@gregkh> (raw)
In-Reply-To: <e12b0027-b199-4de7-b83d-668171447ccc@roeck-us.net>
On Wed, May 22, 2024 at 07:51:35PM -0700, Guenter Roeck wrote:
> Hi,
>
> On Sat, Apr 06, 2024 at 03:52:02PM +0200, Lukas Wunner wrote:
> > Deduplicate ->read() callbacks of bin_attributes which are backed by a
> > simple buffer in memory:
> >
> > Use the newly introduced sysfs_bin_attr_simple_read() helper instead,
> > either by referencing it directly or by declaring such bin_attributes
> > with BIN_ATTR_SIMPLE_RO() or BIN_ATTR_SIMPLE_ADMIN_RO().
> >
> > Aside from a reduction of LoC, this shaves off a few bytes from vmlinux
> > (304 bytes on an x86_64 allyesconfig).
> >
> > No functional change intended.
> >
>
> Not really; see below.
>
> > Signed-off-by: Lukas Wunner <lukas@wunner.de>
> > Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
> > ---
> ...
> > index da79760..5193fae 100644
> > --- a/init/initramfs.c
> > +++ b/init/initramfs.c
> > @@ -575,15 +575,7 @@ static int __init initramfs_async_setup(char *str)
> > #include <linux/initrd.h>
> > #include <linux/kexec.h>
> >
> > -static ssize_t raw_read(struct file *file, struct kobject *kobj,
> > - struct bin_attribute *attr, char *buf,
> > - loff_t pos, size_t count)
> > -{
> > - memcpy(buf, attr->private + pos, count);
> > - return count;
> > -}
> > -
> > -static BIN_ATTR(initrd, 0440, raw_read, NULL, 0);
> > +static BIN_ATTR(initrd, 0440, sysfs_bin_attr_simple_read, NULL, 0);
> >
>
> sysfs_bin_attr_simple_read is only declared and available if CONFIG_SYSFS=y.
> With m68k:m5208evb_defconfig + CONFIG_BLK_DEV_INITRD=y, this results in
>
> /opt/buildbot/slave/qemu-m68k/build/init/initramfs.c:578:31:
> error: 'sysfs_bin_attr_simple_read' undeclared here (not in a function)
>
> This happens because CONFIG_SYSFS=n and there is no dummy function for
> sysfs_bin_attr_simple_read(). Presumably the problem will be seen for all
> configurations with CONFIG_BLK_DEV_INITRD=y and CONFIG_SYSFS=n.
Lukas, can you send a patch adding a dummy function?
thanks,
greg k-h
WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: intel-gvt-dev@lists.freedesktop.org,
Jean Delvare <jdelvare@suse.com>,
Zhi Wang <zhi.wang.linux@gmail.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
linux-efi@vger.kernel.org, linux-pm@vger.kernel.org,
Daniel Lezcano <daniel.lezcano@linaro.org>,
linux-kernel@vger.kernel.org,
Zhenyu Wang <zhenyuw@linux.intel.com>,
linux-acpi@vger.kernel.org, Luis Chamberlain <mcgrof@kernel.org>,
Lukas Wunner <lukas@wunner.de>,
linuxppc-dev@lists.ozlabs.org, Ard Biesheuvel <ardb@kernel.org>,
linux-modules@vger.kernel.org
Subject: Re: [PATCH 2/2] treewide: Use sysfs_bin_attr_simple_read() helper
Date: Thu, 23 May 2024 08:51:49 +0200 [thread overview]
Message-ID: <2024052334-nape-wanting-0a2a@gregkh> (raw)
In-Reply-To: <e12b0027-b199-4de7-b83d-668171447ccc@roeck-us.net>
On Wed, May 22, 2024 at 07:51:35PM -0700, Guenter Roeck wrote:
> Hi,
>
> On Sat, Apr 06, 2024 at 03:52:02PM +0200, Lukas Wunner wrote:
> > Deduplicate ->read() callbacks of bin_attributes which are backed by a
> > simple buffer in memory:
> >
> > Use the newly introduced sysfs_bin_attr_simple_read() helper instead,
> > either by referencing it directly or by declaring such bin_attributes
> > with BIN_ATTR_SIMPLE_RO() or BIN_ATTR_SIMPLE_ADMIN_RO().
> >
> > Aside from a reduction of LoC, this shaves off a few bytes from vmlinux
> > (304 bytes on an x86_64 allyesconfig).
> >
> > No functional change intended.
> >
>
> Not really; see below.
>
> > Signed-off-by: Lukas Wunner <lukas@wunner.de>
> > Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
> > ---
> ...
> > index da79760..5193fae 100644
> > --- a/init/initramfs.c
> > +++ b/init/initramfs.c
> > @@ -575,15 +575,7 @@ static int __init initramfs_async_setup(char *str)
> > #include <linux/initrd.h>
> > #include <linux/kexec.h>
> >
> > -static ssize_t raw_read(struct file *file, struct kobject *kobj,
> > - struct bin_attribute *attr, char *buf,
> > - loff_t pos, size_t count)
> > -{
> > - memcpy(buf, attr->private + pos, count);
> > - return count;
> > -}
> > -
> > -static BIN_ATTR(initrd, 0440, raw_read, NULL, 0);
> > +static BIN_ATTR(initrd, 0440, sysfs_bin_attr_simple_read, NULL, 0);
> >
>
> sysfs_bin_attr_simple_read is only declared and available if CONFIG_SYSFS=y.
> With m68k:m5208evb_defconfig + CONFIG_BLK_DEV_INITRD=y, this results in
>
> /opt/buildbot/slave/qemu-m68k/build/init/initramfs.c:578:31:
> error: 'sysfs_bin_attr_simple_read' undeclared here (not in a function)
>
> This happens because CONFIG_SYSFS=n and there is no dummy function for
> sysfs_bin_attr_simple_read(). Presumably the problem will be seen for all
> configurations with CONFIG_BLK_DEV_INITRD=y and CONFIG_SYSFS=n.
Lukas, can you send a patch adding a dummy function?
thanks,
greg k-h
next prev parent reply other threads:[~2024-05-23 6:51 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-06 13:52 [PATCH 0/2] Deduplicate bin_attribute simple read() callbacks Lukas Wunner
2024-04-06 13:52 ` 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 [this message]
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=2024052334-nape-wanting-0a2a@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=ardb@kernel.org \
--cc=daniel.lezcano@linaro.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=linux@roeck-us.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lukas@wunner.de \
--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.