pinctrl: samsung: Use generic of_device_get_match_data helper

Replace custom code with generic helper.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Marek Szyprowski 2017-01-26 10:29:23 +01:00 committed by Linus Walleij
parent ed07bda402
commit 9abc2b9097

View file

@ -27,6 +27,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/irqdomain.h> #include <linux/irqdomain.h>
#include <linux/of_device.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/syscore_ops.h> #include <linux/syscore_ops.h>
@ -956,15 +957,12 @@ static int samsung_gpiolib_unregister(struct platform_device *pdev,
return 0; return 0;
} }
static const struct of_device_id samsung_pinctrl_dt_match[];
/* retrieve the soc specific data */ /* retrieve the soc specific data */
static const struct samsung_pin_ctrl * static const struct samsung_pin_ctrl *
samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d, samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d,
struct platform_device *pdev) struct platform_device *pdev)
{ {
int id; int id;
const struct of_device_id *match;
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct device_node *np; struct device_node *np;
const struct samsung_pin_bank_data *bdata; const struct samsung_pin_bank_data *bdata;
@ -979,8 +977,8 @@ samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d,
dev_err(&pdev->dev, "failed to get alias id\n"); dev_err(&pdev->dev, "failed to get alias id\n");
return ERR_PTR(-ENOENT); return ERR_PTR(-ENOENT);
} }
match = of_match_node(samsung_pinctrl_dt_match, node); ctrl = of_device_get_match_data(&pdev->dev);
ctrl = (struct samsung_pin_ctrl *)match->data + id; ctrl += id;
d->suspend = ctrl->suspend; d->suspend = ctrl->suspend;
d->resume = ctrl->resume; d->resume = ctrl->resume;