Skip to content

Commit 61c7a08

Browse files
committed
of: Always use 'struct device.of_node' to get device node pointer.
The following structure elements duplicate the information in 'struct device.of_node' and so are being eliminated. This patch makes all readers of these elements use device.of_node instead. (struct of_device *)->node (struct dev_archdata *)->prom_node (sparc) (struct dev_archdata *)->of_node (powerpc & microblaze) Signed-off-by: Grant Likely <[email protected]>
1 parent d12d42f commit 61c7a08

File tree

157 files changed

+497
-488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+497
-488
lines changed

arch/microblaze/kernel/of_device.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
void of_device_make_bus_id(struct of_device *dev)
1313
{
1414
static atomic_t bus_no_reg_magic;
15-
struct device_node *node = dev->node;
15+
struct device_node *node = dev->dev.of_node;
1616
const u32 *reg;
1717
u64 addr;
1818
int magic;
@@ -76,17 +76,17 @@ int of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
7676

7777
ofdev = to_of_device(dev);
7878

79-
if (add_uevent_var(env, "OF_NAME=%s", ofdev->node->name))
79+
if (add_uevent_var(env, "OF_NAME=%s", ofdev->dev.of_node->name))
8080
return -ENOMEM;
8181

82-
if (add_uevent_var(env, "OF_TYPE=%s", ofdev->node->type))
82+
if (add_uevent_var(env, "OF_TYPE=%s", ofdev->dev.of_node->type))
8383
return -ENOMEM;
8484

8585
/* Since the compatible field can contain pretty much anything
8686
* it's not really legal to split it out with commas. We split it
8787
* up using a number of environment variables instead. */
8888

89-
compat = of_get_property(ofdev->node, "compatible", &cplen);
89+
compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen);
9090
while (compat && *compat && cplen > 0) {
9191
if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat))
9292
return -ENOMEM;

arch/microblaze/kernel/of_platform.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(of_platform_bus_probe);
166166

167167
static int of_dev_node_match(struct device *dev, void *data)
168168
{
169-
return to_of_device(dev)->node == data;
169+
return to_of_device(dev)->dev.of_node == data;
170170
}
171171

172172
struct of_device *of_find_device_by_node(struct device_node *np)
@@ -184,7 +184,7 @@ EXPORT_SYMBOL(of_find_device_by_node);
184184
static int of_dev_phandle_match(struct device *dev, void *data)
185185
{
186186
phandle *ph = data;
187-
return to_of_device(dev)->node->phandle == *ph;
187+
return to_of_device(dev)->dev.of_node->phandle == *ph;
188188
}
189189

190190
struct of_device *of_find_device_by_phandle(phandle ph)

arch/powerpc/include/asm/macio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static inline void* macio_get_drvdata(struct macio_dev *dev)
108108

109109
static inline struct device_node *macio_get_of_node(struct macio_dev *mdev)
110110
{
111-
return mdev->ofdev.node;
111+
return mdev->ofdev.dev.of_node;
112112
}
113113

114114
#ifdef CONFIG_PCI

