mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
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:
parent
00b9850e73
commit
e869b72b33
@ -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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user