diff options
-rw-r--r-- | drivers/acpi/bus.c | 75 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 6 | ||||
-rw-r--r-- | drivers/acpi/property.c | 4 | ||||
-rw-r--r-- | drivers/acpi/spcr.c | 1 | ||||
-rw-r--r-- | drivers/base/property.c | 5 | ||||
-rw-r--r-- | drivers/of/property.c | 4 | ||||
-rw-r--r-- | include/linux/acpi.h | 4 | ||||
-rw-r--r-- | include/linux/fwnode.h | 4 | ||||
-rw-r--r-- | include/linux/property.h | 2 |
9 files changed, 59 insertions, 46 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 676c9788e1c8..0dad0bd9327b 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -660,13 +660,15 @@ struct acpi_device *acpi_companion_match(const struct device *dev) | |||
660 | * acpi_of_match_device - Match device object using the "compatible" property. | 660 | * acpi_of_match_device - Match device object using the "compatible" property. |
661 | * @adev: ACPI device object to match. | 661 | * @adev: ACPI device object to match. |
662 | * @of_match_table: List of device IDs to match against. | 662 | * @of_match_table: List of device IDs to match against. |
663 | * @of_id: OF ID if matched | ||
663 | * | 664 | * |
664 | * If @dev has an ACPI companion which has ACPI_DT_NAMESPACE_HID in its list of | 665 | * If @dev has an ACPI companion which has ACPI_DT_NAMESPACE_HID in its list of |
665 | * identifiers and a _DSD object with the "compatible" property, use that | 666 | * identifiers and a _DSD object with the "compatible" property, use that |
666 | * property to match against the given list of identifiers. | 667 | * property to match against the given list of identifiers. |
667 | */ | 668 | */ |
668 | static bool acpi_of_match_device(struct acpi_device *adev, | 669 | static bool acpi_of_match_device(struct acpi_device *adev, |
669 | const struct of_device_id *of_match_table) | 670 | const struct of_device_id *of_match_table, |
671 | const struct of_device_id **of_id) | ||
670 | { | 672 | { |
671 | const union acpi_object *of_compatible, *obj; | 673 | const union acpi_object *of_compatible, *obj; |
672 | int i, nval; | 674 | int i, nval; |
@@ -690,8 +692,11 @@ static bool acpi_of_match_device(struct acpi_device *adev, | |||
690 | const struct of_device_id *id; | 692 | const struct of_device_id *id; |
691 | 693 | ||
692 | for (id = of_match_table; id->compatible[0]; id++) | 694 | for (id = of_match_table; id->compatible[0]; id++) |
693 | if (!strcasecmp(obj->string.pointer, id->compatible)) | 695 | if (!strcasecmp(obj->string.pointer, id->compatible)) { |
696 | if (of_id) | ||
697 | *of_id = id; | ||
694 | return true; | 698 | return true; |
699 | } | ||
695 | } | 700 | } |
696 | 701 | ||
697 | return false; | 702 | return false; |
@@ -762,10 +767,11 @@ static bool __acpi_match_device_cls(const struct acpi_device_id *id, | |||
762 | return true; | 767 | return true; |
763 | } | 768 | } |
764 | 769 | ||
765 | static const struct acpi_device_id *__acpi_match_device( | 770 | static bool __acpi_match_device(struct acpi_device *device, |
766 | struct acpi_device *device, | 771 | const struct acpi_device_id *acpi_ids, |
767 | const struct acpi_device_id *ids, | 772 | const struct of_device_id *of_ids, |
768 | const struct of_device_id *of_ids) | 773 | const struct acpi_device_id **acpi_id, |
774 | const struct of_device_id **of_id) | ||
769 | { | 775 | { |
770 | const struct acpi_device_id *id; | 776 | const struct acpi_device_id *id; |
771 | struct acpi_hardware_id *hwid; | 777 | struct acpi_hardware_id *hwid; |
@@ -775,30 +781,32 @@ static const struct acpi_device_id *__acpi_match_device( | |||
775 | * driver for it. | 781 | * driver for it. |
776 | */ | 782 | */ |
777 | if (!device || !device->status.present) | 783 | if (!device || !device->status.present) |
778 | return NULL; | 784 | return false; |
779 | 785 | ||
780 | list_for_each_entry(hwid, &device->pnp.ids, list) { | 786 | list_for_each_entry(hwid, &device->pnp.ids, list) { |
781 | /* First, check the ACPI/PNP IDs provided by the caller. */ | 787 | /* First, check the ACPI/PNP IDs provided by the caller. */ |
782 | for (id = ids; id->id[0] || id->cls; id++) { | 788 | if (acpi_ids) { |
783 | if (id->id[0] && !strcmp((char *) id->id, hwid->id)) | 789 | for (id = acpi_ids; id->id[0] || id->cls; id++) { |
784 | return id; | 790 | if (id->id[0] && !strcmp((char *)id->id, hwid->id)) |
785 | else if (id->cls && __acpi_match_device_cls(id, hwid)) | 791 | goto out_acpi_match; |
786 | return id; | 792 | if (id->cls && __acpi_match_device_cls(id, hwid)) |
793 | goto out_acpi_match; | ||
794 | } | ||
787 | } | 795 | } |
788 | 796 | ||
789 | /* | 797 | /* |
790 | * Next, check ACPI_DT_NAMESPACE_HID and try to match the | 798 | * Next, check ACPI_DT_NAMESPACE_HID and try to match the |
791 | * "compatible" property if found. | 799 | * "compatible" property if found. |
792 | * | ||
793 | * The id returned by the below is not valid, but the only | ||
794 | * caller passing non-NULL of_ids here is only interested in | ||
795 | * whether or not the return value is NULL. | ||
796 | */ | 800 | */ |
797 | if (!strcmp(ACPI_DT_NAMESPACE_HID, hwid->id) | 801 | if (!strcmp(ACPI_DT_NAMESPACE_HID, hwid->id)) |
798 | && acpi_of_match_device(device, of_ids)) | 802 | return acpi_of_match_device(device, of_ids, of_id); |
799 | return id; | ||
800 | } | 803 | } |
801 | return NULL; | 804 | return false; |
805 | |||
806 | out_acpi_match: | ||
807 | if (acpi_id) | ||
808 | *acpi_id = id; | ||
809 | return true; | ||
802 | } | 810 | } |
803 | 811 | ||
804 | /** | 812 | /** |
@@ -815,32 +823,29 @@ static const struct acpi_device_id *__acpi_match_device( | |||
815 | const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, | 823 | const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, |
816 | const struct device *dev) | 824 | const struct device *dev) |
817 | { | 825 | { |
818 | return __acpi_match_device(acpi_companion_match(dev), ids, NULL); | 826 | const struct acpi_device_id *id = NULL; |
827 | |||
828 | __acpi_match_device(acpi_companion_match(dev), ids, NULL, &id, NULL); | ||
829 | return id; | ||
819 | } | 830 | } |
820 | EXPORT_SYMBOL_GPL(acpi_match_device); | 831 | EXPORT_SYMBOL_GPL(acpi_match_device); |
821 | 832 | ||
822 | void *acpi_get_match_data(const struct device *dev) | 833 | const void *acpi_device_get_match_data(const struct device *dev) |
823 | { | 834 | { |
824 | const struct acpi_device_id *match; | 835 | const struct acpi_device_id *match; |
825 | 836 | ||
826 | if (!dev->driver) | ||
827 | return NULL; | ||
828 | |||
829 | if (!dev->driver->acpi_match_table) | ||
830 | return NULL; | ||
831 | |||
832 | match = acpi_match_device(dev->driver->acpi_match_table, dev); | 837 | match = acpi_match_device(dev->driver->acpi_match_table, dev); |
833 | if (!match) | 838 | if (!match) |
834 | return NULL; | 839 | return NULL; |
835 | 840 | ||
836 | return (void *)match->driver_data; | 841 | return (const void *)match->driver_data; |
837 | } | 842 | } |
838 | EXPORT_SYMBOL_GPL(acpi_get_match_data); | 843 | EXPORT_SYMBOL_GPL(acpi_device_get_match_data); |
839 | 844 | ||
840 | int acpi_match_device_ids(struct acpi_device *device, | 845 | int acpi_match_device_ids(struct acpi_device *device, |
841 | const struct acpi_device_id *ids) | 846 | const struct acpi_device_id *ids) |
842 | { | 847 | { |
843 | return __acpi_match_device(device, ids, NULL) ? 0 : -ENOENT; | 848 | return __acpi_match_device(device, ids, NULL, NULL, NULL) ? 0 : -ENOENT; |
844 | } | 849 | } |
845 | EXPORT_SYMBOL(acpi_match_device_ids); | 850 | EXPORT_SYMBOL(acpi_match_device_ids); |
846 | 851 | ||
@@ -849,10 +854,12 @@ bool acpi_driver_match_device(struct device *dev, | |||
849 | { | 854 | { |
850 | if (!drv->acpi_match_table) | 855 | if (!drv->acpi_match_table) |
851 | return acpi_of_match_device(ACPI_COMPANION(dev), | 856 | return acpi_of_match_device(ACPI_COMPANION(dev), |
852 | drv->of_match_table); | 857 | drv->of_match_table, |
858 | NULL); | ||
853 | 859 | ||
854 | return !!__acpi_match_device(acpi_companion_match(dev), | 860 | return __acpi_match_device(acpi_companion_match(dev), |
855 | drv->acpi_match_table, drv->of_match_table); | 861 | drv->acpi_match_table, drv->of_match_table, |
862 | NULL, NULL); | ||
856 | } | 863 | } |
857 | EXPORT_SYMBOL_GPL(acpi_driver_match_device); | 864 | EXPORT_SYMBOL_GPL(acpi_driver_match_device); |
858 | 865 | ||
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index d9f38c645e4a..30a572956557 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -1927,6 +1927,9 @@ static int acpi_ec_suspend_noirq(struct device *dev) | |||
1927 | ec->reference_count >= 1) | 1927 | ec->reference_count >= 1) |
1928 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE); | 1928 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE); |
1929 | 1929 | ||
1930 | if (acpi_sleep_no_ec_events()) | ||
1931 | acpi_ec_enter_noirq(ec); | ||
1932 | |||
1930 | return 0; | 1933 | return 0; |
1931 | } | 1934 | } |
1932 | 1935 | ||
@@ -1934,6 +1937,9 @@ static int acpi_ec_resume_noirq(struct device *dev) | |||
1934 | { | 1937 | { |
1935 | struct acpi_ec *ec = acpi_driver_data(to_acpi_device(dev)); | 1938 | struct acpi_ec *ec = acpi_driver_data(to_acpi_device(dev)); |
1936 | 1939 | ||
1940 | if (acpi_sleep_no_ec_events()) | ||
1941 | acpi_ec_leave_noirq(ec); | ||
1942 | |||
1937 | if (ec_no_wakeup && test_bit(EC_FLAGS_STARTED, &ec->flags) && | 1943 | if (ec_no_wakeup && test_bit(EC_FLAGS_STARTED, &ec->flags) && |
1938 | ec->reference_count >= 1) | 1944 | ec->reference_count >= 1) |
1939 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE); | 1945 | acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE); |
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 466d1503aba0..5815356ea6ad 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c | |||
@@ -1271,11 +1271,11 @@ 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 * | 1274 | static const void * |
1275 | acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, | 1275 | acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, |
1276 | const struct device *dev) | 1276 | const struct device *dev) |
1277 | { | 1277 | { |
1278 | return acpi_get_match_data(dev); | 1278 | return acpi_device_get_match_data(dev); |
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | #define DECLARE_ACPI_FWNODE_OPS(ops) \ | 1281 | #define DECLARE_ACPI_FWNODE_OPS(ops) \ |
diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c index 89e97d21a89c..9d52743080a4 100644 --- a/drivers/acpi/spcr.c +++ b/drivers/acpi/spcr.c | |||
@@ -115,6 +115,7 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console) | |||
115 | table->serial_port.access_width))) { | 115 | table->serial_port.access_width))) { |
116 | default: | 116 | default: |
117 | pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n"); | 117 | pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n"); |
118 | /* fall through */ | ||
118 | case 8: | 119 | case 8: |
119 | iotype = "mmio"; | 120 | iotype = "mmio"; |
120 | break; | 121 | break; |
diff --git a/drivers/base/property.c b/drivers/base/property.c index 302236281d83..8f205f6461ed 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c | |||
@@ -1410,9 +1410,8 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, | |||
1410 | } | 1410 | } |
1411 | EXPORT_SYMBOL(fwnode_graph_parse_endpoint); | 1411 | EXPORT_SYMBOL(fwnode_graph_parse_endpoint); |
1412 | 1412 | ||
1413 | void *device_get_match_data(struct device *dev) | 1413 | const void *device_get_match_data(struct device *dev) |
1414 | { | 1414 | { |
1415 | return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, | 1415 | return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, dev); |
1416 | dev); | ||
1417 | } | 1416 | } |
1418 | EXPORT_SYMBOL_GPL(device_get_match_data); | 1417 | EXPORT_SYMBOL_GPL(device_get_match_data); |
diff --git a/drivers/of/property.c b/drivers/of/property.c index 36ed84e26d9c..f46828e3b082 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c | |||
@@ -977,11 +977,11 @@ static int of_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, | |||
977 | return 0; | 977 | return 0; |
978 | } | 978 | } |
979 | 979 | ||
980 | static void * | 980 | static const void * |
981 | of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, | 981 | of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, |
982 | const struct device *dev) | 982 | const struct device *dev) |
983 | { | 983 | { |
984 | return (void *)of_device_get_match_data(dev); | 984 | return of_device_get_match_data(dev); |
985 | } | 985 | } |
986 | 986 | ||
987 | const struct fwnode_operations of_fwnode_ops = { | 987 | const struct fwnode_operations of_fwnode_ops = { |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 64e10746f282..968173ec2726 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -587,7 +587,7 @@ extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), | |||
587 | const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, | 587 | const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, |
588 | const struct device *dev); | 588 | const struct device *dev); |
589 | 589 | ||
590 | void *acpi_get_match_data(const struct device *dev); | 590 | const void *acpi_device_get_match_data(const struct device *dev); |
591 | extern bool acpi_driver_match_device(struct device *dev, | 591 | extern bool acpi_driver_match_device(struct device *dev, |
592 | const struct device_driver *drv); | 592 | const struct device_driver *drv); |
593 | int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); | 593 | int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); |
@@ -766,7 +766,7 @@ static inline const struct acpi_device_id *acpi_match_device( | |||
766 | return NULL; | 766 | return NULL; |
767 | } | 767 | } |
768 | 768 | ||
769 | static inline void *acpi_get_match_data(const struct device *dev) | 769 | static inline const void *acpi_device_get_match_data(const struct device *dev) |
770 | { | 770 | { |
771 | return NULL; | 771 | return NULL; |
772 | } | 772 | } |
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index 4fa1a489efe4..4fe8f289b3f6 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h | |||
@@ -73,8 +73,8 @@ struct fwnode_operations { | |||
73 | struct fwnode_handle *(*get)(struct fwnode_handle *fwnode); | 73 | struct fwnode_handle *(*get)(struct fwnode_handle *fwnode); |
74 | void (*put)(struct fwnode_handle *fwnode); | 74 | void (*put)(struct fwnode_handle *fwnode); |
75 | 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, | 76 | const void *(*device_get_match_data)(const struct fwnode_handle *fwnode, |
77 | const struct device *dev); | 77 | const struct device *dev); |
78 | bool (*property_present)(const struct fwnode_handle *fwnode, | 78 | bool (*property_present)(const struct fwnode_handle *fwnode, |
79 | const char *propname); | 79 | const char *propname); |
80 | 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 769d372c1edf..2eea4b310fc2 100644 --- a/include/linux/property.h +++ b/include/linux/property.h | |||
@@ -283,7 +283,7 @@ bool device_dma_supported(struct device *dev); | |||
283 | 283 | ||
284 | enum dev_dma_attr device_get_dma_attr(struct device *dev); | 284 | enum dev_dma_attr device_get_dma_attr(struct device *dev); |
285 | 285 | ||
286 | void *device_get_match_data(struct device *dev); | 286 | const void *device_get_match_data(struct device *dev); |
287 | 287 | ||
288 | int device_get_phy_mode(struct device *dev); | 288 | int device_get_phy_mode(struct device *dev); |
289 | 289 | ||