diff options
author | Claudiu Beznea <claudiu.beznea@microchip.com> | 2023-03-02 14:01:14 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2023-03-07 16:10:44 +0300 |
commit | 1ffd07c619499f013aa087e0855c5bc7170dce97 (patch) | |
tree | 0655dab0f4c219afb040f2b5b2e6d1073d1698ea /drivers/pinctrl/pinctrl-at91-pio4.c | |
parent | 8d35039d762d879543dec68ac15398b26fd8c759 (diff) | |
download | linux-1ffd07c619499f013aa087e0855c5bc7170dce97.tar.xz |
pinctrl: at91-pio4: use device_get_match_data()
Use device_get_match_data() to simplify the code.
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230302110116.342486-3-claudiu.beznea@microchip.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-at91-pio4.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-at91-pio4.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index f7c37b90b711..58bce1457063 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -1067,7 +1067,6 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct pinctrl_pin_desc *pin_desc; const char **group_names; - const struct of_device_id *match; int i, ret; struct atmel_pioctrl *atmel_pioctrl; const struct atmel_pioctrl_data *atmel_pioctrl_data; @@ -1079,12 +1078,11 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) atmel_pioctrl->node = dev->of_node; platform_set_drvdata(pdev, atmel_pioctrl); - match = of_match_node(atmel_pctrl_of_match, dev->of_node); - if (!match) { - dev_err(dev, "unknown compatible string\n"); + atmel_pioctrl_data = device_get_match_data(dev); + if (!atmel_pioctrl_data) { + dev_err(dev, "Invalid device data\n"); return -ENODEV; } - atmel_pioctrl_data = match->data; atmel_pioctrl->nbanks = atmel_pioctrl_data->nbanks; atmel_pioctrl->npins = atmel_pioctrl->nbanks * ATMEL_PIO_NPINS_PER_BANK; /* if last bank has limited number of pins, adjust accordingly */ |