···546546EXPORT_SYMBOL(of_machine_is_compatible);547547548548/**549549- * of_machine_get_model_name - Find and read the model name or the compatible550550- * value for the machine.551551- * @model: pointer to null terminated return string, modified only if552552- * return value is 0.553553- *554554- * Returns a string containing either the model name or the compatible value555555- * of the machine if found, else return error.556556- *557557- * Search for a machine model name or the compatible if model name is missing558558- * in a device tree node and retrieve a null terminated string value (pointer559559- * to data, not a copy). Returns 0 on success, -EINVAL if root of the device560560- * tree is not found and other error returned by of_property_read_string on561561- * failure.562562- */563563-int of_machine_get_model_name(const char **model)564564-{565565- int error;566566-567567- if (!of_node_get(of_root))568568- return -EINVAL;569569-570570- error = of_property_read_string(of_root, "model", model);571571- if (error)572572- error = of_property_read_string_index(of_root, "compatible",573573- 0, model);574574- of_node_put(of_root);575575-576576- return error;577577-}578578-EXPORT_SYMBOL(of_machine_get_model_name);579579-580580-/**581549 * __of_device_is_available - check if a device is available for use582550 *583551 * @device: Node to check for availability, with locks already held
-6
include/linux/of.h
···367367extern int of_alias_get_highest_id(const char *stem);368368369369extern int of_machine_is_compatible(const char *compat);370370-extern int of_machine_get_model_name(const char **model);371370372371extern int of_add_property(struct device_node *np, struct property *prop);373372extern int of_remove_property(struct device_node *np, struct property *prop);···786787static inline int of_machine_is_compatible(const char *compat)787788{788789 return 0;789789-}790790-791791-static inline int of_machine_get_model_name(const char **model)792792-{793793- return -EINVAL;794790}795791796792static inline bool of_console_check(const struct device_node *dn, const char *name, int index)