pinctrl: mediatek: moore: replace struct function_desc with struct pinfunction

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.

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
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>
This commit is contained in:
Bartosz Golaszewski 2025-09-02 13:59:15 +02:00 committed by Linus Walleij
parent 7a24f1f5b2
commit bd6f4a9140
9 changed files with 11 additions and 16 deletions

View File

@ -622,11 +622,9 @@ static int mtk_build_functions(struct mtk_pinctrl *hw)
int i, err;
for (i = 0; i < hw->soc->nfuncs ; i++) {
const struct function_desc *function = hw->soc->funcs + i;
const struct pinfunction *func = &function->func;
const struct pinfunction *func = hw->soc->funcs + i;
err = pinmux_generic_add_pinfunction(hw->pctrl, func,
function->data);
err = pinmux_generic_add_pinfunction(hw->pctrl, func, NULL);
if (err < 0) {
dev_err(hw->dev, "Failed to register function %s\n",
func->name);

View File

@ -43,11 +43,8 @@
.data = id##_funcs, \
}
#define PINCTRL_PIN_FUNCTION(_name_, id) \
{ \
.func = PINCTRL_PINFUNCTION(_name_, id##_groups, ARRAY_SIZE(id##_groups)), \
.data = NULL, \
}
#define PINCTRL_PIN_FUNCTION(_name_, id) \
PINCTRL_PINFUNCTION(_name_, id##_groups, ARRAY_SIZE(id##_groups))
int mtk_moore_pinctrl_probe(struct platform_device *pdev,
const struct mtk_pin_soc *soc);

View File

@ -822,7 +822,7 @@ static const char *mt7622_uart_groups[] = { "uart0_0_tx_rx",
"uart4_2_rts_cts",};
static const char *mt7622_wdt_groups[] = { "watchdog", };
static const struct function_desc mt7622_functions[] = {
static const struct pinfunction mt7622_functions[] = {
PINCTRL_PIN_FUNCTION("antsel", mt7622_antsel),
PINCTRL_PIN_FUNCTION("emmc", mt7622_emmc),
PINCTRL_PIN_FUNCTION("eth", mt7622_ethernet),

View File

@ -1340,7 +1340,7 @@ static const char *mt7623_uart_groups[] = { "uart0_0_txd_rxd",
"uart3_rts_cts", };
static const char *mt7623_wdt_groups[] = { "watchdog_0", "watchdog_1", };
static const struct function_desc mt7623_functions[] = {
static const struct pinfunction mt7623_functions[] = {
PINCTRL_PIN_FUNCTION("audck", mt7623_aud_clk),
PINCTRL_PIN_FUNCTION("disp", mt7623_disp_pwm),
PINCTRL_PIN_FUNCTION("eth", mt7623_ethernet),

View File

@ -384,7 +384,7 @@ static const char *mt7629_wdt_groups[] = { "watchdog", };
static const char *mt7629_wifi_groups[] = { "wf0_5g", "wf0_2g", };
static const char *mt7629_flash_groups[] = { "snfi", "spi_nor" };
static const struct function_desc mt7629_functions[] = {
static const struct pinfunction mt7629_functions[] = {
PINCTRL_PIN_FUNCTION("eth", mt7629_ethernet),
PINCTRL_PIN_FUNCTION("i2c", mt7629_i2c),
PINCTRL_PIN_FUNCTION("led", mt7629_led),

View File

@ -977,7 +977,7 @@ static const char *mt7981_ethernet_groups[] = { "smi_mdc_mdio", "gbe_ext_mdc_mdi
"wf0_mode1", "wf0_mode3", "mt7531_int", };
static const char *mt7981_ant_groups[] = { "ant_sel", };
static const struct function_desc mt7981_functions[] = {
static const struct pinfunction mt7981_functions[] = {
PINCTRL_PIN_FUNCTION("wa_aice", mt7981_wa_aice),
PINCTRL_PIN_FUNCTION("dfd", mt7981_dfd),
PINCTRL_PIN_FUNCTION("jtag", mt7981_jtag),

View File

@ -878,7 +878,7 @@ static const char *mt7986_uart_groups[] = {
static const char *mt7986_wdt_groups[] = { "watchdog", };
static const char *mt7986_wf_groups[] = { "wf_2g", "wf_5g", "wf_dbdc", };
static const struct function_desc mt7986_functions[] = {
static const struct pinfunction mt7986_functions[] = {
PINCTRL_PIN_FUNCTION("audio", mt7986_audio),
PINCTRL_PIN_FUNCTION("emmc", mt7986_emmc),
PINCTRL_PIN_FUNCTION("eth", mt7986_ethernet),

View File

@ -1464,7 +1464,7 @@ static const char * const mt7988_usb_groups[] = {
"drv_vbus_p1",
};
static const struct function_desc mt7988_functions[] = {
static const struct pinfunction mt7988_functions[] = {
PINCTRL_PIN_FUNCTION("audio", mt7988_audio),
PINCTRL_PIN_FUNCTION("jtag", mt7988_jtag),
PINCTRL_PIN_FUNCTION("int_usxgmii", mt7988_int_usxgmii),

View File

@ -238,7 +238,7 @@ struct mtk_pin_soc {
unsigned int npins;
const struct group_desc *grps;
unsigned int ngrps;
const struct function_desc *funcs;
const struct pinfunction *funcs;
unsigned int nfuncs;
const struct mtk_eint_regs *eint_regs;
const struct mtk_eint_hw *eint_hw;