Commit 1e0a2852 authored by Ricardo B. Marliere's avatar Ricardo B. Marliere Committed by Vinod Koul

dmaengine: idxd: constify the struct device_type usage

Since commit aed65af1 ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the
dsa_device_type, iax_device_type, idxd_wq_device_type, idxd_cdev_file_type,
idxd_cdev_device_type and idxd_group_device_type variables to be constant
structures as well, placing it into read-only memory which can not be
modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatar"Ricardo B. Marliere" <ricardo@marliere.net>
Reviewed-by: default avatarFenghua Yu <fenghua.yu@intel.com>
Link: https://lore.kernel.org/r/20240219-device_cleanup-dmaengine-v1-1-9f72f3cf3587@marliere.netSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 35b78e2e
...@@ -152,7 +152,7 @@ static void idxd_file_dev_release(struct device *dev) ...@@ -152,7 +152,7 @@ static void idxd_file_dev_release(struct device *dev)
mutex_unlock(&wq->wq_lock); mutex_unlock(&wq->wq_lock);
} }
static struct device_type idxd_cdev_file_type = { static const struct device_type idxd_cdev_file_type = {
.name = "idxd_file", .name = "idxd_file",
.release = idxd_file_dev_release, .release = idxd_file_dev_release,
.groups = cdev_file_attribute_groups, .groups = cdev_file_attribute_groups,
...@@ -169,7 +169,7 @@ static void idxd_cdev_dev_release(struct device *dev) ...@@ -169,7 +169,7 @@ static void idxd_cdev_dev_release(struct device *dev)
kfree(idxd_cdev); kfree(idxd_cdev);
} }
static struct device_type idxd_cdev_device_type = { static const struct device_type idxd_cdev_device_type = {
.name = "idxd_cdev", .name = "idxd_cdev",
.release = idxd_cdev_dev_release, .release = idxd_cdev_dev_release,
}; };
......
...@@ -282,7 +282,7 @@ typedef int (*load_device_defaults_fn_t) (struct idxd_device *idxd); ...@@ -282,7 +282,7 @@ typedef int (*load_device_defaults_fn_t) (struct idxd_device *idxd);
struct idxd_driver_data { struct idxd_driver_data {
const char *name_prefix; const char *name_prefix;
enum idxd_type type; enum idxd_type type;
struct device_type *dev_type; const struct device_type *dev_type;
int compl_size; int compl_size;
int align; int align;
int evl_cr_off; int evl_cr_off;
...@@ -520,11 +520,11 @@ extern const struct bus_type dsa_bus_type; ...@@ -520,11 +520,11 @@ extern const struct bus_type dsa_bus_type;
extern bool support_enqcmd; extern bool support_enqcmd;
extern struct ida idxd_ida; extern struct ida idxd_ida;
extern struct device_type dsa_device_type; extern const struct device_type dsa_device_type;
extern struct device_type iax_device_type; extern const struct device_type iax_device_type;
extern struct device_type idxd_wq_device_type; extern const struct device_type idxd_wq_device_type;
extern struct device_type idxd_engine_device_type; extern const struct device_type idxd_engine_device_type;
extern struct device_type idxd_group_device_type; extern const struct device_type idxd_group_device_type;
static inline bool is_dsa_dev(struct idxd_dev *idxd_dev) static inline bool is_dsa_dev(struct idxd_dev *idxd_dev)
{ {
......
...@@ -91,7 +91,7 @@ static void idxd_conf_engine_release(struct device *dev) ...@@ -91,7 +91,7 @@ static void idxd_conf_engine_release(struct device *dev)
kfree(engine); kfree(engine);
} }
struct device_type idxd_engine_device_type = { const struct device_type idxd_engine_device_type = {
.name = "engine", .name = "engine",
.release = idxd_conf_engine_release, .release = idxd_conf_engine_release,
.groups = idxd_engine_attribute_groups, .groups = idxd_engine_attribute_groups,
...@@ -577,7 +577,7 @@ static void idxd_conf_group_release(struct device *dev) ...@@ -577,7 +577,7 @@ static void idxd_conf_group_release(struct device *dev)
kfree(group); kfree(group);
} }
struct device_type idxd_group_device_type = { const struct device_type idxd_group_device_type = {
.name = "group", .name = "group",
.release = idxd_conf_group_release, .release = idxd_conf_group_release,
.groups = idxd_group_attribute_groups, .groups = idxd_group_attribute_groups,
...@@ -1369,7 +1369,7 @@ static void idxd_conf_wq_release(struct device *dev) ...@@ -1369,7 +1369,7 @@ static void idxd_conf_wq_release(struct device *dev)
kfree(wq); kfree(wq);
} }
struct device_type idxd_wq_device_type = { const struct device_type idxd_wq_device_type = {
.name = "wq", .name = "wq",
.release = idxd_conf_wq_release, .release = idxd_conf_wq_release,
.groups = idxd_wq_attribute_groups, .groups = idxd_wq_attribute_groups,
...@@ -1798,13 +1798,13 @@ static void idxd_conf_device_release(struct device *dev) ...@@ -1798,13 +1798,13 @@ static void idxd_conf_device_release(struct device *dev)
kfree(idxd); kfree(idxd);
} }
struct device_type dsa_device_type = { const struct device_type dsa_device_type = {
.name = "dsa", .name = "dsa",
.release = idxd_conf_device_release, .release = idxd_conf_device_release,
.groups = idxd_attribute_groups, .groups = idxd_attribute_groups,
}; };
struct device_type iax_device_type = { const struct device_type iax_device_type = {
.name = "iax", .name = "iax",
.release = idxd_conf_device_release, .release = idxd_conf_device_release,
.groups = idxd_attribute_groups, .groups = idxd_attribute_groups,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment