Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

base: soc: rename and export soc_device_get_machine()

Some SoC drivers reimplement the functionality of
soc_device_get_machine(). Make this function accessible through the
sys_soc.h header and rename it to a more descriptive name.

Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20260223-soc-of-root-v2-4-b45da45903c8@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Bartosz Golaszewski and committed by
Greg Kroah-Hartman
030706e9 e06c3b13

+15 -8
+5 -8
drivers/base/soc.c
··· 111 111 kfree(soc_dev); 112 112 } 113 113 114 - static void soc_device_get_machine(struct soc_device_attribute *soc_dev_attr) 114 + int soc_attr_read_machine(struct soc_device_attribute *soc_dev_attr) 115 115 { 116 - struct device_node *np; 117 - 118 116 if (soc_dev_attr->machine) 119 - return; 117 + return -EBUSY; 120 118 121 - np = of_find_node_by_path("/"); 122 - of_property_read_string(np, "model", &soc_dev_attr->machine); 123 - of_node_put(np); 119 + return of_machine_read_model(&soc_dev_attr->machine); 124 120 } 121 + EXPORT_SYMBOL_GPL(soc_attr_read_machine); 125 122 126 123 static struct soc_device_attribute *early_soc_dev_attr; 127 124 ··· 128 131 const struct attribute_group **soc_attr_groups; 129 132 int ret; 130 133 131 - soc_device_get_machine(soc_dev_attr); 134 + soc_attr_read_machine(soc_dev_attr); 132 135 133 136 if (!soc_bus_registered) { 134 137 if (early_soc_dev_attr)
+10
include/linux/sys_soc.h
··· 37 37 */ 38 38 struct device *soc_device_to_device(struct soc_device *soc); 39 39 40 + /** 41 + * soc_attr_read_machine - retrieve the machine model and store it in 42 + * the soc_device_attribute structure 43 + * @soc_dev_attr: SoC attribute structure to store the model in 44 + * 45 + * Returns: 46 + * 0 on success, negative error number on failure. 47 + */ 48 + int soc_attr_read_machine(struct soc_device_attribute *soc_dev_attr); 49 + 40 50 #ifdef CONFIG_SOC_BUS 41 51 const struct soc_device_attribute *soc_device_match( 42 52 const struct soc_device_attribute *matches);