Commit 63bffc2d authored by Rob Herring's avatar Rob Herring Committed by Linus Walleij
Browse files

pinctrl: Use device_get_match_data()



Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: default avatarRob Herring <robh@kernel.org>
Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20231009172923.2457844-18-robh@kernel.org


Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent e2b0bac1
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -7,11 +7,11 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/pinctrl/pinconf-generic.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h>

#include "../core.h"
@@ -208,7 +208,6 @@ static const struct of_device_id ns_pinctrl_of_match_table[] = {
static int ns_pinctrl_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	const struct of_device_id *of_id;
	struct ns_pinctrl *ns_pinctrl;
	struct pinctrl_desc *pctldesc;
	struct pinctrl_pin_desc *pin;
@@ -225,10 +224,7 @@ static int ns_pinctrl_probe(struct platform_device *pdev)

	ns_pinctrl->dev = dev;

	of_id = of_match_device(ns_pinctrl_of_match_table, dev);
	if (!of_id)
		return -EINVAL;
	ns_pinctrl->chipset_flag = (uintptr_t)of_id->data;
	ns_pinctrl->chipset_flag = (uintptr_t)device_get_match_data(dev);

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
					   "cru_gpio_control");
+3 −5
Original line number Diff line number Diff line
@@ -8,8 +8,9 @@
 */

#include <linux/init.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>

#include "berlin.h"
@@ -227,10 +228,7 @@ static const struct of_device_id berlin2_pinctrl_match[] = {

static int berlin2_pinctrl_probe(struct platform_device *pdev)
{
	const struct of_device_id *match =
		of_match_device(berlin2_pinctrl_match, &pdev->dev);

	return berlin_pinctrl_probe(pdev, match->data);
	return berlin_pinctrl_probe(pdev, device_get_match_data(&pdev->dev));
}

static struct platform_driver berlin2_pinctrl_driver = {
+3 −5
Original line number Diff line number Diff line
@@ -8,8 +8,9 @@
 */

#include <linux/init.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>

#include "berlin.h"
@@ -172,10 +173,7 @@ static const struct of_device_id berlin2cd_pinctrl_match[] = {

static int berlin2cd_pinctrl_probe(struct platform_device *pdev)
{
	const struct of_device_id *match =
		of_match_device(berlin2cd_pinctrl_match, &pdev->dev);

	return berlin_pinctrl_probe(pdev, match->data);
	return berlin_pinctrl_probe(pdev, device_get_match_data(&pdev->dev));
}

static struct platform_driver berlin2cd_pinctrl_driver = {
+3 −5
Original line number Diff line number Diff line
@@ -8,8 +8,9 @@
 */

#include <linux/init.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>

#include "berlin.h"
@@ -389,10 +390,7 @@ static const struct of_device_id berlin2q_pinctrl_match[] = {

static int berlin2q_pinctrl_probe(struct platform_device *pdev)
{
	const struct of_device_id *match =
		of_match_device(berlin2q_pinctrl_match, &pdev->dev);

	return berlin_pinctrl_probe(pdev, match->data);
	return berlin_pinctrl_probe(pdev, device_get_match_data(&pdev->dev));
}

static struct platform_driver berlin2q_pinctrl_driver = {
+5 −4
Original line number Diff line number Diff line
@@ -8,8 +8,9 @@
 */

#include <linux/init.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>

#include "berlin.h"
@@ -449,8 +450,8 @@ static const struct of_device_id berlin4ct_pinctrl_match[] = {

static int berlin4ct_pinctrl_probe(struct platform_device *pdev)
{
	const struct of_device_id *match =
		of_match_device(berlin4ct_pinctrl_match, &pdev->dev);
	const struct berlin_pinctrl_desc *desc =
		device_get_match_data(&pdev->dev);
	struct regmap_config *rmconfig;
	struct regmap *regmap;
	struct resource *res;
@@ -473,7 +474,7 @@ static int berlin4ct_pinctrl_probe(struct platform_device *pdev)
	if (IS_ERR(regmap))
		return PTR_ERR(regmap);

	return berlin_pinctrl_probe_regmap(pdev, match->data, regmap);
	return berlin_pinctrl_probe_regmap(pdev, desc, regmap);
}

static struct platform_driver berlin4ct_pinctrl_driver = {
Loading