diff options
Diffstat (limited to 'drivers/base/soc.c')
| -rw-r--r-- | drivers/base/soc.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/base/soc.c b/drivers/base/soc.c index 282c38aece0d..65ce72d49230 100644 --- a/drivers/base/soc.c +++ b/drivers/base/soc.c @@ -5,16 +5,16 @@ * Author: Lee Jones <lee.jones@linaro.org> for ST-Ericsson. */ -#include <linux/sysfs.h> +#include <linux/err.h> +#include <linux/glob.h> +#include <linux/idr.h> #include <linux/init.h> #include <linux/of.h> -#include <linux/stat.h> #include <linux/slab.h> -#include <linux/idr.h> #include <linux/spinlock.h> +#include <linux/stat.h> +#include <linux/sysfs.h> #include <linux/sys_soc.h> -#include <linux/err.h> -#include <linux/glob.h> static DEFINE_IDA(soc_ida); @@ -111,17 +111,14 @@ static void soc_release(struct device *dev) 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; @@ -131,7 +128,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *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) @@ -140,13 +137,13 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr return NULL; } - soc_dev = kzalloc(sizeof(*soc_dev), GFP_KERNEL); + soc_dev = kzalloc_obj(*soc_dev); if (!soc_dev) { ret = -ENOMEM; goto out1; } - soc_attr_groups = kcalloc(3, sizeof(*soc_attr_groups), GFP_KERNEL); + soc_attr_groups = kzalloc_objs(*soc_attr_groups, 3); if (!soc_attr_groups) { ret = -ENOMEM; goto out2; |
