driver core: make struct bus_type.uevent() take a const *
The uevent() callback in struct bus_type should not be modifying the device that is passed into it, so mark it as a const * and propagate the function signature changes out into all relevant subsystems that use this callback. Acked-by: Rafael J. Wysocki <rafael@kernel.org> Acked-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20230111113018.459199-16-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -28,7 +28,7 @@ static int nvdimm_bus_major;
|
||||
struct class *nd_class;
|
||||
static DEFINE_IDA(nd_ida);
|
||||
|
||||
static int to_nd_device_type(struct device *dev)
|
||||
static int to_nd_device_type(const struct device *dev)
|
||||
{
|
||||
if (is_nvdimm(dev))
|
||||
return ND_DEVICE_DIMM;
|
||||
@@ -42,7 +42,7 @@ static int to_nd_device_type(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nvdimm_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
static int nvdimm_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
|
||||
{
|
||||
return add_uevent_var(env, "MODALIAS=" ND_DEVICE_MODALIAS_FMT,
|
||||
to_nd_device_type(dev));
|
||||
|
||||
@@ -38,7 +38,7 @@ static const struct device_type nd_dax_device_type = {
|
||||
.groups = nd_pfn_attribute_groups,
|
||||
};
|
||||
|
||||
bool is_nd_dax(struct device *dev)
|
||||
bool is_nd_dax(const struct device *dev)
|
||||
{
|
||||
return dev ? dev->type == &nd_dax_device_type : false;
|
||||
}
|
||||
|
||||
@@ -572,7 +572,7 @@ static const struct device_type nvdimm_device_type = {
|
||||
.groups = nvdimm_attribute_groups,
|
||||
};
|
||||
|
||||
bool is_nvdimm(struct device *dev)
|
||||
bool is_nvdimm(const struct device *dev)
|
||||
{
|
||||
return dev->type == &nvdimm_device_type;
|
||||
}
|
||||
|
||||
@@ -82,14 +82,14 @@ static inline void nvdimm_security_overwrite_query(struct work_struct *work)
|
||||
}
|
||||
#endif
|
||||
|
||||
bool is_nvdimm(struct device *dev);
|
||||
bool is_nd_pmem(struct device *dev);
|
||||
bool is_nd_volatile(struct device *dev);
|
||||
static inline bool is_nd_region(struct device *dev)
|
||||
bool is_nvdimm(const struct device *dev);
|
||||
bool is_nd_pmem(const struct device *dev);
|
||||
bool is_nd_volatile(const struct device *dev);
|
||||
static inline bool is_nd_region(const struct device *dev)
|
||||
{
|
||||
return is_nd_pmem(dev) || is_nd_volatile(dev);
|
||||
}
|
||||
static inline bool is_memory(struct device *dev)
|
||||
static inline bool is_memory(const struct device *dev)
|
||||
{
|
||||
return is_nd_pmem(dev) || is_nd_volatile(dev);
|
||||
}
|
||||
|
||||
+2
-2
@@ -599,7 +599,7 @@ static inline int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)
|
||||
struct nd_dax *to_nd_dax(struct device *dev);
|
||||
#if IS_ENABLED(CONFIG_NVDIMM_DAX)
|
||||
int nd_dax_probe(struct device *dev, struct nd_namespace_common *ndns);
|
||||
bool is_nd_dax(struct device *dev);
|
||||
bool is_nd_dax(const struct device *dev);
|
||||
struct device *nd_dax_create(struct nd_region *nd_region);
|
||||
#else
|
||||
static inline int nd_dax_probe(struct device *dev,
|
||||
@@ -608,7 +608,7 @@ static inline int nd_dax_probe(struct device *dev,
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline bool is_nd_dax(struct device *dev)
|
||||
static inline bool is_nd_dax(const struct device *dev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -839,12 +839,12 @@ static const struct device_type nd_volatile_device_type = {
|
||||
.groups = nd_region_attribute_groups,
|
||||
};
|
||||
|
||||
bool is_nd_pmem(struct device *dev)
|
||||
bool is_nd_pmem(const struct device *dev)
|
||||
{
|
||||
return dev ? dev->type == &nd_pmem_device_type : false;
|
||||
}
|
||||
|
||||
bool is_nd_volatile(struct device *dev)
|
||||
bool is_nd_volatile(const struct device *dev)
|
||||
{
|
||||
return dev ? dev->type == &nd_volatile_device_type : false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user