2024-02-14 19:28:07

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 0/2] ALSA: struct bus_type cleanup

This series is part of an effort to cleanup the users of the driver
core, as can be seen in many recent patches authored by Greg across the
tree (e.g. [1]).

---
[1]: https://lore.kernel.org/lkml/?q=f%3Agregkh%40linuxfoundation.org+s%3A%22make%22+and+s%3A%22const%22

To: Johannes Berg <[email protected]>
To: Jaroslav Kysela <[email protected]>
To: Takashi Iwai <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>

---
Ricardo B. Marliere (2):
ALSA: aoa: make soundbus_bus_type const
ALSA: seq: make snd_seq_bus_type const

sound/aoa/soundbus/core.c | 2 +-
sound/core/seq_device.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
base-commit: d7bf73809849463f76de42aad62c850305dd6c5d
change-id: 20240214-bus_cleanup-alsa-1d05ffc6507b

Best regards,
--
Ricardo B. Marliere <[email protected]>



2024-02-14 19:28:21

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 1/2] ALSA: aoa: make soundbus_bus_type const

Since commit d492cc2573a0 ("driver core: device.h: make struct
bus_type a const *"), the driver core can properly handle constant
struct bus_type, move the soundbus_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 <[email protected]>
Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
---
sound/aoa/soundbus/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/aoa/soundbus/core.c b/sound/aoa/soundbus/core.c
index 8f24a3eea16b..2a295f610594 100644
--- a/sound/aoa/soundbus/core.c
+++ b/sound/aoa/soundbus/core.c
@@ -127,7 +127,7 @@ static void soundbus_device_shutdown(struct device *dev)

/* soundbus_dev_attrs is declared in sysfs.c */
ATTRIBUTE_GROUPS(soundbus_dev);
-static struct bus_type soundbus_bus_type = {
+static const struct bus_type soundbus_bus_type = {
.name = "aoa-soundbus",
.probe = soundbus_probe,
.uevent = soundbus_uevent,

--
2.43.0


2024-02-14 20:04:26

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH 2/2] ALSA: seq: make snd_seq_bus_type const

Since commit d492cc2573a0 ("driver core: device.h: make struct
bus_type a const *"), the driver core can properly handle constant
struct bus_type, move the snd_seq_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 <[email protected]>
Suggested-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
---
sound/core/seq_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/seq_device.c b/sound/core/seq_device.c
index 7f3fd8eb016f..654d620d0199 100644
--- a/sound/core/seq_device.c
+++ b/sound/core/seq_device.c
@@ -49,7 +49,7 @@ static int snd_seq_bus_match(struct device *dev, struct device_driver *drv)
sdrv->argsize == sdev->argsize;
}

-static struct bus_type snd_seq_bus_type = {
+static const struct bus_type snd_seq_bus_type = {
.name = "snd_seq",
.match = snd_seq_bus_match,
};

--
2.43.0


2024-02-15 07:48:57

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 0/2] ALSA: struct bus_type cleanup

On Wed, Feb 14, 2024 at 04:28:27PM -0300, Ricardo B. Marliere wrote:
> This series is part of an effort to cleanup the users of the driver
> core, as can be seen in many recent patches authored by Greg across the
> tree (e.g. [1]).
>
> ---
> [1]: https://lore.kernel.org/lkml/?q=f%3Agregkh%40linuxfoundation.org+s%3A%22make%22+and+s%3A%22const%22
>
> To: Johannes Berg <[email protected]>
> To: Jaroslav Kysela <[email protected]>
> To: Takashi Iwai <[email protected]>
> Cc: <[email protected]>
> Cc: <[email protected]>
> Cc: <[email protected]>
> Cc: <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>
> Signed-off-by: Ricardo B. Marliere <[email protected]>

Reviewed-by: Greg Kroah-Hartman <[email protected]>

2024-02-15 12:49:17

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH 0/2] ALSA: struct bus_type cleanup

On Wed, 14 Feb 2024 20:28:27 +0100,
Ricardo B. Marliere wrote:
>
> This series is part of an effort to cleanup the users of the driver
> core, as can be seen in many recent patches authored by Greg across the
> tree (e.g. [1]).
>
> ---
> [1]: https://lore.kernel.org/lkml/?q=f%3Agregkh%40linuxfoundation.org+s%3A%22make%22+and+s%3A%22const%22
>
> To: Johannes Berg <[email protected]>
> To: Jaroslav Kysela <[email protected]>
> To: Takashi Iwai <[email protected]>
> Cc: <[email protected]>
> Cc: <[email protected]>
> Cc: <[email protected]>
> Cc: <[email protected]>
> Cc: Greg Kroah-Hartman <[email protected]>
> Signed-off-by: Ricardo B. Marliere <[email protected]>
>
> ---
> Ricardo B. Marliere (2):
> ALSA: aoa: make soundbus_bus_type const
> ALSA: seq: make snd_seq_bus_type const

Applied both patches now. Thanks.


Takashi