arch/powerpc/kernel/ibmebus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ static struct dma_map_ops ibmebus_dma_ops = {
140140

141141
static int ibmebus_match_path(struct device *dev, void *data)
142142
{
143-
struct device_node *dn = to_of_device(dev)->node;
143+
struct device_node *dn = to_of_device(dev)->dev.of_node;
144144
return (dn->full_name &&
145145
(strcasecmp((char *)data, dn->full_name) == 0));
146146
}
147147

148148
static int ibmebus_match_node(struct device *dev, void *data)
149149
{
150-
return to_of_device(dev)->node == data;
150+
return to_of_device(dev)->dev.of_node == data;
151151
}
152152

153153
static int ibmebus_create_device(struct device_node *dn)

arch/powerpc/kernel/of_device.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
static void of_device_make_bus_id(struct of_device *dev)
1414
{
1515
static atomic_t bus_no_reg_magic;
16-
struct device_node *node = dev->node;
16+
struct device_node *node = dev->dev.of_node;
1717
const u32 *reg;
1818
u64 addr;
1919
int magic;
@@ -96,17 +96,17 @@ int of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
9696

9797
ofdev = to_of_device(dev);
9898

99-
if (add_uevent_var(env, "OF_NAME=%s", ofdev->node->name))
99+
if (add_uevent_var(env, "OF_NAME=%s", ofdev->dev.of_node->name))
100100
return -ENOMEM;
101101

102-
if (add_uevent_var(env, "OF_TYPE=%s", ofdev->node->type))
102+
if (add_uevent_var(env, "OF_TYPE=%s", ofdev->dev.of_node->type))
103103
return -ENOMEM;
104104

105105
/* Since the compatible field can contain pretty much anything
106106
* it's not really legal to split it out with commas. We split it
107107
* up using a number of environment variables instead. */
108108

109-
compat = of_get_property(ofdev->node, "compatible", &cplen);
109+
compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen);
110110
while (compat && *compat && cplen > 0) {
111111
if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat))
112112
return -ENOMEM;

arch/powerpc/kernel/of_platform.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ EXPORT_SYMBOL(of_platform_bus_probe);
195195

196196
static int of_dev_node_match(struct device *dev, void *data)
197197
{
198-
return to_of_device(dev)->node == data;
198+
return to_of_device(dev)->dev.of_node == data;
199199
}
200200

201201
struct of_device *of_find_device_by_node(struct device_node *np)
@@ -213,7 +213,7 @@ EXPORT_SYMBOL(of_find_device_by_node);
213213
static int of_dev_phandle_match(struct device *dev, void *data)
214214
{
215215
phandle *ph = data;
216-
return to_of_device(dev)->node->phandle == *ph;
216+
return to_of_device(dev)->dev.of_node->phandle == *ph;
217217
}
218218

