1

intel_th: 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
intel_th_source_device_type, intel_th_output_device_type,
intel_th_switch_device_type and intel_th_device_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>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240429130119.1518073-7-alexander.shishkin@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Ricardo B. Marliere 2024-04-29 16:01:10 +03:00 committed by Greg Kroah-Hartman
parent 1592e84c7d
commit 8dc0b2d385

View File

@ -180,7 +180,7 @@ static void intel_th_device_release(struct device *dev)
intel_th_device_free(to_intel_th_device(dev)); intel_th_device_free(to_intel_th_device(dev));
} }
static struct device_type intel_th_source_device_type = { static const struct device_type intel_th_source_device_type = {
.name = "intel_th_source_device", .name = "intel_th_source_device",
.release = intel_th_device_release, .release = intel_th_device_release,
}; };
@ -333,19 +333,19 @@ static struct attribute *intel_th_output_attrs[] = {
ATTRIBUTE_GROUPS(intel_th_output); ATTRIBUTE_GROUPS(intel_th_output);
static struct device_type intel_th_output_device_type = { static const struct device_type intel_th_output_device_type = {
.name = "intel_th_output_device", .name = "intel_th_output_device",
.groups = intel_th_output_groups, .groups = intel_th_output_groups,
.release = intel_th_device_release, .release = intel_th_device_release,
.devnode = intel_th_output_devnode, .devnode = intel_th_output_devnode,
}; };
static struct device_type intel_th_switch_device_type = { static const struct device_type intel_th_switch_device_type = {
.name = "intel_th_switch_device", .name = "intel_th_switch_device",
.release = intel_th_device_release, .release = intel_th_device_release,
}; };
static struct device_type *intel_th_device_type[] = { static const struct device_type *intel_th_device_type[] = {
[INTEL_TH_SOURCE] = &intel_th_source_device_type, [INTEL_TH_SOURCE] = &intel_th_source_device_type,
[INTEL_TH_OUTPUT] = &intel_th_output_device_type, [INTEL_TH_OUTPUT] = &intel_th_output_device_type,
[INTEL_TH_SWITCH] = &intel_th_switch_device_type, [INTEL_TH_SWITCH] = &intel_th_switch_device_type,