Messages in this thread | | | Date | Mon, 13 Mar 2023 14:14:47 -0500 | From | Bjorn Helgaas <> | Subject | Re: [PATCH 23/36] driver core: bus: mark the struct bus_type for sysfs callbacks as constant |
| |
On Mon, Mar 13, 2023 at 07:29:05PM +0100, Greg Kroah-Hartman wrote: > struct bus_type should never be modified in a sysfs callback as there is > nothing in the structure to modify, and frankly, the structure is almost > never used in a sysfs callback, so mark it as constant to allow struct > bus_type to be moved to read-only memory. > > Cc: "David S. Miller" <davem@davemloft.net> > Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> > Cc: "K. Y. Srinivasan" <kys@microsoft.com> > Cc: "Martin K. Petersen" <martin.petersen@oracle.com> > Cc: Alex Shi <alexs@kernel.org> > Cc: Alexander Gordeev <agordeev@linux.ibm.com> > Cc: Alexandre Bounine <alex.bou9@gmail.com> > Cc: Alison Schofield <alison.schofield@intel.com> > Cc: Ben Widawsky <bwidawsk@kernel.org> > Cc: Bjorn Helgaas <bhelgaas@google.com> > Cc: Dan Williams <dan.j.williams@intel.com> > Cc: Dexuan Cui <decui@microsoft.com> > Cc: Eric Dumazet <edumazet@google.com> > Cc: Haiyang Zhang <haiyangz@microsoft.com> > Cc: Hannes Reinecke <hare@suse.de> > Cc: Harald Freudenberger <freude@linux.ibm.com> > Cc: Heiko Carstens <hca@linux.ibm.com> > Cc: Hu Haowen <src.res@email.cn> > Cc: Ilya Dryomov <idryomov@gmail.com> > Cc: Ira Weiny <ira.weiny@intel.com> > Cc: Iwona Winiarska <iwona.winiarska@intel.com> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: Jens Axboe <axboe@kernel.dk> > Cc: Jonathan Corbet <corbet@lwn.net> > Cc: Laurentiu Tudor <laurentiu.tudor@nxp.com> > Cc: Matt Porter <mporter@kernel.crashing.org> > Cc: Michael Ellerman <mpe@ellerman.id.au> > Cc: Paolo Abeni <pabeni@redhat.com> > Cc: Stuart Yoder <stuyoder@gmail.com> > Cc: Vasily Gorbik <gor@linux.ibm.com> > Cc: Vishal Verma <vishal.l.verma@intel.com> > Cc: Wei Liu <wei.liu@kernel.org> > Cc: Yanteng Si <siyanteng@loongson.cn> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com> # pci
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c > index dd0d9d9bc509..ab32a91f287b 100644 > --- a/drivers/pci/pci-sysfs.c > +++ b/drivers/pci/pci-sysfs.c > @@ -428,7 +428,7 @@ static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr, > } > static DEVICE_ATTR_RW(msi_bus); > > -static ssize_t rescan_store(struct bus_type *bus, const char *buf, size_t count) > +static ssize_t rescan_store(const struct bus_type *bus, const char *buf, size_t count) > { > unsigned long val; > struct pci_bus *b = NULL; > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index 7a67611dc5f4..45c3bb039f21 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -6679,7 +6679,7 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev) > } > } > > -static ssize_t resource_alignment_show(struct bus_type *bus, char *buf) > +static ssize_t resource_alignment_show(const struct bus_type *bus, char *buf) > { > size_t count = 0; > > @@ -6691,7 +6691,7 @@ static ssize_t resource_alignment_show(struct bus_type *bus, char *buf) > return count; > } > > -static ssize_t resource_alignment_store(struct bus_type *bus, > +static ssize_t resource_alignment_store(const struct bus_type *bus, > const char *buf, size_t count) > { > char *param, *old, *end;
| |