[PATCH v3 12/28] driver core: fw_devlink: Tag the fwnode dev member as private

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The dev member in the fwnode structure should be accessed only by the
fwnode core. The fw_devlink_set_device() helper has been introduced to
avoid users to set this member directly. All users have been converted
and use fw_devlink_set_device() to set the field.

To avoid future abusers who might set the field directly and allow
sparse to detect them, tag the dev field as a private field.

Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
---
 include/linux/fwnode.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index a1345e274125..5762914fdbf2 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -54,7 +54,7 @@ struct fwnode_handle {
 	const struct fwnode_operations *ops;
 
 	/* The below is used solely by device links, don't use otherwise */
-	struct device *dev;
+	struct device *__private dev;
 	struct list_head suppliers;
 	struct list_head consumers;
 	u8 flags;
@@ -234,7 +234,7 @@ bool fw_devlink_is_strict(void);
 static inline void fw_devlink_set_device(struct fwnode_handle *fwnode,
 					 struct device *dev)
 {
-	fwnode->dev = dev;
+	ACCESS_PRIVATE(fwnode, dev) = dev;
 }
 
 #endif
-- 
2.49.0





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux