* [PATCH] PCI: make pcie_port_bus_type const
@ 2024-02-08 19:41 Ricardo B. Marliere
2024-02-08 21:00 ` Bjorn Helgaas
2024-02-09 19:53 ` Kuppuswamy Sathyanarayanan
0 siblings, 2 replies; 4+ messages in thread
From: Ricardo B. Marliere @ 2024-02-08 19:41 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, linux-kernel, Greg Kroah-Hartman, Ricardo B. Marliere
Now that the driver core can properly handle constant struct bus_type,
move the pcie_port_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
---
drivers/pci/pci-driver.c | 2 +-
drivers/pci/pcie/portdrv.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index ec838f2e892e..a29098e24683 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1705,7 +1705,7 @@ static int pcie_port_bus_match(struct device *dev, struct device_driver *drv)
return 1;
}
-struct bus_type pcie_port_bus_type = {
+const struct bus_type pcie_port_bus_type = {
.name = "pci_express",
.match = pcie_port_bus_match,
};
diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h
index 1f3803bde7ee..12c89ea0313b 100644
--- a/drivers/pci/pcie/portdrv.h
+++ b/drivers/pci/pcie/portdrv.h
@@ -96,7 +96,7 @@ struct pcie_port_service_driver {
int pcie_port_service_register(struct pcie_port_service_driver *new);
void pcie_port_service_unregister(struct pcie_port_service_driver *new);
-extern struct bus_type pcie_port_bus_type;
+extern const struct bus_type pcie_port_bus_type;
struct pci_dev;
---
base-commit: cc24b2d080dca2ce1c89a8a71c00bdf21155f357
change-id: 20240208-bus_cleanup-pci2-61fe9c495d08
Best regards,
--
Ricardo B. Marliere <ricardo@marliere.net>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI: make pcie_port_bus_type const
2024-02-08 19:41 [PATCH] PCI: make pcie_port_bus_type const Ricardo B. Marliere
@ 2024-02-08 21:00 ` Bjorn Helgaas
2024-02-09 9:42 ` Ricardo B. Marliere
2024-02-09 19:53 ` Kuppuswamy Sathyanarayanan
1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2024-02-08 21:00 UTC (permalink / raw)
To: Ricardo B. Marliere
Cc: Bjorn Helgaas, linux-pci, linux-kernel, Greg Kroah-Hartman
On Thu, Feb 08, 2024 at 04:41:46PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the pcie_port_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Applied to pci/misc for v6.9, thanks!
Subject line adjusted to:
PCI: Make pcie_port_bus_type const
to match history.
> ---
> drivers/pci/pci-driver.c | 2 +-
> drivers/pci/pcie/portdrv.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index ec838f2e892e..a29098e24683 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -1705,7 +1705,7 @@ static int pcie_port_bus_match(struct device *dev, struct device_driver *drv)
> return 1;
> }
>
> -struct bus_type pcie_port_bus_type = {
> +const struct bus_type pcie_port_bus_type = {
> .name = "pci_express",
> .match = pcie_port_bus_match,
> };
> diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h
> index 1f3803bde7ee..12c89ea0313b 100644
> --- a/drivers/pci/pcie/portdrv.h
> +++ b/drivers/pci/pcie/portdrv.h
> @@ -96,7 +96,7 @@ struct pcie_port_service_driver {
> int pcie_port_service_register(struct pcie_port_service_driver *new);
> void pcie_port_service_unregister(struct pcie_port_service_driver *new);
>
> -extern struct bus_type pcie_port_bus_type;
> +extern const struct bus_type pcie_port_bus_type;
>
> struct pci_dev;
>
>
> ---
> base-commit: cc24b2d080dca2ce1c89a8a71c00bdf21155f357
> change-id: 20240208-bus_cleanup-pci2-61fe9c495d08
>
> Best regards,
> --
> Ricardo B. Marliere <ricardo@marliere.net>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI: make pcie_port_bus_type const
2024-02-08 21:00 ` Bjorn Helgaas
@ 2024-02-09 9:42 ` Ricardo B. Marliere
0 siblings, 0 replies; 4+ messages in thread
From: Ricardo B. Marliere @ 2024-02-09 9:42 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Bjorn Helgaas, linux-pci, linux-kernel, Greg Kroah-Hartman
Hi Bjorn,
On 8 Feb 15:00, Bjorn Helgaas wrote:
> On Thu, Feb 08, 2024 at 04:41:46PM -0300, Ricardo B. Marliere wrote:
> > Now that the driver core can properly handle constant struct bus_type,
> > move the pcie_port_bus_type variable to be a constant structure as well,
> > placing it into read-only memory which can not be modified at runtime.
> >
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
>
> Applied to pci/misc for v6.9, thanks!
>
> Subject line adjusted to:
>
> PCI: Make pcie_port_bus_type const
>
> to match history.
Noted, thanks!
- Ricardo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PCI: make pcie_port_bus_type const
2024-02-08 19:41 [PATCH] PCI: make pcie_port_bus_type const Ricardo B. Marliere
2024-02-08 21:00 ` Bjorn Helgaas
@ 2024-02-09 19:53 ` Kuppuswamy Sathyanarayanan
1 sibling, 0 replies; 4+ messages in thread
From: Kuppuswamy Sathyanarayanan @ 2024-02-09 19:53 UTC (permalink / raw)
To: Ricardo B. Marliere, Bjorn Helgaas
Cc: linux-pci, linux-kernel, Greg Kroah-Hartman
On 2/8/24 11:41 AM, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the pcie_port_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> ---
Looks fine to me.
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
> drivers/pci/pci-driver.c | 2 +-
> drivers/pci/pcie/portdrv.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index ec838f2e892e..a29098e24683 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -1705,7 +1705,7 @@ static int pcie_port_bus_match(struct device *dev, struct device_driver *drv)
> return 1;
> }
>
> -struct bus_type pcie_port_bus_type = {
> +const struct bus_type pcie_port_bus_type = {
> .name = "pci_express",
> .match = pcie_port_bus_match,
> };
> diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h
> index 1f3803bde7ee..12c89ea0313b 100644
> --- a/drivers/pci/pcie/portdrv.h
> +++ b/drivers/pci/pcie/portdrv.h
> @@ -96,7 +96,7 @@ struct pcie_port_service_driver {
> int pcie_port_service_register(struct pcie_port_service_driver *new);
> void pcie_port_service_unregister(struct pcie_port_service_driver *new);
>
> -extern struct bus_type pcie_port_bus_type;
> +extern const struct bus_type pcie_port_bus_type;
>
> struct pci_dev;
>
>
> ---
> base-commit: cc24b2d080dca2ce1c89a8a71c00bdf21155f357
> change-id: 20240208-bus_cleanup-pci2-61fe9c495d08
>
> Best regards,
--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-09 19:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-08 19:41 [PATCH] PCI: make pcie_port_bus_type const Ricardo B. Marliere
2024-02-08 21:00 ` Bjorn Helgaas
2024-02-09 9:42 ` Ricardo B. Marliere
2024-02-09 19:53 ` Kuppuswamy Sathyanarayanan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox