diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2018-07-17 10:19:14 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-07-23 06:44:52 -0400 |
commit | 0ef7478639c5165a672f01b4024aacfffa951813 (patch) | |
tree | 54b65228df704e9a215fc70cb29636cc4dbdb205 | |
parent | b10134a3643dced57976f9346764144203cfb302 (diff) |
ACPI: property: Make the ACPI graph API private
The fwnode graph API is preferred over the ACPI graph API. Therefore
make the ACPI graph API private, and use it as a back-end for the
fwnode graph API only.
Unused functionality is removed while the functionality actually used
remains the same.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/property.c | 83 | ||||
-rw-r--r-- | include/linux/acpi.h | 8 |
2 files changed, 16 insertions, 75 deletions
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 5878d3678b38..19bdada64435 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c | |||
@@ -1033,10 +1033,10 @@ struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode) | |||
1033 | * @prev: Previous endpoint node or %NULL to get the first | 1033 | * @prev: Previous endpoint node or %NULL to get the first |
1034 | * | 1034 | * |
1035 | * Looks up next endpoint ACPI firmware node below a given @fwnode. Returns | 1035 | * Looks up next endpoint ACPI firmware node below a given @fwnode. Returns |
1036 | * %NULL if there is no next endpoint, ERR_PTR() in case of error. In case | 1036 | * %NULL if there is no next endpoint or in case of error. In case of success |
1037 | * of success the next endpoint is returned. | 1037 | * the next endpoint is returned. |
1038 | */ | 1038 | */ |
1039 | struct fwnode_handle *acpi_graph_get_next_endpoint( | 1039 | static struct fwnode_handle *acpi_graph_get_next_endpoint( |
1040 | const struct fwnode_handle *fwnode, struct fwnode_handle *prev) | 1040 | const struct fwnode_handle *fwnode, struct fwnode_handle *prev) |
1041 | { | 1041 | { |
1042 | struct fwnode_handle *port = NULL; | 1042 | struct fwnode_handle *port = NULL; |
@@ -1065,11 +1065,9 @@ struct fwnode_handle *acpi_graph_get_next_endpoint( | |||
1065 | endpoint = fwnode_get_next_child_node(port, NULL); | 1065 | endpoint = fwnode_get_next_child_node(port, NULL); |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | if (endpoint) { | 1068 | /* Endpoints must have "endpoint" property */ |
1069 | /* Endpoints must have "endpoint" property */ | 1069 | if (!fwnode_property_present(endpoint, "endpoint")) |
1070 | if (!fwnode_property_present(endpoint, "endpoint")) | 1070 | return NULL; |
1071 | return ERR_PTR(-EPROTO); | ||
1072 | } | ||
1073 | 1071 | ||
1074 | return endpoint; | 1072 | return endpoint; |
1075 | } | 1073 | } |
@@ -1106,18 +1104,12 @@ static struct fwnode_handle *acpi_graph_get_child_prop_value( | |||
1106 | /** | 1104 | /** |
1107 | * acpi_graph_get_remote_enpoint - Parses and returns remote end of an endpoint | 1105 | * acpi_graph_get_remote_enpoint - Parses and returns remote end of an endpoint |
1108 | * @fwnode: Endpoint firmware node pointing to a remote device | 1106 | * @fwnode: Endpoint firmware node pointing to a remote device |
1109 | * @parent: Firmware node of remote port parent is filled here if not %NULL | ||
1110 | * @port: Firmware node of remote port is filled here if not %NULL | ||
1111 | * @endpoint: Firmware node of remote endpoint is filled here if not %NULL | 1107 | * @endpoint: Firmware node of remote endpoint is filled here if not %NULL |
1112 | * | 1108 | * |
1113 | * Function parses remote end of ACPI firmware remote endpoint and fills in | 1109 | * Returns the remote endpoint corresponding to @__fwnode. NULL on error. |
1114 | * fields requested by the caller. Returns %0 in case of success and | ||
1115 | * negative errno otherwise. | ||
1116 | */ | 1110 | */ |
1117 | int acpi_graph_get_remote_endpoint(const struct fwnode_handle *__fwnode, | 1111 | static struct fwnode_handle * |
1118 | struct fwnode_handle **parent, | 1112 | acpi_graph_get_remote_endpoint(const struct fwnode_handle *__fwnode) |
1119 | struct fwnode_handle **port, | ||
1120 | struct fwnode_handle **endpoint) | ||
1121 | { | 1113 | { |
1122 | struct fwnode_handle *fwnode; | 1114 | struct fwnode_handle *fwnode; |
1123 | unsigned int port_nr, endpoint_nr; | 1115 | unsigned int port_nr, endpoint_nr; |
@@ -1128,47 +1120,27 @@ int acpi_graph_get_remote_endpoint(const struct fwnode_handle *__fwnode, | |||
1128 | ret = acpi_node_get_property_reference(__fwnode, "remote-endpoint", 0, | 1120 | ret = acpi_node_get_property_reference(__fwnode, "remote-endpoint", 0, |
1129 | &args); | 1121 | &args); |
1130 | if (ret) | 1122 | if (ret) |
1131 | return ret; | 1123 | return NULL; |
1132 | 1124 | ||
1133 | /* Ensure this is a device node. */ | 1125 | /* Ensure this is a device node. */ |
1134 | if (!is_acpi_device_node(args.fwnode)) | 1126 | if (!is_acpi_device_node(args.fwnode)) |
1135 | return -ENODEV; | 1127 | return NULL; |
1136 | 1128 | ||
1137 | /* | 1129 | /* |
1138 | * Always require two arguments with the reference: port and | 1130 | * Always require two arguments with the reference: port and |
1139 | * endpoint indices. | 1131 | * endpoint indices. |
1140 | */ | 1132 | */ |
1141 | if (args.nargs != 2) | 1133 | if (args.nargs != 2) |
1142 | return -EPROTO; | 1134 | return NULL; |
1143 | 1135 | ||
1144 | fwnode = args.fwnode; | 1136 | fwnode = args.fwnode; |
1145 | port_nr = args.args[0]; | 1137 | port_nr = args.args[0]; |
1146 | endpoint_nr = args.args[1]; | 1138 | endpoint_nr = args.args[1]; |
1147 | 1139 | ||
1148 | if (parent) | ||
1149 | *parent = fwnode; | ||
1150 | |||
1151 | if (!port && !endpoint) | ||
1152 | return 0; | ||
1153 | |||
1154 | fwnode = acpi_graph_get_child_prop_value(fwnode, "port", port_nr); | 1140 | fwnode = acpi_graph_get_child_prop_value(fwnode, "port", port_nr); |
1155 | if (!fwnode) | ||
1156 | return -EPROTO; | ||
1157 | |||
1158 | if (port) | ||
1159 | *port = fwnode; | ||
1160 | |||
1161 | if (!endpoint) | ||
1162 | return 0; | ||
1163 | |||
1164 | fwnode = acpi_graph_get_child_prop_value(fwnode, "endpoint", | ||
1165 | endpoint_nr); | ||
1166 | if (!fwnode) | ||
1167 | return -EPROTO; | ||
1168 | 1141 | ||
1169 | *endpoint = fwnode; | 1142 | return acpi_graph_get_child_prop_value(fwnode, "endpoint", |
1170 | 1143 | endpoint_nr); | |
1171 | return 0; | ||
1172 | } | 1144 | } |
1173 | 1145 | ||
1174 | static bool acpi_fwnode_device_is_available(const struct fwnode_handle *fwnode) | 1146 | static bool acpi_fwnode_device_is_available(const struct fwnode_handle *fwnode) |
@@ -1233,29 +1205,6 @@ acpi_fwnode_get_reference_args(const struct fwnode_handle *fwnode, | |||
1233 | } | 1205 | } |
1234 | 1206 | ||
1235 | static struct fwnode_handle * | 1207 | static struct fwnode_handle * |
1236 | acpi_fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode, | ||
1237 | struct fwnode_handle *prev) | ||
1238 | { | ||
1239 | struct fwnode_handle *endpoint; | ||
1240 | |||
1241 | endpoint = acpi_graph_get_next_endpoint(fwnode, prev); | ||
1242 | if (IS_ERR(endpoint)) | ||
1243 | return NULL; | ||
1244 | |||
1245 | return endpoint; | ||
1246 | } | ||
1247 | |||
1248 | static struct fwnode_handle * | ||
1249 | acpi_fwnode_graph_get_remote_endpoint(const struct fwnode_handle *fwnode) | ||
1250 | { | ||
1251 | struct fwnode_handle *endpoint = NULL; | ||
1252 | |||
1253 | acpi_graph_get_remote_endpoint(fwnode, NULL, NULL, &endpoint); | ||
1254 | |||
1255 | return endpoint; | ||
1256 | } | ||
1257 | |||
1258 | static struct fwnode_handle * | ||
1259 | acpi_fwnode_get_parent(struct fwnode_handle *fwnode) | 1208 | acpi_fwnode_get_parent(struct fwnode_handle *fwnode) |
1260 | { | 1209 | { |
1261 | return acpi_node_get_parent(fwnode); | 1210 | return acpi_node_get_parent(fwnode); |
@@ -1295,9 +1244,9 @@ acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, | |||
1295 | .get_named_child_node = acpi_fwnode_get_named_child_node, \ | 1244 | .get_named_child_node = acpi_fwnode_get_named_child_node, \ |
1296 | .get_reference_args = acpi_fwnode_get_reference_args, \ | 1245 | .get_reference_args = acpi_fwnode_get_reference_args, \ |
1297 | .graph_get_next_endpoint = \ | 1246 | .graph_get_next_endpoint = \ |
1298 | acpi_fwnode_graph_get_next_endpoint, \ | 1247 | acpi_graph_get_next_endpoint, \ |
1299 | .graph_get_remote_endpoint = \ | 1248 | .graph_get_remote_endpoint = \ |
1300 | acpi_fwnode_graph_get_remote_endpoint, \ | 1249 | acpi_graph_get_remote_endpoint, \ |
1301 | .graph_get_port_parent = acpi_fwnode_get_parent, \ | 1250 | .graph_get_port_parent = acpi_fwnode_get_parent, \ |
1302 | .graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \ | 1251 | .graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \ |
1303 | }; \ | 1252 | }; \ |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 11cf39719fd8..de8d3d3fa651 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -1089,14 +1089,6 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode, | |||
1089 | struct fwnode_handle *child); | 1089 | struct fwnode_handle *child); |
1090 | struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode); | 1090 | struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode); |
1091 | 1091 | ||
1092 | struct fwnode_handle * | ||
1093 | acpi_graph_get_next_endpoint(const struct fwnode_handle *fwnode, | ||
1094 | struct fwnode_handle *prev); | ||
1095 | int acpi_graph_get_remote_endpoint(const struct fwnode_handle *fwnode, | ||
1096 | struct fwnode_handle **remote, | ||
1097 | struct fwnode_handle **port, | ||
1098 | struct fwnode_handle **endpoint); | ||
1099 | |||
1100 | struct acpi_probe_entry; | 1092 | struct acpi_probe_entry; |
1101 | typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *, | 1093 | typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *, |
1102 | struct acpi_probe_entry *); | 1094 | struct acpi_probe_entry *); |