Skip to content

Commit 9bc44c5

Browse files
committed
Merge tag 'devicetree-for-6.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
Pull devicetree header detangling from Rob Herring: "Remove the circular including of of_device.h and of_platform.h along with all of their implicit includes. This is the culmination of several kernel cycles worth of fixing implicit DT includes throughout the tree" * tag 'devicetree-for-6.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: of: Stop circularly including of_device.h and of_platform.h clk: qcom: gcc-x1e80100: Replace of_device.h with explicit includes thermal: loongson2: Replace of_device.h with explicit includes net: can: Use device_get_match_data() sparc: Use device_get_match_data()
2 parents a638bfb + ef175b2 commit 9bc44c5

File tree

10 files changed

+30
-49
lines changed

10 files changed

+30
-49
lines changed

arch/sparc/kernel/pci_sabre.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
#include <linux/export.h>
1414
#include <linux/slab.h>
1515
#include <linux/interrupt.h>
16-
#include <linux/of_device.h>
16+
#include <linux/of.h>
17+
#include <linux/of_platform.h>
18+
#include <linux/platform_device.h>
19+
#include <linux/property.h>
1720

1821
#include <asm/apb.h>
1922
#include <asm/iommu.h>
@@ -456,7 +459,6 @@ static void sabre_pbm_init(struct pci_pbm_info *pbm,
456459
static const struct of_device_id sabre_match[];
457460
static int sabre_probe(struct platform_device *op)
458461
{
459-
const struct of_device_id *match;
460462
const struct linux_prom64_registers *pr_regs;
461463
struct device_node *dp = op->dev.of_node;
462464
struct pci_pbm_info *pbm;
@@ -466,8 +468,7 @@ static int sabre_probe(struct platform_device *op)
466468
const u32 *vdma;
467469
u64 clear_irq;
468470

469-
match = of_match_device(sabre_match, &op->dev);
470-
hummingbird_p = match && (match->data != NULL);
471+
hummingbird_p = (uintptr_t)device_get_match_data(&op->dev);
471472
if (!hummingbird_p) {
472473
struct device_node *cpu_dp;
473474

arch/sparc/kernel/pci_schizo.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
#include <linux/slab.h>
1212
#include <linux/export.h>
1313
#include <linux/interrupt.h>
14-
#include <linux/of_device.h>
14+
#include <linux/of.h>
15+
#include <linux/of_platform.h>
16+
#include <linux/platform_device.h>
17+
#include <linux/property.h>
1518
#include <linux/numa.h>
1619

1720
#include <asm/iommu.h>
@@ -1459,15 +1462,13 @@ static int __schizo_init(struct platform_device *op, unsigned long chip_type)
14591462
return err;
14601463
}
14611464

1462-
static const struct of_device_id schizo_match[];
14631465
static int schizo_probe(struct platform_device *op)
14641466
{
1465-
const struct of_device_id *match;
1467+
unsigned long chip_type = (unsigned long)device_get_match_data(&op->dev);
14661468

1467-
match = of_match_device(schizo_match, &op->dev);
1468-
if (!match)
1469+
if (!chip_type)
14691470
return -EINVAL;
1470-
return __schizo_init(op, (unsigned long)match->data);
1471+
return __schizo_init(op, chip_type);
14711472
}
14721473

14731474
/* The ordering of this table is very important. Some Tomatillo

drivers/clk/qcom/gcc-x1e80100.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
*/
55

66
#include <linux/clk-provider.h>
7+
#include <linux/mod_devicetable.h>
78
#include <linux/module.h>
8-
#include <linux/of_device.h>
9+
#include <linux/platform_device.h>
910
#include <linux/regmap.h>
1011

1112
#include <dt-bindings/clock/qcom,x1e80100-gcc.h>

drivers/net/can/c_can/c_can_platform.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
#include <linux/io.h>
3131
#include <linux/platform_device.h>
3232
#include <linux/pm_runtime.h>
33+
#include <linux/property.h>
3334
#include <linux/clk.h>
3435
#include <linux/of.h>
35-
#include <linux/of_device.h>
3636
#include <linux/mfd/syscon.h>
3737
#include <linux/regmap.h>
3838

@@ -259,22 +259,13 @@ static int c_can_plat_probe(struct platform_device *pdev)
259259
void __iomem *addr;
260260
struct net_device *dev;
261261
struct c_can_priv *priv;
262-
const struct of_device_id *match;
263262
struct resource *mem;
264263
int irq;
265264
struct clk *clk;
266265
const struct c_can_driver_data *drvdata;
267266
struct device_node *np = pdev->dev.of_node;
268267

269-
match = of_match_device(c_can_of_table, &pdev->dev);
270-
if (match) {
271-
drvdata = match->data;
272-
} else if (pdev->id_entry->driver_data) {
273-
drvdata = (struct c_can_driver_data *)
274-
platform_get_device_id(pdev)->driver_data;
275-
} else {
276-
return -ENODEV;
277-
}
268+
drvdata = device_get_match_data(&pdev->dev);
278269

279270
/* get the appropriate clk */
280271
clk = devm_clk_get(&pdev->dev, NULL);

drivers/net/can/flexcan/flexcan-core.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
#include <linux/module.h>
2424
#include <linux/netdevice.h>
2525
#include <linux/of.h>
26-
#include <linux/of_device.h>
2726
#include <linux/pinctrl/consumer.h>
2827
#include <linux/platform_device.h>
2928
#include <linux/can/platform/flexcan.h>
3029
#include <linux/pm_runtime.h>
30+
#include <linux/property.h>
3131
#include <linux/regmap.h>
3232
#include <linux/regulator/consumer.h>
3333

@@ -2034,7 +2034,6 @@ MODULE_DEVICE_TABLE(platform, flexcan_id_table);
20342034

20352035
static int flexcan_probe(struct platform_device *pdev)
20362036
{
2037-
const struct of_device_id *of_id;
20382037
const struct flexcan_devtype_data *devtype_data;
20392038
struct net_device *dev;
20402039
struct flexcan_priv *priv;
@@ -2090,14 +2089,7 @@ static int flexcan_probe(struct platform_device *pdev)
20902089
if (IS_ERR(regs))
20912090
return PTR_ERR(regs);
20922091

2093-
of_id = of_match_device(flexcan_of_match, &pdev->dev);
2094-
if (of_id)
2095-
devtype_data = of_id->data;
2096-
else if (platform_get_device_id(pdev)->driver_data)
2097-
devtype_data = (struct flexcan_devtype_data *)
2098-
platform_get_device_id(pdev)->driver_data;
2099-
else
2100-
return -ENODEV;
2092+
devtype_data = device_get_match_data(&pdev->dev);
21012093

21022094
if ((devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_FD) &&
21032095
!((devtype_data->quirks &

drivers/net/can/mscan/mpc5xxx_can.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
#include <linux/module.h>
1313
#include <linux/interrupt.h>
1414
#include <linux/platform_device.h>
15+
#include <linux/property.h>
1516
#include <linux/netdevice.h>
1617
#include <linux/can/dev.h>
18+
#include <linux/of.h>
1719
#include <linux/of_address.h>
1820
#include <linux/of_irq.h>
1921
#include <linux/of_platform.h>
@@ -290,7 +292,7 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
290292
int irq, mscan_clksrc = 0;
291293
int err = -ENOMEM;
292294

293-
data = of_device_get_match_data(&ofdev->dev);
295+
data = device_get_match_data(&ofdev->dev);
294296
if (!data)
295297
return -EINVAL;
296298

@@ -351,13 +353,11 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
351353

352354
static void mpc5xxx_can_remove(struct platform_device *ofdev)
353355
{
354-
const struct of_device_id *match;
355356
const struct mpc5xxx_can_data *data;
356357
struct net_device *dev = platform_get_drvdata(ofdev);
357358
struct mscan_priv *priv = netdev_priv(dev);
358359

359-
match = of_match_device(mpc5xxx_can_table, &ofdev->dev);
360-
data = match ? match->data : NULL;
360+
data = device_get_match_data(&ofdev->dev);
361361

362362
unregister_mscandev(dev);
363363
if (data && data->put_clock)

drivers/net/can/xilinx_can.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include <linux/module.h>
2121
#include <linux/netdevice.h>
2222
#include <linux/of.h>
23-
#include <linux/of_device.h>
2423
#include <linux/platform_device.h>
24+
#include <linux/property.h>
2525
#include <linux/skbuff.h>
2626
#include <linux/spinlock.h>
2727
#include <linux/string.h>
@@ -1726,8 +1726,7 @@ static int xcan_probe(struct platform_device *pdev)
17261726
struct net_device *ndev;
17271727
struct xcan_priv *priv;
17281728
struct phy *transceiver;
1729-
const struct of_device_id *of_id;
1730-
const struct xcan_devtype_data *devtype = &xcan_axi_data;
1729+
const struct xcan_devtype_data *devtype;
17311730
void __iomem *addr;
17321731
int ret;
17331732
int rx_max, tx_max;
@@ -1741,9 +1740,7 @@ static int xcan_probe(struct platform_device *pdev)
17411740
goto err;
17421741
}
17431742

1744-
of_id = of_match_device(xcan_of_match, &pdev->dev);
1745-
if (of_id && of_id->data)
1746-
devtype = of_id->data;
1743+
devtype = device_get_match_data(&pdev->dev);
17471744

17481745
hw_tx_max_property = devtype->flags & XCAN_FLAG_TX_MAILBOXES ?
17491746
"tx-mailbox-count" : "tx-fifo-depth";

drivers/thermal/loongson2_thermal.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
#include <linux/interrupt.h>
99
#include <linux/io.h>
1010
#include <linux/minmax.h>
11+
#include <linux/mod_devicetable.h>
1112
#include <linux/module.h>
12-
#include <linux/of_device.h>
1313
#include <linux/platform_device.h>
14+
#include <linux/property.h>
1415
#include <linux/thermal.h>
1516
#include <linux/units.h>
1617
#include "thermal_hwmon.h"

include/linux/of_device.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
#ifndef _LINUX_OF_DEVICE_H
33
#define _LINUX_OF_DEVICE_H
44

5-
#include <linux/platform_device.h>
6-
#include <linux/of_platform.h> /* temporary until merge */
7-
8-
#include <linux/of.h>
5+
#include <linux/device/driver.h>
96

107
struct device;
118
struct of_device_id;

include/linux/of_platform.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
*/
88

99
#include <linux/mod_devicetable.h>
10-
#include <linux/of_device.h>
11-
#include <linux/platform_device.h>
1210

1311
struct device;
12+
struct device_node;
1413
struct of_device_id;
14+
struct platform_device;
1515

1616
/**
1717
* struct of_dev_auxdata - lookup table entry for device names & platform_data

0 commit comments

Comments
 (0)