mirror of
https://github.com/torvalds/linux.git
synced 2026-11-23 23:11:40 +00:00
scsi: core: 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
scsi_host_type, scsi_target_type and scsi_dev_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 <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Martin K. Petersen <[email protected]>
This commit is contained in:
committed by
Martin K. Petersen
parent
3e24118ec1
commit
517bcc2b4d
@@ -371,7 +371,7 @@ static void scsi_host_dev_release(struct device *dev)
|
||||
kfree(shost);
|
||||
}
|
||||
|
||||
static struct device_type scsi_host_type = {
|
||||
static const struct device_type scsi_host_type = {
|
||||
.name = "scsi_host",
|
||||
.release = scsi_host_dev_release,
|
||||
};
|
||||
|
||||
@@ -412,7 +412,7 @@ static void scsi_target_dev_release(struct device *dev)
|
||||
put_device(parent);
|
||||
}
|
||||
|
||||
static struct device_type scsi_target_type = {
|
||||
static const struct device_type scsi_target_type = {
|
||||
.name = "scsi_target",
|
||||
.release = scsi_target_dev_release,
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "scsi_priv.h"
|
||||
#include "scsi_logging.h"
|
||||
|
||||
static struct device_type scsi_dev_type;
|
||||
static const struct device_type scsi_dev_type;
|
||||
|
||||
static const struct {
|
||||
enum scsi_device_state value;
|
||||
@@ -1626,7 +1626,7 @@ int scsi_sysfs_add_host(struct Scsi_Host *shost)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct device_type scsi_dev_type = {
|
||||
static const struct device_type scsi_dev_type = {
|
||||
.name = "scsi_device",
|
||||
.release = scsi_device_dev_release,
|
||||
.groups = scsi_sdev_attr_groups,
|
||||
|
||||
Reference in New Issue
Block a user