linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firewire: make fw_bus_type const
@ 2023-12-19 14:59 Greg Kroah-Hartman
  2023-12-20  0:48 ` Takashi Sakamoto
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kroah-Hartman @ 2023-12-19 14:59 UTC (permalink / raw)
  To: o-takashi; +Cc: linux-kernel, Greg Kroah-Hartman, linux1394-devel

Now that the driver core can properly handle constant struct bus_type,
move the fw_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: linux1394-devel@lists.sourceforge.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/firewire/core-device.c | 2 +-
 include/linux/firewire.h       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index aa597cda0d88..eeda7cc59e27 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -219,7 +219,7 @@ static int fw_unit_uevent(const struct device *dev, struct kobj_uevent_env *env)
 	return 0;
 }
 
-struct bus_type fw_bus_type = {
+const struct bus_type fw_bus_type = {
 	.name = "firewire",
 	.match = fw_unit_match,
 	.probe = fw_unit_probe,
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index bd3fc75d4f14..dd9f2d765e68 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -75,7 +75,7 @@ void fw_csr_iterator_init(struct fw_csr_iterator *ci, const u32 *p);
 int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value);
 int fw_csr_string(const u32 *directory, int key, char *buf, size_t size);
 
-extern struct bus_type fw_bus_type;
+extern const struct bus_type fw_bus_type;
 
 struct fw_card_driver;
 struct fw_node;
-- 
2.43.0


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

* Re: [PATCH] firewire: make fw_bus_type const
  2023-12-19 14:59 [PATCH] firewire: make fw_bus_type const Greg Kroah-Hartman
@ 2023-12-20  0:48 ` Takashi Sakamoto
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Sakamoto @ 2023-12-20  0:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux1394-devel

Hi Greg,

On Tue, Dec 19, 2023 at 03:59:32PM +0100, Greg Kroah-Hartman wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the fw_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
> 
> Cc: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> Cc: linux1394-devel@lists.sourceforge.net
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/firewire/core-device.c | 2 +-
>  include/linux/firewire.h       | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Thanks for the patch. I applied it to for-next[1], since the following
commits at v6.4 kernel have already allowed to keep it as constant (your
absolute work!).

* commit ad8685d0f61a ("driver core: bus: constify bus_unregister()")
* commit 00c4a3c47da7 ("driver core: bus: constantify bus_register()")
* commit d492cc2573a0 ("driver core: device.h: make struct bus_type a const *")

[1] https://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394.git/log/?h=for-next


Thanks

Takashi Sakamoto

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

end of thread, other threads:[~2023-12-20  0:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-19 14:59 [PATCH] firewire: make fw_bus_type const Greg Kroah-Hartman
2023-12-20  0:48 ` Takashi Sakamoto

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).