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.

pinctrl: ingenic: use struct pinfunction instead of struct function_desc

struct function_desc is a wrapper around struct pinfunction with an
additional void *data pointer. This driver doesn't use the data pointer.
We're also working towards reducing the usage of struct function_desc in
pinctrl drivers - they should only be created by pinmux core and
accessed by drivers using pinmux_generic_get_function(). Replace the
struct function_desc objects in this driver with smaller struct
pinfunction instances.

Acked-by: Paul Cercueil <paul@crapouillou.net>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Bartosz Golaszewski and committed by
Linus Walleij
77377744 d364d2ad

+20 -25
+20 -25
drivers/pinctrl/pinctrl-ingenic.c
··· 96 96 .data = (void *)func, \ 97 97 } 98 98 99 - #define INGENIC_PIN_FUNCTION(_name_, id) \ 100 - { \ 101 - .func = PINCTRL_PINFUNCTION(_name_, id##_groups, ARRAY_SIZE(id##_groups)), \ 102 - .data = NULL, \ 103 - } 99 + #define INGENIC_PIN_FUNCTION(_name_, id) \ 100 + PINCTRL_PINFUNCTION(_name_, id##_groups, ARRAY_SIZE(id##_groups)) 104 101 105 102 enum jz_version { 106 103 ID_JZ4730, ··· 125 128 const struct group_desc *groups; 126 129 unsigned int num_groups; 127 130 128 - const struct function_desc *functions; 131 + const struct pinfunction *functions; 129 132 unsigned int num_functions; 130 133 131 134 const u32 *pull_ups, *pull_downs; ··· 260 263 static const char *jz4730_mii_groups[] = { "mii", }; 261 264 static const char *jz4730_i2s_groups[] = { "i2s-data", "i2s-master", "i2s-slave", }; 262 265 263 - static const struct function_desc jz4730_functions[] = { 266 + static const struct pinfunction jz4730_functions[] = { 264 267 INGENIC_PIN_FUNCTION("mmc", jz4730_mmc), 265 268 INGENIC_PIN_FUNCTION("uart0", jz4730_uart0), 266 269 INGENIC_PIN_FUNCTION("uart1", jz4730_uart1), ··· 367 370 static const char *jz4740_pwm6_groups[] = { "pwm6", }; 368 371 static const char *jz4740_pwm7_groups[] = { "pwm7", }; 369 372 370 - static const struct function_desc jz4740_functions[] = { 373 + static const struct pinfunction jz4740_functions[] = { 371 374 INGENIC_PIN_FUNCTION("mmc", jz4740_mmc), 372 375 INGENIC_PIN_FUNCTION("uart0", jz4740_uart0), 373 376 INGENIC_PIN_FUNCTION("uart1", jz4740_uart1), ··· 471 474 static const char *jz4725b_pwm4_groups[] = { "pwm4", }; 472 475 static const char *jz4725b_pwm5_groups[] = { "pwm5", }; 473 476 474 - static const struct function_desc jz4725b_functions[] = { 477 + static const struct pinfunction jz4725b_functions[] = { 475 478 INGENIC_PIN_FUNCTION("mmc0", jz4725b_mmc0), 476 479 INGENIC_PIN_FUNCTION("mmc1", jz4725b_mmc1), 477 480 INGENIC_PIN_FUNCTION("uart", jz4725b_uart), ··· 603 606 static const char *jz4750_pwm4_groups[] = { "pwm4", }; 604 607 static const char *jz4750_pwm5_groups[] = { "pwm5", }; 605 608 606 - static const struct function_desc jz4750_functions[] = { 609 + static const struct pinfunction jz4750_functions[] = { 607 610 INGENIC_PIN_FUNCTION("uart0", jz4750_uart0), 608 611 INGENIC_PIN_FUNCTION("uart1", jz4750_uart1), 609 612 INGENIC_PIN_FUNCTION("uart2", jz4750_uart2), ··· 768 771 static const char *jz4755_pwm4_groups[] = { "pwm4", }; 769 772 static const char *jz4755_pwm5_groups[] = { "pwm5", }; 770 773 771 - static const struct function_desc jz4755_functions[] = { 774 + static const struct pinfunction jz4755_functions[] = { 772 775 INGENIC_PIN_FUNCTION("uart0", jz4755_uart0), 773 776 INGENIC_PIN_FUNCTION("uart1", jz4755_uart1), 774 777 INGENIC_PIN_FUNCTION("uart2", jz4755_uart2), ··· 1103 1106 static const char *jz4760_pwm7_groups[] = { "pwm7", }; 1104 1107 static const char *jz4760_otg_groups[] = { "otg-vbus", }; 1105 1108 1106 - static const struct function_desc jz4760_functions[] = { 1109 + static const struct pinfunction jz4760_functions[] = { 1107 1110 INGENIC_PIN_FUNCTION("uart0", jz4760_uart0), 1108 1111 INGENIC_PIN_FUNCTION("uart1", jz4760_uart1), 1109 1112 INGENIC_PIN_FUNCTION("uart2", jz4760_uart2), ··· 1441 1444 static const char *jz4770_pwm7_groups[] = { "pwm7", }; 1442 1445 static const char *jz4770_mac_groups[] = { "mac-rmii", "mac-mii", }; 1443 1446 1444 - static const struct function_desc jz4770_functions[] = { 1447 + static const struct pinfunction jz4770_functions[] = { 1445 1448 INGENIC_PIN_FUNCTION("uart0", jz4770_uart0), 1446 1449 INGENIC_PIN_FUNCTION("uart1", jz4770_uart1), 1447 1450 INGENIC_PIN_FUNCTION("uart2", jz4770_uart2), ··· 1720 1723 }; 1721 1724 static const char *jz4775_otg_groups[] = { "otg-vbus", }; 1722 1725 1723 - static const struct function_desc jz4775_functions[] = { 1726 + static const struct pinfunction jz4775_functions[] = { 1724 1727 INGENIC_PIN_FUNCTION("uart0", jz4775_uart0), 1725 1728 INGENIC_PIN_FUNCTION("uart1", jz4775_uart1), 1726 1729 INGENIC_PIN_FUNCTION("uart2", jz4775_uart2), ··· 1973 1976 static const char *jz4780_cim_groups[] = { "cim-data", }; 1974 1977 static const char *jz4780_hdmi_ddc_groups[] = { "hdmi-ddc", }; 1975 1978 1976 - static const struct function_desc jz4780_functions[] = { 1979 + static const struct pinfunction jz4780_functions[] = { 1977 1980 INGENIC_PIN_FUNCTION("uart0", jz4770_uart0), 1978 1981 INGENIC_PIN_FUNCTION("uart1", jz4770_uart1), 1979 1982 INGENIC_PIN_FUNCTION("uart2", jz4780_uart2), ··· 2208 2211 static const char *x1000_pwm4_groups[] = { "pwm4", }; 2209 2212 static const char *x1000_mac_groups[] = { "mac", }; 2210 2213 2211 - static const struct function_desc x1000_functions[] = { 2214 + static const struct pinfunction x1000_functions[] = { 2212 2215 INGENIC_PIN_FUNCTION("uart0", x1000_uart0), 2213 2216 INGENIC_PIN_FUNCTION("uart1", x1000_uart1), 2214 2217 INGENIC_PIN_FUNCTION("uart2", x1000_uart2), ··· 2338 2341 static const char *x1500_pwm3_groups[] = { "pwm3", }; 2339 2342 static const char *x1500_pwm4_groups[] = { "pwm4", }; 2340 2343 2341 - static const struct function_desc x1500_functions[] = { 2344 + static const struct pinfunction x1500_functions[] = { 2342 2345 INGENIC_PIN_FUNCTION("uart0", x1500_uart0), 2343 2346 INGENIC_PIN_FUNCTION("uart1", x1500_uart1), 2344 2347 INGENIC_PIN_FUNCTION("uart2", x1500_uart2), ··· 2559 2562 2560 2563 static const char * const x1600_mac_groups[] = { "mac", }; 2561 2564 2562 - static const struct function_desc x1600_functions[] = { 2565 + static const struct pinfunction x1600_functions[] = { 2563 2566 INGENIC_PIN_FUNCTION("uart0", x1600_uart0), 2564 2567 INGENIC_PIN_FUNCTION("uart1", x1600_uart1), 2565 2568 INGENIC_PIN_FUNCTION("uart2", x1600_uart2), ··· 2776 2779 static const char *x1830_pwm7_groups[] = { "pwm7-c-18", "pwm7-c-28", }; 2777 2780 static const char *x1830_mac_groups[] = { "mac", }; 2778 2781 2779 - static const struct function_desc x1830_functions[] = { 2782 + static const struct pinfunction x1830_functions[] = { 2780 2783 INGENIC_PIN_FUNCTION("uart0", x1830_uart0), 2781 2784 INGENIC_PIN_FUNCTION("uart1", x1830_uart1), 2782 2785 INGENIC_PIN_FUNCTION("sfc", x1830_sfc), ··· 3222 3225 static const char *x2000_mac1_groups[] = { "mac1-rmii", "mac1-rgmii", }; 3223 3226 static const char *x2000_otg_groups[] = { "otg-vbus", }; 3224 3227 3225 - static const struct function_desc x2000_functions[] = { 3228 + static const struct pinfunction x2000_functions[] = { 3226 3229 INGENIC_PIN_FUNCTION("uart0", x2000_uart0), 3227 3230 INGENIC_PIN_FUNCTION("uart1", x2000_uart1), 3228 3231 INGENIC_PIN_FUNCTION("uart2", x2000_uart2), ··· 3446 3449 3447 3450 static const char *x2100_mac_groups[] = { "mac", }; 3448 3451 3449 - static const struct function_desc x2100_functions[] = { 3452 + static const struct pinfunction x2100_functions[] = { 3450 3453 INGENIC_PIN_FUNCTION("uart0", x2000_uart0), 3451 3454 INGENIC_PIN_FUNCTION("uart1", x2000_uart1), 3452 3455 INGENIC_PIN_FUNCTION("uart2", x2000_uart2), ··· 4568 4571 } 4569 4572 4570 4573 for (i = 0; i < chip_info->num_functions; i++) { 4571 - const struct function_desc *function = &chip_info->functions[i]; 4572 - const struct pinfunction *func = &function->func; 4574 + const struct pinfunction *func = &chip_info->functions[i]; 4573 4575 4574 - err = pinmux_generic_add_pinfunction(jzpc->pctl, func, 4575 - function->data); 4576 + err = pinmux_generic_add_pinfunction(jzpc->pctl, func, NULL); 4576 4577 if (err < 0) { 4577 4578 dev_err(dev, "Failed to register function %s\n", func->name); 4578 4579 return err;