| // SPDX-License-Identifier: GPL-2.0 |
| * Linux kernel module helpers. |
| #include <linux/module.h> |
| #include <linux/string.h> |
| ssize_t of_modalias(const struct device_node *np, char *str, ssize_t len) |
| /* %p eats all alphanum characters, so %c must be used here */ |
| csize = snprintf(str, len, "of:N%pOFn%c%s", np, 'T', |
| of_node_get_device_type(np)); |
| of_property_for_each_string(np, "compatible", p, compat) { |
| csize = strlen(compat) + 1; |
| csize = snprintf(str, len, "C%s", compat); |
| int of_request_module(const struct device_node *np) |
| size = of_modalias(np, NULL, 0); |
| /* Reserve an additional byte for the trailing '\0' */ |
| str = kmalloc(size, GFP_KERNEL); |
| of_modalias(np, str, size); |
| ret = request_module(str); |
| EXPORT_SYMBOL_GPL(of_request_module); |