public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: bus: make acpi_bus_type const
@ 2024-02-11 15:37 Ricardo B. Marliere
  2024-02-12 10:44 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Ricardo B. Marliere @ 2024-02-11 15:37 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown, Robert Moore
  Cc: linux-acpi, linux-kernel, acpica-devel, Greg Kroah-Hartman,
	Ricardo B. Marliere

Now that the driver core can properly handle constant struct bus_type,
move the acpi_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/acpi/bus.c      | 2 +-
 include/acpi/acpi_bus.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 569bd15f211b..d9fa730416f1 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1097,7 +1097,7 @@ static void acpi_device_remove(struct device *dev)
 	put_device(dev);
 }
 
-struct bus_type acpi_bus_type = {
+const struct bus_type acpi_bus_type = {
 	.name		= "acpi",
 	.match		= acpi_bus_match,
 	.probe		= acpi_device_probe,
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index e4d24d3f9abb..f67aa93ba53e 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -582,7 +582,7 @@ void acpi_initialize_hp_context(struct acpi_device *adev,
 				void (*uevent)(struct acpi_device *, u32));
 
 /* acpi_device.dev.bus == &acpi_bus_type */
-extern struct bus_type acpi_bus_type;
+extern const struct bus_type acpi_bus_type;
 
 int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data);
 int acpi_dev_for_each_child(struct acpi_device *adev,

---
base-commit: c3c4923f2082353762e8f46dec6e3b0f165a1606
change-id: 20240211-bus_cleanup-acpi-7ad5cc04089c

Best regards,
-- 
Ricardo B. Marliere <ricardo@marliere.net>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI: bus: make acpi_bus_type const
  2024-02-11 15:37 [PATCH] ACPI: bus: make acpi_bus_type const Ricardo B. Marliere
@ 2024-02-12 10:44 ` Greg Kroah-Hartman
  2024-02-12 13:44   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2024-02-12 10:44 UTC (permalink / raw)
  To: Ricardo B. Marliere
  Cc: Rafael J. Wysocki, Len Brown, Robert Moore, linux-acpi,
	linux-kernel, acpica-devel

On Sun, Feb 11, 2024 at 12:37:11PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the acpi_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>

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI: bus: make acpi_bus_type const
  2024-02-12 10:44 ` Greg Kroah-Hartman
@ 2024-02-12 13:44   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2024-02-12 13:44 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Ricardo B. Marliere
  Cc: Rafael J. Wysocki, Len Brown, Robert Moore, linux-acpi,
	linux-kernel, acpica-devel

On Mon, Feb 12, 2024 at 11:44 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Sun, Feb 11, 2024 at 12:37:11PM -0300, Ricardo B. Marliere wrote:
> > Now that the driver core can properly handle constant struct bus_type,
> > move the acpi_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>
>
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Applied as 6.9 material, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-12 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-11 15:37 [PATCH] ACPI: bus: make acpi_bus_type const Ricardo B. Marliere
2024-02-12 10:44 ` Greg Kroah-Hartman
2024-02-12 13:44   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox