diff options
author | Vinod Koul <vinod.koul@intel.com> | 2018-01-31 03:20:13 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2018-01-31 03:20:13 -0500 |
commit | 40303764f7aaaaf2ccfb01f4fac5a631fffc1a3c (patch) | |
tree | 8a526facbbfd0603ebb4f83b8d74977974637257 | |
parent | 1eac32184daab3d00299bdc4532ec17ced2af0b8 (diff) | |
parent | 146b4dbb0eef3695f35f5a80224d1f18c110ec85 (diff) |
Merge branch 'topic/device_changes' into for-linus
-rw-r--r-- | drivers/acpi/bus.c | 18 | ||||
-rw-r--r-- | drivers/acpi/property.c | 8 | ||||
-rw-r--r-- | drivers/base/property.c | 7 | ||||
-rw-r--r-- | drivers/of/property.c | 8 | ||||
-rw-r--r-- | include/linux/acpi.h | 6 | ||||
-rw-r--r-- | include/linux/fwnode.h | 4 | ||||
-rw-r--r-- | include/linux/property.h | 2 |
7 files changed, 53 insertions, 0 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 4d0979e02a28..f87ed3be779a 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -785,6 +785,24 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, | |||
785 | } | 785 | } |
786 | EXPORT_SYMBOL_GPL(acpi_match_device); | 786 | EXPORT_SYMBOL_GPL(acpi_match_device); |
787 | 787 | ||
788 | void *acpi_get_match_data(const struct device *dev) | ||
789 | { | ||
790 | const struct acpi_device_id *match; | ||
791 | |||
792 | if (!dev->driver) | ||
793 | return NULL; | ||
794 | |||
795 | if (!dev->driver->acpi_match_table) | ||
796 | return NULL; | ||
797 | |||
798 | match = acpi_match_device(dev->driver->acpi_match_table, dev); | ||
799 | if (!match) | ||
800 | return NULL; | ||
801 | |||
802 | return (void *)match->driver_data; | ||
803 | } | ||
804 | EXPORT_SYMBOL_GPL(acpi_get_match_data); | ||
805 | |||
788 | int acpi_match_device_ids(struct acpi_device *device, | 806 | int acpi_match_device_ids(struct acpi_device *device, |
789 | const struct acpi_device_id *ids) | 807 | const struct acpi_device_id *ids) |
790 | { | 808 | { |
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index e26ea209b63e..466d1503aba0 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c | |||
@@ -1271,9 +1271,17 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, | |||
1271 | return 0; | 1271 | return 0; |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | static void * | ||
1275 | acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, | ||
1276 | const struct device *dev) | ||
1277 | { | ||
1278 | return acpi_get_match_data(dev); | ||
1279 | } | ||
1280 | |||
1274 | #define DECLARE_ACPI_FWNODE_OPS(ops) \ | 1281 | #define DECLARE_ACPI_FWNODE_OPS(ops) \ |
1275 | const struct fwnode_operations ops = { \ | 1282 | const struct fwnode_operations ops = { \ |
1276 | .device_is_available = acpi_fwnode_device_is_available, \ | 1283 | .device_is_available = acpi_fwnode_device_is_available, \ |
1284 | .device_get_match_data = acpi_fwnode_device_get_match_data, \ | ||
1277 | .property_present = acpi_fwnode_property_present, \ | 1285 | .property_present = acpi_fwnode_property_present, \ |
1278 | .property_read_int_array = \ | 1286 | .property_read_int_array = \ |
1279 | acpi_fwnode_property_read_int_array, \ | 1287 | acpi_fwnode_property_read_int_array, \ |
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/drivers/of/property.c b/drivers/of/property.c index 8ad33a44a7b8..f25d36358187 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c | |||
@@ -981,10 +981,18 @@ static int of_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, | |||
981 | return 0; | 981 | return 0; |
982 | } | 982 | } |
983 | 983 | ||
984 | static void * | ||
985 | of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, | ||
986 | const struct device *dev) | ||
987 | { | ||
988 | return (void *)of_device_get_match_data(dev); | ||
989 | } | ||
990 | |||
984 | const struct fwnode_operations of_fwnode_ops = { | 991 | const struct fwnode_operations of_fwnode_ops = { |
985 | .get = of_fwnode_get, | 992 | .get = of_fwnode_get, |
986 | .put = of_fwnode_put, | 993 | .put = of_fwnode_put, |
987 | .device_is_available = of_fwnode_device_is_available, | 994 | .device_is_available = of_fwnode_device_is_available, |
995 | .device_get_match_data = of_fwnode_device_get_match_data, | ||
988 | .property_present = of_fwnode_property_present, | 996 | .property_present = of_fwnode_property_present, |
989 | .property_read_int_array = of_fwnode_property_read_int_array, | 997 | .property_read_int_array = of_fwnode_property_read_int_array, |
990 | .property_read_string_array = of_fwnode_property_read_string_array, | 998 | .property_read_string_array = of_fwnode_property_read_string_array, |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index dc1ebfeeb5ec..927873751323 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -584,6 +584,7 @@ extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), | |||
584 | const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, | 584 | const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, |
585 | const struct device *dev); | 585 | const struct device *dev); |
586 | 586 | ||
587 | void *acpi_get_match_data(const struct device *dev); | ||
587 | extern bool acpi_driver_match_device(struct device *dev, | 588 | extern bool acpi_driver_match_device(struct device *dev, |
588 | const struct device_driver *drv); | 589 | const struct device_driver *drv); |
589 | int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); | 590 | int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); |
@@ -755,6 +756,11 @@ static inline const struct acpi_device_id *acpi_match_device( | |||
755 | return NULL; | 756 | return NULL; |
756 | } | 757 | } |
757 | 758 | ||
759 | static inline void *acpi_get_match_data(const struct device *dev) | ||
760 | { | ||
761 | return NULL; | ||
762 | } | ||
763 | |||
758 | static inline bool acpi_driver_match_device(struct device *dev, | 764 | static inline bool acpi_driver_match_device(struct device *dev, |
759 | const struct device_driver *drv) | 765 | const struct device_driver *drv) |
760 | { | 766 | { |
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); |