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.

of: provide of_machine_read_model()

Provide a helper function allowing users to read the model string of the
machine, hiding the access to the root node.

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-2-b45da45903c8@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Bartosz Golaszewski and committed by
Greg Kroah-Hartman
c86d3b7b 59621105

+19
+13
drivers/of/base.c
··· 450 450 EXPORT_SYMBOL_GPL(of_machine_read_compatible); 451 451 452 452 /** 453 + * of_machine_read_model - Get the model string of this machine 454 + * @model: address at which the address of the model string will be stored 455 + * 456 + * Returns: 457 + * 0 on success, negative error number on failure. 458 + */ 459 + int of_machine_read_model(const char **model) 460 + { 461 + return of_property_read_string(of_root, "model", model); 462 + } 463 + EXPORT_SYMBOL_GPL(of_machine_read_model); 464 + 465 + /** 453 466 * of_machine_device_match - Test root of device tree against a of_device_id array 454 467 * @matches: NULL terminated array of of_device_id match structures to search in 455 468 *
+6
include/linux/of.h
··· 427 427 } 428 428 429 429 int of_machine_read_compatible(const char **compatible, unsigned int index); 430 + int of_machine_read_model(const char **model); 430 431 431 432 extern int of_add_property(struct device_node *np, struct property *prop); 432 433 extern int of_remove_property(struct device_node *np, struct property *prop); ··· 856 855 857 856 static inline int of_machine_read_compatible(const char **compatible, 858 857 unsigned int index) 858 + { 859 + return -ENOSYS; 860 + } 861 + 862 + static inline int of_machine_read_model(const char **model) 859 863 { 860 864 return -ENOSYS; 861 865 }