From: Greg KH <gregkh@linuxfoundation.org>
To: Lukas Wunner <lukas@wunner.de>
Cc: Alistair Francis <alistair23@gmail.com>,
bhelgaas@google.com, linux-pci@vger.kernel.org,
Jonathan.Cameron@huawei.com, alex.williamson@redhat.com,
christian.koenig@amd.com, kch@nvidia.com, logang@deltatee.com,
linux-kernel@vger.kernel.org,
Alistair Francis <alistair.francis@wdc.com>
Subject: Re: [PATCH v3] PCI/DOE: Expose the DOE protocols via sysfs
Date: Thu, 10 Aug 2023 09:48:50 +0200 [thread overview]
Message-ID: <2023081019-nuclei-drone-32de@gregkh> (raw)
In-Reply-To: <20230810074444.GA11861@wunner.de>
On Thu, Aug 10, 2023 at 09:44:44AM +0200, Lukas Wunner wrote:
> On Thu, Aug 10, 2023 at 07:05:12AM +0200, Greg KH wrote:
> > On Wed, Aug 09, 2023 at 07:28:51PM -0400, Alistair Francis wrote:
> > > v3:
> > > - Expose each DOE feature as a separate file
> >
> > But you don't actually have anything in the sysfs files, why not?
>
> He wants to expose a list of supported protocols.
>
> He first exposed the list in a single attribute, separated by newlines.
> Which made sense because it allows users to grep for a specific protocol.
>
> You told him not to expose multiple values in a single attribute.
> So he's exposing the available protocols each in an empty file.
> The file name contains the protocol.
>
> You got what you asked for. ;)
But that's not what was documented, it should say "empty file",
otherwise this is going to be very odd when people try to read a file
that is marked as readable, but yet returns an error :(
> > > --- a/drivers/pci/doe.c
> > > +++ b/drivers/pci/doe.c
> > > @@ -56,6 +56,10 @@ struct pci_doe_mb {
> > > wait_queue_head_t wq;
> > > struct workqueue_struct *work_queue;
> > > unsigned long flags;
> > > +
> > > +#ifdef CONFIG_SYSFS
> > > + struct device_attribute *sysfs_attrs;
> > > +#endif
> >
> > Please don't put #ifdefs in .c files if you can prevent it. I think
> > this will work just fine if you don't have the #ifdef. And who would be
> > using pci without sysfs?
>
> People with space-constrained devices such as routers.
So the extra pointer here is a real problem for them? And how much
memory are you saving?
> It is perfectly legal to compile a kernel with CONFIG_PCI=y and
> CONFIG_SYSFS=n.
Sure, just not common.
> And it is reasonable not to include code in the kernel which has
> specifically been deselected in the kernel config.
Sure, but not at the expense of a zillion #ifdef lines :)
thanks,
greg k-h
next prev parent reply other threads:[~2023-08-10 7:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 23:28 [PATCH v3] PCI/DOE: Expose the DOE protocols via sysfs Alistair Francis
2023-08-09 23:43 ` Randy Dunlap
2023-08-10 0:13 ` Chaitanya Kulkarni
2023-08-10 5:05 ` Greg KH
2023-08-10 7:44 ` Lukas Wunner
2023-08-10 7:48 ` Greg KH [this message]
2023-08-10 7:34 ` Lukas Wunner
2023-08-10 15:34 ` Alistair Francis
2023-08-12 8:15 ` Lukas Wunner
2023-08-12 8:26 ` Greg KH
2023-08-15 13:44 ` Alistair Francis
2023-08-15 15:11 ` Greg KH
2023-08-15 19:50 ` Alistair Francis
2023-08-15 20:10 ` Greg KH
2023-08-17 19:41 ` Alistair Francis
2023-08-17 20:21 ` Greg KH
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=2023081019-nuclei-drone-32de@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=alex.williamson@redhat.com \
--cc=alistair.francis@wdc.com \
--cc=alistair23@gmail.com \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=kch@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=lukas@wunner.de \
/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;
as well as URLs for NNTP newsgroup(s).