219219
struct of_device *of_find_device_by_phandle(phandle ph)
@@ -246,10 +246,10 @@ static int __devinit of_pci_phb_probe(struct of_device *dev,
246246
if (ppc_md.pci_setup_phb == NULL)
247247
return -ENODEV;
248248

249-
printk(KERN_INFO "Setting up PCI bus %s\n", dev->node->full_name);
249+
pr_info("Setting up PCI bus %s\n", dev->dev.of_node->full_name);
250250

251251
/* Alloc and setup PHB data structure */
252-
phb = pcibios_alloc_controller(dev->node);
252+
phb = pcibios_alloc_controller(dev->dev.of_node);
253253
if (!phb)
254254
return -ENODEV;
255255

@@ -263,19 +263,19 @@ static int __devinit of_pci_phb_probe(struct of_device *dev,
263263
}
264264

265265
/* Process "ranges" property */
266-
pci_process_bridge_OF_ranges(phb, dev->node, 0);
266+
pci_process_bridge_OF_ranges(phb, dev->dev.of_node, 0);
267267

268268
/* Init pci_dn data structures */
269269
pci_devs_phb_init_dynamic(phb);
270270

271271
/* Register devices with EEH */
272272
#ifdef CONFIG_EEH
273-
if (dev->node->child)
274-
eeh_add_device_tree_early(dev->node);
273+
if (dev->dev.of_node->child)
274+
eeh_add_device_tree_early(dev->dev.of_node);
275275
#endif /* CONFIG_EEH */
276276

277277
/* Scan the bus */
278-
pcibios_scan_phb(phb, dev->node);
278+
pcibios_scan_phb(phb, dev->dev.of_node);
279279
if (phb->bus == NULL)
280280
return -ENXIO;
281281

arch/powerpc/platforms/52xx/mpc52xx_gpio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static int __devinit mpc52xx_wkup_gpiochip_probe(struct of_device *ofdev,
168168
ofchip->gc.get = mpc52xx_wkup_gpio_get;
169169
ofchip->gc.set = mpc52xx_wkup_gpio_set;
170170

171-
ret = of_mm_gpiochip_add(ofdev->node, &chip->mmchip);
171+
ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip);
172172
if (ret)
173173
return ret;
174174

@@ -329,7 +329,7 @@ static int __devinit mpc52xx_simple_gpiochip_probe(struct of_device *ofdev,
329329
ofchip->gc.get = mpc52xx_simple_gpio_get;
330330
ofchip->gc.set = mpc52xx_simple_gpio_set;
331331

332-
ret = of_mm_gpiochip_add(ofdev->node, &chip->mmchip);
332+
ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip);
333333
if (ret)
334334
return ret;
335335

arch/powerpc/platforms/52xx/mpc52xx_gpt.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -734,30 +734,30 @@ static int __devinit mpc52xx_gpt_probe(struct of_device *ofdev,
734734

735735
spin_lock_init(&gpt->lock);
736736
gpt->dev = &ofdev->dev;
737-
gpt->ipb_freq = mpc5xxx_get_bus_frequency(ofdev->node);
738-
gpt->regs = of_iomap(ofdev->node, 0);
737+
gpt->ipb_freq = mpc5xxx_get_bus_frequency(ofdev->dev.of_node);
738+
gpt->regs = of_iomap(ofdev->dev.of_node, 0);
739739
if (!gpt->regs) {
740740
kfree(gpt);
741741
return -ENOMEM;
742742
}
743743

744744
dev_set_drvdata(&ofdev->dev, gpt);
745745

746-
mpc52xx_gpt_gpio_setup(gpt, ofdev->node);
747-
mpc52xx_gpt_irq_setup(gpt, ofdev->node);
746+
mpc52xx_gpt_gpio_setup(gpt, ofdev->dev.of_node);
747+
mpc52xx_gpt_irq_setup(gpt, ofdev->dev.of_node);
748748

749749
mutex_lock(&mpc52xx_gpt_list_mutex);
750750
list_add(&gpt->list, &mpc52xx_gpt_list);
751751
mutex_unlock(&mpc52xx_gpt_list_mutex);
752752

753753
/* check if this device could be a watchdog */
754-
if (of_get_property(ofdev->node, "fsl,has-wdt", NULL) ||
755-
of_get_property(ofdev->node, "has-wdt", NULL)) {
754+
if (of_get_property(ofdev->dev.of_node, "fsl,has-wdt", NULL) ||
755+
of_get_property(ofdev->dev.of_node, "has-wdt", NULL)) {
756756
const u32 *on_boot_wdt;
757757

758758
gpt->wdt_mode = MPC52xx_GPT_CAN_WDT;
759-
on_boot_wdt = of_get_property(ofdev->node, "fsl,wdt-on-boot",
760-
NULL);
759+
on_boot_wdt = of_get_property(ofdev->dev.of_node,
760+
"fsl,wdt-on-boot", NULL);
761761
if (on_boot_wdt) {
762762
dev_info(gpt->dev, "used as watchdog\n");
763763
gpt->wdt_mode |= MPC52xx_GPT_IS_WDT;

arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,14 +445,14 @@ mpc52xx_lpbfifo_probe(struct of_device *op, const struct of_device_id *match)
445445
if (lpbfifo.dev != NULL)
446446
return -ENOSPC;
447447

448-
lpbfifo.irq = irq_of_parse_and_map(op->node, 0);
448+
lpbfifo.irq = irq_of_parse_and_map(op->dev.of_node, 0);
449449
if (!lpbfifo.irq)
450450
return -ENODEV;
451451

452-
if (of_address_to_resource(op->node, 0, &res))
452+
if (of_address_to_resource(op->dev.of_node, 0, &res))
453453
return -ENODEV;
454454
lpbfifo.regs_phys = res.start;
455-
lpbfifo.regs = of_iomap(op->node, 0);
455+
lpbfifo.regs = of_iomap(op->dev.of_node, 0);
456456
if (!lpbfifo.regs)
457457
return -ENOMEM;
458458

arch/powerpc/platforms/82xx/ep8248e.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ static int __devinit ep8248e_mdio_probe(struct of_device *ofdev,
119119
struct device_node *node;
120120
int ret;
121121

122-
node = of_get_parent(ofdev->node);
122+
node = of_get_parent(ofdev->dev.of_node);
123123
of_node_put(node);
124124
if (node != ep8248e_bcsr_node)
125125
return -ENODEV;
126126

127-
ret = of_address_to_resource(ofdev->node, 0, &res);
127+
ret = of_address_to_resource(ofdev->dev.of_node, 0, &res);
128128
if (ret)
129129
return ret;
130130

@@ -142,7 +142,7 @@ static int __devinit ep8248e_mdio_probe(struct of_device *ofdev,
142142
bus->parent = &ofdev->dev;
143143
snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
144144

145-
ret = of_mdiobus_register(bus, ofdev->node);
145+
ret = of_mdiobus_register(bus, ofdev->dev.of_node);
146146
if (ret)
147147
goto err_free_irq;
148148

arch/powerpc/platforms/83xx/suspend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ static struct platform_suspend_ops mpc83xx_suspend_ops = {
321321
static int pmc_probe(struct of_device *ofdev,
322322
const struct of_device_id *match)
323323
{
324-
struct device_node *np = ofdev->node;
324+
struct device_node *np = ofdev->dev.of_node;
325325
struct resource res;
326326
struct pmc_type *type = match->data;
327327
int ret = 0;

arch/powerpc/platforms/cell/axon_msi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ static int axon_msi_shutdown(struct of_device *device)
345345
static int axon_msi_probe(struct of_device *device,
346346
const struct of_device_id *device_id)
347347
{
348-
struct device_node *dn = device->node;
348+
struct device_node *dn = device->dev.of_node;
349349
struct axon_msic *msic;
350350
unsigned int virq;
351351
int dcr_base, dcr_len;

arch/powerpc/platforms/pasemi/gpio_mdio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static int __devinit gpio_mdio_probe(struct of_device *ofdev,
220220
const struct of_device_id *match)
221221
{
222222
struct device *dev = &ofdev->dev;
223-
struct device_node *np = ofdev->node;
223+
struct device_node *np = ofdev->dev.of_node;
224224
struct mii_bus *new_bus;
225225
struct gpio_priv *priv;
226226
const unsigned int *prop;

arch/powerpc/sysdev/axonram.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ axon_ram_probe(struct of_device *device, const struct of_device_id *device_id)
185185
axon_ram_bank_id++;
186186

187187
dev_info(&device->dev, "Found memory controller on %s\n",
188-
device->node->full_name);
188+
device->dev.of_node->full_name);
189189

190190
bank = kzalloc(sizeof(struct axon_ram_bank), GFP_KERNEL);
191191
if (bank == NULL) {
@@ -198,7 +198,7 @@ axon_ram_probe(struct of_device *device, const struct of_device_id *device_id)
198198

199199
bank->device = device;
200200

201-
if (of_address_to_resource(device->node, 0, &resource) != 0) {
201+
if (of_address_to_resource(device->dev.of_node, 0, &resource) != 0) {
202202
dev_err(&device->dev, "Cannot access device tree\n");
203203
rc = -EFAULT;
204204
goto failed;
@@ -253,7 +253,7 @@ axon_ram_probe(struct of_device *device, const struct of_device_id *device_id)
253253
blk_queue_logical_block_size(bank->disk->queue, AXON_RAM_SECTOR_SIZE);
254254
add_disk(bank->disk);
255255

256-
bank->irq_id = irq_of_parse_and_map(device->node, 0);
256+
bank->irq_id = irq_of_parse_and_map(device->dev.of_node, 0);
257257
if (bank->irq_id == NO_IRQ) {
258258
dev_err(&device->dev, "Cannot access ECC interrupt ID\n");
259259
rc = -EFAULT;

arch/powerpc/sysdev/bestcomm/bestcomm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ mpc52xx_bcom_probe(struct of_device *op, const struct of_device_id *match)
377377
printk(KERN_INFO "DMA: MPC52xx BestComm driver\n");
378378

379379
/* Get the bestcomm node */
380-
of_node_get(op->node);
380+
of_node_get(op->dev.of_node);
381381

382382
/* Prepare SRAM */
383383
ofn_sram = of_find_matching_node(NULL, mpc52xx_sram_ids);
@@ -406,10 +406,10 @@ mpc52xx_bcom_probe(struct of_device *op, const struct of_device_id *match)
406406
}
407407

408408
/* Save the node */
409-
bcom_eng->ofnode = op->node;
409+
bcom_eng->ofnode = op->dev.of_node;
410410

411411
/* Get, reserve & map io */
412-
if (of_address_to_resource(op->node, 0, &res_bcom)) {
412+
if (of_address_to_resource(op->dev.of_node, 0, &res_bcom)) {
413413
printk(KERN_ERR DRIVER_NAME ": "
414414
"Can't get resource\n");
415415
rv = -EINVAL;
@@ -453,7 +453,7 @@ mpc52xx_bcom_probe(struct of_device *op, const struct of_device_id *match)
453453
kfree(bcom_eng);
454454
bcom_sram_cleanup();
455455
error_ofput:
456-
of_node_put(op->node);
456+
of_node_put(op->dev.of_node);
457457

458458
printk(KERN_ERR "DMA: MPC52xx BestComm init failed !\n");
459459

arch/powerpc/sysdev/fsl_msi.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
249249
goto error_out;
250250
}
251251

252-
msi->irqhost = irq_alloc_host(dev->node, IRQ_HOST_MAP_LINEAR,
252+
msi->irqhost = irq_alloc_host(dev->dev.of_node, IRQ_HOST_MAP_LINEAR,
253253
NR_MSI_IRQS, &fsl_msi_host_ops, 0);
254254

255255
if (msi->irqhost == NULL) {
@@ -259,10 +259,10 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
259259
}
260260

261261
/* Get the MSI reg base */
262-
err = of_address_to_resource(dev->node, 0, &res);
262+
err = of_address_to_resource(dev->dev.of_node, 0, &res);
263263
if (err) {
264264
dev_err(&dev->dev, "%s resource error!\n",
265-
dev->node->full_name);
265+
dev->dev.of_node->full_name);
266266
goto error_out;
267267
}
268268

@@ -285,16 +285,16 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
285285
goto error_out;
286286
}
287287

288-
p = of_get_property(dev->node, "interrupts", &count);
288+
p = of_get_property(dev->dev.of_node, "interrupts", &count);
289289
if (!p) {
290290
dev_err(&dev->dev, "no interrupts property found on %s\n",
291-
dev->node->full_name);
291+
dev->dev.of_node->full_name);
292292
err = -ENODEV;
293293
goto error_out;
294294
}
295295
if (count % 8 != 0) {
296296
dev_err(&dev->dev, "Malformed interrupts property on %s\n",
297-
dev->node->full_name);
297+
dev->dev.of_node->full_name);
298298
err = -EINVAL;
299299
goto error_out;
300300
}
@@ -303,7 +303,7 @@ static int __devinit fsl_of_msi_probe(struct of_device *dev,
303303
for (i = 0; i < count / 2; i++) {
304304
if (i > NR_MSI_REG)
305305
break;
306-
virt_msir = irq_of_parse_and_map(dev->node, i);
306+
virt_msir = irq_of_parse_and_map(dev->dev.of_node, i);
307307
if (virt_msir != NO_IRQ) {
308308
set_irq_data(virt_msir, (void *)i);
309309
set_irq_chained_handler(virt_msir, fsl_msi_cascade);

0 commit comments

Comments
 (0)