kfree(soc_dev);
}
-static void soc_device_get_machine(struct soc_device_attribute *soc_dev_attr)
+int soc_attr_read_machine(struct soc_device_attribute *soc_dev_attr)
{
- struct device_node *np;
-
if (soc_dev_attr->machine)
- return;
+ return -EBUSY;
- np = of_find_node_by_path("/");
- of_property_read_string(np, "model", &soc_dev_attr->machine);
- of_node_put(np);
+ return of_machine_read_model(&soc_dev_attr->machine);
}
+EXPORT_SYMBOL_GPL(soc_attr_read_machine);
static struct soc_device_attribute *early_soc_dev_attr;
const struct attribute_group **soc_attr_groups;
int ret;
- soc_device_get_machine(soc_dev_attr);
+ soc_attr_read_machine(soc_dev_attr);
if (!soc_bus_registered) {
if (early_soc_dev_attr)
*/
struct device *soc_device_to_device(struct soc_device *soc);
+/**
+ * soc_attr_read_machine - retrieve the machine model and store it in
+ * the soc_device_attribute structure
+ * @soc_dev_attr: SoC attribute structure to store the model in
+ *
+ * Returns:
+ * 0 on success, negative error number on failure.
+ */
+int soc_attr_read_machine(struct soc_device_attribute *soc_dev_attr);
+
#ifdef CONFIG_SOC_BUS
const struct soc_device_attribute *soc_device_match(
const struct soc_device_attribute *matches);