Skip to content

Commit 63bffc2

Browse files
robherringlinusw
authored andcommitted
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: Rob Herring <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent e2b0bac commit 63bffc2

19 files changed

+59
-108
lines changed

drivers/pinctrl/bcm/pinctrl-ns.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
#include <linux/io.h>
88
#include <linux/module.h>
99
#include <linux/of.h>
10-
#include <linux/of_device.h>
1110
#include <linux/pinctrl/pinconf-generic.h>
1211
#include <linux/pinctrl/pinctrl.h>
1312
#include <linux/pinctrl/pinmux.h>
1413
#include <linux/platform_device.h>
14+
#include <linux/property.h>
1515
#include <linux/slab.h>
1616

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

226225
ns_pinctrl->dev = dev;
227226

228-
of_id = of_match_device(ns_pinctrl_of_match_table, dev);
229-
if (!of_id)
230-
return -EINVAL;
231-
ns_pinctrl->chipset_flag = (uintptr_t)of_id->data;
227+
ns_pinctrl->chipset_flag = (uintptr_t)device_get_match_data(dev);
232228

233229
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
234230
"cru_gpio_control");

drivers/pinctrl/berlin/berlin-bg2.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
*/
99

1010
#include <linux/init.h>
11-
#include <linux/of_device.h>
11+
#include <linux/of.h>
1212
#include <linux/platform_device.h>
13+
#include <linux/property.h>
1314
#include <linux/regmap.h>
1415

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

228229
static int berlin2_pinctrl_probe(struct platform_device *pdev)
229230
{
230-
const struct of_device_id *match =
231-
of_match_device(berlin2_pinctrl_match, &pdev->dev);
232-
233-
return berlin_pinctrl_probe(pdev, match->data);
231+
return berlin_pinctrl_probe(pdev, device_get_match_data(&pdev->dev));
234232
}
235233

