mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
driver core: device: make device_create*() take a const struct class *
The functions device_create() and device_create_with_groups() do not modify the struct class passed into it, so enforce this by changing the function parameters to be struct const class. Cc: "Rafael J. Wysocki" <rafael@kernel.org> Link: https://lore.kernel.org/r/20230313181843.1207845-12-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -4253,7 +4253,7 @@ static void device_create_release(struct device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static __printf(6, 0) struct device *
|
static __printf(6, 0) struct device *
|
||||||
device_create_groups_vargs(struct class *class, struct device *parent,
|
device_create_groups_vargs(const struct class *class, struct device *parent,
|
||||||
dev_t devt, void *drvdata,
|
dev_t devt, void *drvdata,
|
||||||
const struct attribute_group **groups,
|
const struct attribute_group **groups,
|
||||||
const char *fmt, va_list args)
|
const char *fmt, va_list args)
|
||||||
@@ -4317,7 +4317,7 @@ error:
|
|||||||
* Note: the struct class passed to this function must have previously
|
* Note: the struct class passed to this function must have previously
|
||||||
* been created with a call to class_create().
|
* been created with a call to class_create().
|
||||||
*/
|
*/
|
||||||
struct device *device_create(struct class *class, struct device *parent,
|
struct device *device_create(const struct class *class, struct device *parent,
|
||||||
dev_t devt, void *drvdata, const char *fmt, ...)
|
dev_t devt, void *drvdata, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list vargs;
|
va_list vargs;
|
||||||
@@ -4358,7 +4358,7 @@ EXPORT_SYMBOL_GPL(device_create);
|
|||||||
* Note: the struct class passed to this function must have previously
|
* Note: the struct class passed to this function must have previously
|
||||||
* been created with a call to class_create().
|
* been created with a call to class_create().
|
||||||
*/
|
*/
|
||||||
struct device *device_create_with_groups(struct class *class,
|
struct device *device_create_with_groups(const struct class *class,
|
||||||
struct device *parent, dev_t devt,
|
struct device *parent, dev_t devt,
|
||||||
void *drvdata,
|
void *drvdata,
|
||||||
const struct attribute_group **groups,
|
const struct attribute_group **groups,
|
||||||
|
|||||||
@@ -1015,10 +1015,10 @@ bool device_is_bound(struct device *dev);
|
|||||||
* Easy functions for dynamically creating devices on the fly
|
* Easy functions for dynamically creating devices on the fly
|
||||||
*/
|
*/
|
||||||
__printf(5, 6) struct device *
|
__printf(5, 6) struct device *
|
||||||
device_create(struct class *cls, struct device *parent, dev_t devt,
|
device_create(const struct class *cls, struct device *parent, dev_t devt,
|
||||||
void *drvdata, const char *fmt, ...);
|
void *drvdata, const char *fmt, ...);
|
||||||
__printf(6, 7) struct device *
|
__printf(6, 7) struct device *
|
||||||
device_create_with_groups(struct class *cls, struct device *parent, dev_t devt,
|
device_create_with_groups(const struct class *cls, struct device *parent, dev_t devt,
|
||||||
void *drvdata, const struct attribute_group **groups,
|
void *drvdata, const struct attribute_group **groups,
|
||||||
const char *fmt, ...);
|
const char *fmt, ...);
|
||||||
void device_destroy(const struct class *cls, dev_t devt);
|
void device_destroy(const struct class *cls, dev_t devt);
|
||||||
|
|||||||
Reference in New Issue
Block a user