[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230313191447.GA1528028@bhelgaas>
Date: Mon, 13 Mar 2023 14:14:47 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, rafael@...nel.org,
"David S. Miller" <davem@...emloft.net>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Alex Shi <alexs@...nel.org>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Alexandre Bounine <alex.bou9@...il.com>,
Alison Schofield <alison.schofield@...el.com>,
Ben Widawsky <bwidawsk@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Dan Williams <dan.j.williams@...el.com>,
Dexuan Cui <decui@...rosoft.com>,
Eric Dumazet <edumazet@...gle.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Hannes Reinecke <hare@...e.de>,
Harald Freudenberger <freude@...ux.ibm.com>,
Heiko Carstens <hca@...ux.ibm.com>,
Hu Haowen <src.res@...il.cn>,
Ilya Dryomov <idryomov@...il.com>,
Ira Weiny <ira.weiny@...el.com>,
Iwona Winiarska <iwona.winiarska@...el.com>,
Jakub Kicinski <kuba@...nel.org>, Jens Axboe <axboe@...nel.dk>,
Jonathan Corbet <corbet@....net>,
Laurentiu Tudor <laurentiu.tudor@....com>,
Matt Porter <mporter@...nel.crashing.org>,
Michael Ellerman <mpe@...erman.id.au>,
Paolo Abeni <pabeni@...hat.com>,
Stuart Yoder <stuyoder@...il.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Wei Liu <wei.liu@...nel.org>,
Yanteng Si <siyanteng@...ngson.cn>
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@...emloft.net>
> Cc: "James E.J. Bottomley" <jejb@...ux.ibm.com>
> Cc: "K. Y. Srinivasan" <kys@...rosoft.com>
> Cc: "Martin K. Petersen" <martin.petersen@...cle.com>
> Cc: Alex Shi <alexs@...nel.org>
> Cc: Alexander Gordeev <agordeev@...ux.ibm.com>
> Cc: Alexandre Bounine <alex.bou9@...il.com>
> Cc: Alison Schofield <alison.schofield@...el.com>
> Cc: Ben Widawsky <bwidawsk@...nel.org>
> Cc: Bjorn Helgaas <bhelgaas@...gle.com>
> Cc: Dan Williams <dan.j.williams@...el.com>
> Cc: Dexuan Cui <decui@...rosoft.com>
> Cc: Eric Dumazet <edumazet@...gle.com>
> Cc: Haiyang Zhang <haiyangz@...rosoft.com>
> Cc: Hannes Reinecke <hare@...e.de>
> Cc: Harald Freudenberger <freude@...ux.ibm.com>
> Cc: Heiko Carstens <hca@...ux.ibm.com>
> Cc: Hu Haowen <src.res@...il.cn>
> Cc: Ilya Dryomov <idryomov@...il.com>
> Cc: Ira Weiny <ira.weiny@...el.com>
> Cc: Iwona Winiarska <iwona.winiarska@...el.com>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: Jens Axboe <axboe@...nel.dk>
> Cc: Jonathan Corbet <corbet@....net>
> Cc: Laurentiu Tudor <laurentiu.tudor@....com>
> Cc: Matt Porter <mporter@...nel.crashing.org>
> Cc: Michael Ellerman <mpe@...erman.id.au>
> Cc: Paolo Abeni <pabeni@...hat.com>
> Cc: Stuart Yoder <stuyoder@...il.com>
> Cc: Vasily Gorbik <gor@...ux.ibm.com>
> Cc: Vishal Verma <vishal.l.verma@...el.com>
> Cc: Wei Liu <wei.liu@...nel.org>
> Cc: Yanteng Si <siyanteng@...ngson.cn>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Acked-by: Bjorn Helgaas <bhelgaas@...gle.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;
Powered by blists - more mailing lists