236234
static struct platform_driver berlin2_pinctrl_driver = {

drivers/pinctrl/berlin/berlin-bg2cd.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
*/
99

1010
#include <linux/init.h>
11-
#include <linux/of_device.h>
11+
#include <linux/of.h>
1212
#include <linux/platform_device.h>
13+
#include <linux/property.h>
1314
#include <linux/regmap.h>
1415

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

173174
static int berlin2cd_pinctrl_probe(struct platform_device *pdev)
174175
{
175-
const struct of_device_id *match =
176-
of_match_device(berlin2cd_pinctrl_match, &pdev->dev);
177-
178-
return berlin_pinctrl_probe(pdev, match->data);
176+
return berlin_pinctrl_probe(pdev, device_get_match_data(&pdev->dev));
179177
}
180178

181179
static struct platform_driver berlin2cd_pinctrl_driver = {

drivers/pinctrl/berlin/berlin-bg2q.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
*/
99

1010
#include <linux/init.h>
11-
#include <linux/of_device.h>
11+
#include <linux/of.h>
1212
#include <linux/platform_device.h>
13+
#include <linux/property.h>
1314
#include <linux/regmap.h>
1415

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

390391
static int berlin2q_pinctrl_probe(struct platform_device *pdev)
391392
{
392-
const struct of_device_id *match =
393-
of_match_device(berlin2q_pinctrl_match, &pdev->dev);
394-
395-
return berlin_pinctrl_probe(pdev, match->data);
393+
return berlin_pinctrl_probe(pdev, device_get_match_data(&pdev->dev));
396394
}
397395

398396
static struct platform_driver berlin2q_pinctrl_driver = {

drivers/pinctrl/berlin/berlin-bg4ct.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
*/
99

1010
#include <linux/init.h>
11-
#include <linux/of_device.h>
11+
#include <linux/of.h>
1212
#include <linux/platform_device.h>
13+
#include <linux/property.h>
1314
#include <linux/regmap.h>
1415

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

450451
static int berlin4ct_pinctrl_probe(struct platform_device *pdev)
451452
{
452-
const struct of_device_id *match =
453-
of_match_device(berlin4ct_pinctrl_match, &pdev->dev);
453+
const struct berlin_pinctrl_desc *desc =
454+
device_get_match_data(&pdev->dev);
454455
struct regmap_config *rmconfig;
455456
struct regmap *regmap;
456457
struct resource *res;
@@ -473,7 +474,7 @@ static int berlin4ct_pinctrl_probe(struct platform_device *pdev)
473474
if (IS_ERR(regmap))
474475
return PTR_ERR(regmap);
475476

476-
return berlin_pinctrl_probe_regmap(pdev, match->data, regmap);
477+
return berlin_pinctrl_probe_regmap(pdev, desc, regmap);
477478
}
478479

479480
static struct platform_driver berlin4ct_pinctrl_driver = {

drivers/pinctrl/berlin/pinctrl-as370.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
*/
99

1010
#include <linux/init.h>
11-
#include <linux/of_device.h>
11+
#include <linux/of.h>
1212
#include <linux/platform_device.h>
13+
#include <linux/property.h>
1314
#include <linux/regmap.h>
1415

1516
#include "berlin.h"
@@ -330,8 +331,8 @@ static const struct of_device_id as370_pinctrl_match[] = {
330331

331332
static int as370_pinctrl_probe(struct platform_device *pdev)
332333
{
333-
const struct of_device_id *match =
334-
of_match_device(as370_pinctrl_match, &pdev->dev);
334+
const struct berlin_pinctrl_desc *desc =
335+
device_get_match_data(&pdev->dev);
335336
struct regmap_config *rmconfig;
336337
struct regmap *regmap;
337338
struct resource *res;
@@ -354,7 +355,7 @@ static int as370_pinctrl_probe(struct platform_device *pdev)
354355
if (IS_ERR(regmap))
355356
return PTR_ERR(regmap);
356357

357-
return berlin_pinctrl_probe_regmap(pdev, match->data, regmap);
358+
return berlin_pinctrl_probe_regmap(pdev, desc, regmap);
358359
}
359360

360361
static struct platform_driver as370_pinctrl_driver = {

drivers/pinctrl/mvebu/pinctrl-armada-38x.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include <linux/io.h>
1313
#include <linux/platform_device.h>
1414
#include <linux/of.h>
15-
#include <linux/of_device.h>
1615
#include <linux/pinctrl/pinctrl.h>
16+
#include <linux/property.h>
1717

1818
#include "pinctrl-mvebu.h"
1919

@@ -404,13 +404,8 @@ static struct pinctrl_gpio_range armada_38x_mpp_gpio_ranges[] = {
404404
static int armada_38x_pinctrl_probe(struct platform_device *pdev)
405405
{
406406
struct mvebu_pinctrl_soc_info *soc = &armada_38x_pinctrl_info;
407-
const struct of_device_id *match =
408-
of_match_device(armada_38x_pinctrl_of_match, &pdev->dev);
409407

410-
if (!match)
411-
return -ENODEV;
412-
413-
soc->variant = (unsigned) match->data & 0xff;
408+
soc->variant = (unsigned)device_get_match_data(&pdev->dev) & 0xff;
414409
soc->controls = armada_38x_mpp_controls;
415410
soc->ncontrols = ARRAY_SIZE(armada_38x_mpp_controls);
416411
soc->gpioranges = armada_38x_mpp_gpio_ranges;

drivers/pinctrl/mvebu/pinctrl-armada-39x.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include <linux/io.h>
1313
#include <linux/platform_device.h>
1414
#include <linux/of.h>
15-
#include <linux/of_device.h>
1615
#include <linux/pinctrl/pinctrl.h>
16+
#include <linux/property.h>
1717

1818
#include "pinctrl-mvebu.h"
1919

@@ -386,13 +386,8 @@ static struct pinctrl_gpio_range armada_39x_mpp_gpio_ranges[] = {
386386
static int armada_39x_pinctrl_probe(struct platform_device *pdev)
387387
{
388388
struct mvebu_pinctrl_soc_info *soc = &armada_39x_pinctrl_info;
389-
const struct of_device_id *match =
390-
of_match_device(armada_39x_pinctrl_of_match, &pdev->dev);
391389

392-
if (!match)
393-
return -ENODEV;
394-
395-
soc->variant = (unsigned) match->data & 0xff;
390+
soc->variant = (unsigned)device_get_match_data(&pdev->dev) & 0xff;
396391
soc->controls = armada_39x_mpp_controls;
397392
soc->ncontrols = ARRAY_SIZE(armada_39x_mpp_controls);
398393
soc->gpioranges = armada_39x_mpp_gpio_ranges;

drivers/pinctrl/mvebu/pinctrl-armada-ap806.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <linux/io.h>
1414
#include <linux/platform_device.h>
1515
#include <linux/of.h>
16-
#include <linux/of_device.h>
1716
#include <linux/pinctrl/pinctrl.h>
1817

1918
#include "pinctrl-mvebu.h"
@@ -106,10 +105,8 @@ static struct pinctrl_gpio_range armada_ap806_mpp_gpio_ranges[] = {
106105
static int armada_ap806_pinctrl_probe(struct platform_device *pdev)
107106
{
108107
struct mvebu_pinctrl_soc_info *soc = &armada_ap806_pinctrl_info;
109-
const struct of_device_id *match =
110-
of_match_device(armada_ap806_pinctrl_of_match, &pdev->dev);
111108

112-
if (!match || !pdev->dev.parent)
109+
if (!pdev->dev.parent)
113110
return -ENODEV;
114111

115112
soc->variant = 0; /* no variants for Armada AP806 */

drivers/pinctrl/mvebu/pinctrl-armada-cp110.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#include <linux/io.h>
1313
#include <linux/mfd/syscon.h>
1414
#include <linux/of.h>
15-
#include <linux/of_device.h>
1615
#include <linux/pinctrl/pinctrl.h>
1716
#include <linux/platform_device.h>
17+
#include <linux/property.h>
1818

1919
#include "pinctrl-mvebu.h"
2020

@@ -638,8 +638,6 @@ static void mvebu_pinctrl_assign_variant(struct mvebu_mpp_mode *m,
638638
static int armada_cp110_pinctrl_probe(struct platform_device *pdev)
639639
{
640640
struct mvebu_pinctrl_soc_info *soc;
641-
const struct of_device_id *match =
642-
of_match_device(armada_cp110_pinctrl_of_match, &pdev->dev);
643641
int i;
644642

645643
if (!pdev->dev.parent)
@@ -650,7 +648,7 @@ static int armada_cp110_pinctrl_probe(struct platform_device *pdev)
650648
if (!soc)
651649
return -ENOMEM;
652650

653-
soc->variant = (unsigned long) match->data & 0xff;
651+
soc->variant = (unsigned long)device_get_match_data(&pdev->dev) & 0xff;
654652
soc->controls = armada_cp110_mpp_controls;
655653
soc->ncontrols = ARRAY_SIZE(armada_cp110_mpp_controls);
656654
soc->modes = armada_cp110_mpp_modes;

0 commit comments

Comments
 (0)