diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-13 19:18:42 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-17 15:16:48 +0100 |
commit | 9fa120fbd507e58af3494b8765427fdc8181e1eb (patch) | |
tree | 86a1e401cb235a26ea049d50fa8bcac8e6c79ebb /include/linux/device.h | |
parent | a010eb8812435015118662b23be799670f641a83 (diff) |
driver core: device: mark struct class in struct device as constant
The pointer to a struct class in a struct device should never be used to
change anything in that class. So mark it as constant to enforce this
requirement.
This requires a few minor changes to some internal driver core functions
to enforce the const * being used here now.
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Link: https://lore.kernel.org/r/20230313181843.1207845-11-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 2562451b875b..ea07b95b06e5 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -631,7 +631,7 @@ struct device { spinlock_t devres_lock; struct list_head devres_head; - struct class *class; + const struct class *class; const struct attribute_group **groups; /* optional groups */ void (*release)(struct device *dev); |