diff options
author | Sinan Kaya <okaya@codeaurora.org> | 2017-12-13 02:20:49 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2017-12-13 03:40:57 -0500 |
commit | b283f157611f129f5bbbf7d06f5af860d76797fd (patch) | |
tree | bf89e94e72184a1a7a703e0b9c2b96ebd91b988d | |
parent | 80212a162329e590fde02d8457af16ea0ab0a55f (diff) |
device property: Introduce a common API to fetch device match data
There is an OF/ACPI function to obtain the driver data. We want to hide
OF/ACPI details from the device drivers and abstract following the device
family of functions.
Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/base/property.c | 7 | ||||
-rw-r--r-- | include/linux/fwnode.h | 4 | ||||
-rw-r--r-- | include/linux/property.h | 2 |
3 files changed, 13 insertions, 0 deletions
diff --git a/drivers/base/property.c b/drivers/base/property.c index 851b1b6596a4..09eaac9400ed 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c | |||
@@ -1340,3 +1340,10 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, | |||
1340 | return fwnode_call_int_op(fwnode, graph_parse_endpoint, endpoint); | 1340 | return fwnode_call_int_op(fwnode, graph_parse_endpoint, endpoint); |
1341 | } | 1341 | } |
1342 | EXPORT_SYMBOL(fwnode_graph_parse_endpoint); | 1342 | EXPORT_SYMBOL(fwnode_graph_parse_endpoint); |
1343 | |||
1344 | void *device_get_match_data(struct device *dev) | ||
1345 | { | ||
1346 | return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, | ||
1347 | dev); | ||
1348 | } | ||
1349 | EXPORT_SYMBOL_GPL(device_get_match_data); | ||
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index 411a84c6c400..4fa1a489efe4 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
16 | 16 | ||
17 | struct fwnode_operations; | 17 | struct fwnode_operations; |
18 | struct device; | ||
18 | 19 | ||
19 | struct fwnode_handle { | 20 | struct fwnode_handle { |
20 | struct fwnode_handle *secondary; | 21 | struct fwnode_handle *secondary; |
@@ -51,6 +52,7 @@ struct fwnode_reference_args { | |||
51 | * struct fwnode_operations - Operations for fwnode interface | 52 | * struct fwnode_operations - Operations for fwnode interface |
52 | * @get: Get a reference to an fwnode. | 53 | * @get: Get a reference to an fwnode. |
53 | * @put: Put a reference to an fwnode. | 54 | * @put: Put a reference to an fwnode. |
55 | * @device_get_match_data: Return the device driver match data. | ||
54 | * @property_present: Return true if a property is present. | 56 | * @property_present: Return true if a property is present. |
55 | * @property_read_integer_array: Read an array of integer properties. Return | 57 | * @property_read_integer_array: Read an array of integer properties. Return |
56 | * zero on success, a negative error code | 58 | * zero on success, a negative error code |
@@ -71,6 +73,8 @@ struct fwnode_operations { | |||
71 | struct fwnode_handle *(*get)(struct fwnode_handle *fwnode); | 73 | struct fwnode_handle *(*get)(struct fwnode_handle *fwnode); |
72 | void (*put)(struct fwnode_handle *fwnode); | 74 | void (*put)(struct fwnode_handle *fwnode); |
73 | bool (*device_is_available)(const struct fwnode_handle *fwnode); | 75 | bool (*device_is_available)(const struct fwnode_handle *fwnode); |
76 | void *(*device_get_match_data)(const struct fwnode_handle *fwnode, | ||
77 | const struct device *dev); | ||
74 | bool (*property_present)(const struct fwnode_handle *fwnode, | 78 | bool (*property_present)(const struct fwnode_handle *fwnode, |
75 | const char *propname); | 79 | const char *propname); |
76 | int (*property_read_int_array)(const struct fwnode_handle *fwnode, | 80 | int (*property_read_int_array)(const struct fwnode_handle *fwnode, |
diff --git a/include/linux/property.h b/include/linux/property.h index f6189a3ac63c..6653ed4b99f9 100644 --- a/include/linux/property.h +++ b/include/linux/property.h | |||
@@ -275,6 +275,8 @@ bool device_dma_supported(struct device *dev); | |||
275 | 275 | ||
276 | enum dev_dma_attr device_get_dma_attr(struct device *dev); | 276 | enum dev_dma_attr device_get_dma_attr(struct device *dev); |
277 | 277 | ||
278 | void *device_get_match_data(struct device *dev); | ||
279 | |||
278 | int device_get_phy_mode(struct device *dev); | 280 | int device_get_phy_mode(struct device *dev); |
279 | 281 | ||
280 | void *device_get_mac_address(struct device *dev, char *addr, int alen); | 282 | void *device_get_mac_address(struct device *dev, char *addr, int alen); |