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
Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
---
Ricardo B. Marliere (2):
firmware: arm_ffa: Make ffa_bus_type const
firmware: arm_scmi: make scmi_bus_type const
drivers/firmware/arm_ffa/bus.c | 2 +-
drivers/firmware/arm_scmi/bus.c | 2 +-
drivers/firmware/arm_scmi/common.h | 2 +-
include/linux/arm_ffa.h | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
---
base-commit: 047371968ffc470769f541d6933e262dc7085456
change-id: 20240211-bus_cleanup-firmware2-f5a633107921
Best regards,
--
Ricardo B. Marliere <[email protected]>
Now that the driver core can properly handle constant struct bus_type,
move the ffa_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]>
---
drivers/firmware/arm_ffa/bus.c | 2 +-
include/linux/arm_ffa.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c
index 1c7940ba5539..2f557e90f2eb 100644
--- a/drivers/firmware/arm_ffa/bus.c
+++ b/drivers/firmware/arm_ffa/bus.c
@@ -105,7 +105,7 @@ static struct attribute *ffa_device_attributes_attrs[] = {
};
ATTRIBUTE_GROUPS(ffa_device_attributes);
-struct bus_type ffa_bus_type = {
+const struct bus_type ffa_bus_type = {
.name = "arm_ffa",
.match = ffa_device_match,
.probe = ffa_device_probe,
diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h
index 3d0fde57ba90..c906f666ff5d 100644
--- a/include/linux/arm_ffa.h
+++ b/include/linux/arm_ffa.h
@@ -209,7 +209,7 @@ bool ffa_device_is_valid(struct ffa_device *ffa_dev) { return false; }
#define module_ffa_driver(__ffa_driver) \
module_driver(__ffa_driver, ffa_register, ffa_unregister)
-extern struct bus_type ffa_bus_type;
+extern const struct bus_type ffa_bus_type;
/* FFA transport related */
struct ffa_partition_info {
--
2.43.0
Now that the driver core can properly handle constant struct bus_type,
move the scmi_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]>
---
drivers/firmware/arm_scmi/bus.c | 2 +-
drivers/firmware/arm_scmi/common.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
index c15928b8c5cc..609a6496c1d4 100644
--- a/drivers/firmware/arm_scmi/bus.c
+++ b/drivers/firmware/arm_scmi/bus.c
@@ -263,7 +263,7 @@ static void scmi_dev_remove(struct device *dev)
scmi_drv->remove(scmi_dev);
}
-struct bus_type scmi_bus_type = {
+const struct bus_type scmi_bus_type = {
.name = "scmi_protocol",
.match = scmi_dev_match,
.probe = scmi_dev_probe,
diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h
index 00b165d1f502..6affbfdd1dec 100644
--- a/drivers/firmware/arm_scmi/common.h
+++ b/drivers/firmware/arm_scmi/common.h
@@ -141,7 +141,7 @@ scmi_revision_area_get(const struct scmi_protocol_handle *ph);
void scmi_setup_protocol_implemented(const struct scmi_protocol_handle *ph,
u8 *prot_imp);
-extern struct bus_type scmi_bus_type;
+extern const struct bus_type scmi_bus_type;
#define SCMI_BUS_NOTIFY_DEVICE_REQUEST 0
#define SCMI_BUS_NOTIFY_DEVICE_UNREQUEST 1
--
2.43.0
On Sun, Feb 11, 2024 at 12:51:28PM -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
>
> Cc: Greg Kroah-Hartman <[email protected]>
> Signed-off-by: Ricardo B. Marliere <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
On Sun, Feb 11, 2024 at 12:51:29PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the ffa_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]>
Reviewed-by: Cristian Marussi <[email protected]>
Thanks,
Cristian
> ---
> drivers/firmware/arm_ffa/bus.c | 2 +-
> include/linux/arm_ffa.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c
> index 1c7940ba5539..2f557e90f2eb 100644
> --- a/drivers/firmware/arm_ffa/bus.c
> +++ b/drivers/firmware/arm_ffa/bus.c
> @@ -105,7 +105,7 @@ static struct attribute *ffa_device_attributes_attrs[] = {
> };
> ATTRIBUTE_GROUPS(ffa_device_attributes);
>
> -struct bus_type ffa_bus_type = {
> +const struct bus_type ffa_bus_type = {
> .name = "arm_ffa",
> .match = ffa_device_match,
> .probe = ffa_device_probe,
> diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h
> index 3d0fde57ba90..c906f666ff5d 100644
> --- a/include/linux/arm_ffa.h
> +++ b/include/linux/arm_ffa.h
> @@ -209,7 +209,7 @@ bool ffa_device_is_valid(struct ffa_device *ffa_dev) { return false; }
> #define module_ffa_driver(__ffa_driver) \
> module_driver(__ffa_driver, ffa_register, ffa_unregister)
>
> -extern struct bus_type ffa_bus_type;
> +extern const struct bus_type ffa_bus_type;
>
> /* FFA transport related */
> struct ffa_partition_info {
>
> --
> 2.43.0
>
On Sun, Feb 11, 2024 at 12:51:30PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the scmi_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]>
> ---
Reviewed-by: Cristian Marussi <[email protected]>
Thanks,
Cristian
> drivers/firmware/arm_scmi/bus.c | 2 +-
> drivers/firmware/arm_scmi/common.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
> index c15928b8c5cc..609a6496c1d4 100644
> --- a/drivers/firmware/arm_scmi/bus.c
> +++ b/drivers/firmware/arm_scmi/bus.c
> @@ -263,7 +263,7 @@ static void scmi_dev_remove(struct device *dev)
> scmi_drv->remove(scmi_dev);
> }
>
> -struct bus_type scmi_bus_type = {
> +const struct bus_type scmi_bus_type = {
> .name = "scmi_protocol",
> .match = scmi_dev_match,
> .probe = scmi_dev_probe,
> diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h
> index 00b165d1f502..6affbfdd1dec 100644
> --- a/drivers/firmware/arm_scmi/common.h
> +++ b/drivers/firmware/arm_scmi/common.h
> @@ -141,7 +141,7 @@ scmi_revision_area_get(const struct scmi_protocol_handle *ph);
> void scmi_setup_protocol_implemented(const struct scmi_protocol_handle *ph,
> u8 *prot_imp);
>
> -extern struct bus_type scmi_bus_type;
> +extern const struct bus_type scmi_bus_type;
>
> #define SCMI_BUS_NOTIFY_DEVICE_REQUEST 0
> #define SCMI_BUS_NOTIFY_DEVICE_UNREQUEST 1
>
> --
> 2.43.0
>
On Sun, 11 Feb 2024 12:51:28 -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]).
>
Applied to sudeep.holla/linux (for-next/ffa/updates), thanks!
[1/2] firmware: arm_ffa: Make ffa_bus_type const
https://git.kernel.org/sudeep.holla/c/989e8661dc45
--
Regards,
Sudeep
On Sun, 11 Feb 2024 12:51:28 -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]).
>
Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!
[2/2] firmware: arm_scmi: make scmi_bus_type const
https://git.kernel.org/sudeep.holla/c/961745b2c42e
--
Regards,
Sudeep