greybus: constify the struct device_type usage

Since commit aed65af1cc ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the
greybus_hd_type, greybus_module_type, greybus_interface_type,
greybus_control_type, greybus_bundle_type and greybus_svc_type variables to
be constant structures as well, placing it into read-only memory which can
not be modified at runtime.

Signed-off-by: "Ricardo B. Marliere" <ricardo@marliere.net>
Reviewed-by: Alex Elder <elder@linaro.org>
Link: https://lore.kernel.org/r/20240219-device_cleanup-greybus-v1-1-babb3f65e8cc@marliere.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Ricardo B. Marliere 2024-02-19 09:40:50 -03:00 committed by Greg Kroah-Hartman
parent 00b9850e73
commit e869b72b33
7 changed files with 12 additions and 12 deletions

View File

@ -166,7 +166,7 @@ static const struct dev_pm_ops gb_bundle_pm_ops = {
SET_RUNTIME_PM_OPS(gb_bundle_suspend, gb_bundle_resume, gb_bundle_idle)
};
struct device_type greybus_bundle_type = {
const struct device_type greybus_bundle_type = {
.name = "greybus_bundle",
.release = gb_bundle_release,
.pm = &gb_bundle_pm_ops,

View File

@ -436,7 +436,7 @@ static void gb_control_release(struct device *dev)
kfree(control);
}
struct device_type greybus_control_type = {
const struct device_type greybus_control_type = {
.name = "greybus_control",
.release = gb_control_release,
};

View File

@ -116,7 +116,7 @@ static void gb_hd_release(struct device *dev)
kfree(hd);
}
struct device_type greybus_hd_type = {
const struct device_type greybus_hd_type = {
.name = "greybus_host_device",
.release = gb_hd_release,
};

View File

@ -765,7 +765,7 @@ static const struct dev_pm_ops gb_interface_pm_ops = {
gb_interface_runtime_idle)
};
struct device_type greybus_interface_type = {
const struct device_type greybus_interface_type = {
.name = "greybus_interface",
.release = gb_interface_release,
.pm = &gb_interface_pm_ops,

View File

@ -81,7 +81,7 @@ static void gb_module_release(struct device *dev)
kfree(module);
}
struct device_type greybus_module_type = {
const struct device_type greybus_module_type = {
.name = "greybus_module",
.release = gb_module_release,
};

View File

@ -1305,7 +1305,7 @@ static void gb_svc_release(struct device *dev)
kfree(svc);
}
struct device_type greybus_svc_type = {
const struct device_type greybus_svc_type = {
.name = "greybus_svc",
.release = gb_svc_release,
};

View File

@ -106,12 +106,12 @@ struct dentry *gb_debugfs_get(void);
extern const struct bus_type greybus_bus_type;
extern struct device_type greybus_hd_type;
extern struct device_type greybus_module_type;
extern struct device_type greybus_interface_type;
extern struct device_type greybus_control_type;
extern struct device_type greybus_bundle_type;
extern struct device_type greybus_svc_type;
extern const struct device_type greybus_hd_type;
extern const struct device_type greybus_module_type;
extern const struct device_type greybus_interface_type;
extern const struct device_type greybus_control_type;
extern const struct device_type greybus_bundle_type;
extern const struct device_type greybus_svc_type;
static inline int is_gb_host_device(const struct device *dev)
{