*参照元 [#j695e091] #backlinks *説明 [#y9ae28e0] -パス: [[linux-4.4.1/drivers/gpio/gpiolib-of.c]] -FIXME: これは何? --説明 **引数 [#z774e5f9] -struct gpio_chip *chip -- --[[linux-4.4.1/gpio_chip]] **返り値 [#e3810d89] -int **参考 [#w62a4b9f] *実装 [#o9ef10e1] #ifdef CONFIG_PINCTRL - --[[linux-4.4.1/CONFIG_PINCTRL]] static int of_gpiochip_add_pin_range(struct gpio_chip *chip) { struct device_node *np = chip->of_node; struct of_phandle_args pinspec; struct pinctrl_dev *pctldev; int index = 0, ret; const char *name; static const char group_names_propname[] = "gpio-ranges-group-names"; struct property *group_names; - --[[linux-4.4.1/device_node]] --[[linux-4.4.1/of_phandle_args]] --[[linux-4.4.1/pinctrl_dev]] --[[linux-4.4.1/property]] if (!np) return 0; group_names = of_find_property(np, group_names_propname, NULL); - --[[linux-4.4.1/of_find_property()]] for (;; index++) { ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, index, &pinspec); if (ret) break; - --[[linux-4.4.1/of_parse_phandle_with_fixed_args()]] pctldev = of_pinctrl_get(pinspec.np); if (!pctldev) return -EPROBE_DEFER; - --[[linux-4.4.1/of_pinctrl_get()]] if (pinspec.args[2]) { if (group_names) { of_property_read_string_index(np, group_names_propname, index, &name); if (strlen(name)) { pr_err("%s: Group name of numeric GPIO ranges must be the empty string.\n", np->full_name); break; } } - --[[linux-4.4.1/of_property_read_string_index()]] --[[linux-4.4.1/strlen()]] /* npins != 0: linear range */ ret = gpiochip_add_pin_range(chip, pinctrl_dev_get_devname(pctldev), pinspec.args[0], pinspec.args[1], pinspec.args[2]); if (ret) return ret; - --[[linux-4.4.1/gpiochip_add_pin_range()]] --[[linux-4.4.1/pinctrl_dev_get_devname()]] } else { /* npins == 0: special range */ if (pinspec.args[1]) { pr_err("%s: Illegal gpio-range format.\n", np->full_name); break; } - --[[linux-4.4.1/pr_err()]] if (!group_names) { pr_err("%s: GPIO group range requested but no %s property.\n", np->full_name, group_names_propname); break; } ret = of_property_read_string_index(np, group_names_propname, index, &name); if (ret) break; - --[[linux-4.4.1/of_property_read_string_index()]] if (!strlen(name)) { pr_err("%s: Group name of GPIO group range cannot be the empty string.\n", np->full_name); break; } ret = gpiochip_add_pingroup_range(chip, pctldev, pinspec.args[0], name); if (ret) return ret; - --[[linux-4.4.1/gpio_chip_add_pingroup_range()]] --[[linux-4.4.1/gpiochip_add_pingroup_range()]] } } return 0; } #else static int of_gpiochip_add_pin_range(struct gpio_chip *chip) { return 0; } #endif *コメント [#q656dea0]