Commit c9e358dfc4a8cb2227172ef77908c2e0ee17bcb9
1 parent
c56eb8fb6d
Exists in
master
and in
7 other branches
driver-core: remove conditionals around devicetree pointers
Having conditional around the of_match_table and the of_node pointers turns out to make driver code use ugly #ifdef blocks. Drop the conditionals and remove the #ifdef blocks from the affected drivers. Also tidy up minor whitespace issues within the same hunks. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Showing 10 changed files with 8 additions and 43 deletions Side-by-side Diff
drivers/i2c/busses/i2c-ocores.c
... | ... | @@ -330,9 +330,7 @@ |
330 | 330 | i2c->adap = ocores_adapter; |
331 | 331 | i2c_set_adapdata(&i2c->adap, i2c); |
332 | 332 | i2c->adap.dev.parent = &pdev->dev; |
333 | -#ifdef CONFIG_OF | |
334 | 333 | i2c->adap.dev.of_node = pdev->dev.of_node; |
335 | -#endif | |
336 | 334 | |
337 | 335 | /* add i2c adapter to i2c tree */ |
338 | 336 | ret = i2c_add_adapter(&i2c->adap); |
339 | 337 | |
340 | 338 | |
... | ... | @@ -390,15 +388,11 @@ |
390 | 388 | #define ocores_i2c_resume NULL |
391 | 389 | #endif |
392 | 390 | |
393 | -#ifdef CONFIG_OF | |
394 | 391 | static struct of_device_id ocores_i2c_match[] = { |
395 | - { | |
396 | - .compatible = "opencores,i2c-ocores", | |
397 | - }, | |
398 | - {}, | |
392 | + { .compatible = "opencores,i2c-ocores", }, | |
393 | + {}, | |
399 | 394 | }; |
400 | 395 | MODULE_DEVICE_TABLE(of, ocores_i2c_match); |
401 | -#endif | |
402 | 396 | |
403 | 397 | /* work with hotplug and coldplug */ |
404 | 398 | MODULE_ALIAS("platform:ocores-i2c"); |
... | ... | @@ -411,9 +405,7 @@ |
411 | 405 | .driver = { |
412 | 406 | .owner = THIS_MODULE, |
413 | 407 | .name = "ocores-i2c", |
414 | -#ifdef CONFIG_OF | |
415 | - .of_match_table = ocores_i2c_match, | |
416 | -#endif | |
408 | + .of_match_table = ocores_i2c_match, | |
417 | 409 | }, |
418 | 410 | }; |
419 | 411 |
drivers/i2c/i2c-core.c
... | ... | @@ -537,9 +537,7 @@ |
537 | 537 | client->dev.parent = &client->adapter->dev; |
538 | 538 | client->dev.bus = &i2c_bus_type; |
539 | 539 | client->dev.type = &i2c_client_type; |
540 | -#ifdef CONFIG_OF | |
541 | 540 | client->dev.of_node = info->of_node; |
542 | -#endif | |
543 | 541 | |
544 | 542 | dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), |
545 | 543 | client->addr); |
drivers/mmc/host/mmc_spi.c
... | ... | @@ -1516,21 +1516,17 @@ |
1516 | 1516 | return 0; |
1517 | 1517 | } |
1518 | 1518 | |
1519 | -#if defined(CONFIG_OF) | |
1520 | 1519 | static struct of_device_id mmc_spi_of_match_table[] __devinitdata = { |
1521 | 1520 | { .compatible = "mmc-spi-slot", }, |
1522 | 1521 | {}, |
1523 | 1522 | }; |
1524 | -#endif | |
1525 | 1523 | |
1526 | 1524 | static struct spi_driver mmc_spi_driver = { |
1527 | 1525 | .driver = { |
1528 | 1526 | .name = "mmc_spi", |
1529 | 1527 | .bus = &spi_bus_type, |
1530 | 1528 | .owner = THIS_MODULE, |
1531 | -#if defined(CONFIG_OF) | |
1532 | 1529 | .of_match_table = mmc_spi_of_match_table, |
1533 | -#endif | |
1534 | 1530 | }, |
1535 | 1531 | .probe = mmc_spi_probe, |
1536 | 1532 | .remove = __devexit_p(mmc_spi_remove), |
drivers/net/ethoc.c
... | ... | @@ -1163,15 +1163,11 @@ |
1163 | 1163 | # define ethoc_resume NULL |
1164 | 1164 | #endif |
1165 | 1165 | |
1166 | -#ifdef CONFIG_OF | |
1167 | 1166 | static struct of_device_id ethoc_match[] = { |
1168 | - { | |
1169 | - .compatible = "opencores,ethoc", | |
1170 | - }, | |
1167 | + { .compatible = "opencores,ethoc", }, | |
1171 | 1168 | {}, |
1172 | 1169 | }; |
1173 | 1170 | MODULE_DEVICE_TABLE(of, ethoc_match); |
1174 | -#endif | |
1175 | 1171 | |
1176 | 1172 | static struct platform_driver ethoc_driver = { |
1177 | 1173 | .probe = ethoc_probe, |
1178 | 1174 | |
... | ... | @@ -1181,9 +1177,7 @@ |
1181 | 1177 | .driver = { |
1182 | 1178 | .name = "ethoc", |
1183 | 1179 | .owner = THIS_MODULE, |
1184 | -#ifdef CONFIG_OF | |
1185 | 1180 | .of_match_table = ethoc_match, |
1186 | -#endif | |
1187 | 1181 | }, |
1188 | 1182 | }; |
1189 | 1183 |
drivers/spi/pxa2xx_spi.c
... | ... | @@ -1557,9 +1557,7 @@ |
1557 | 1557 | drv_data->ssp = ssp; |
1558 | 1558 | |
1559 | 1559 | master->dev.parent = &pdev->dev; |
1560 | -#ifdef CONFIG_OF | |
1561 | 1560 | master->dev.of_node = pdev->dev.of_node; |
1562 | -#endif | |
1563 | 1561 | /* the spi->mode bits understood by this driver: */ |
1564 | 1562 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; |
1565 | 1563 |
drivers/spi/pxa2xx_spi_pci.c
... | ... | @@ -98,9 +98,7 @@ |
98 | 98 | pdev->dev.parent = &dev->dev; |
99 | 99 | pdev->dev.platform_data = &spi_info->spi_pdata; |
100 | 100 | |
101 | -#ifdef CONFIG_OF | |
102 | 101 | pdev->dev.of_node = dev->dev.of_node; |
103 | -#endif | |
104 | 102 | pdev->dev.release = plat_dev_release; |
105 | 103 | |
106 | 104 | spi_pdata->num_chipselect = dev->devfn; |
drivers/spi/xilinx_spi.c
... | ... | @@ -351,14 +351,12 @@ |
351 | 351 | return IRQ_HANDLED; |
352 | 352 | } |
353 | 353 | |
354 | -#ifdef CONFIG_OF | |
355 | 354 | static const struct of_device_id xilinx_spi_of_match[] = { |
356 | 355 | { .compatible = "xlnx,xps-spi-2.00.a", }, |
357 | 356 | { .compatible = "xlnx,xps-spi-2.00.b", }, |
358 | 357 | {} |
359 | 358 | }; |
360 | 359 | MODULE_DEVICE_TABLE(of, xilinx_spi_of_match); |
361 | -#endif | |
362 | 360 | |
363 | 361 | struct spi_master *xilinx_spi_init(struct device *dev, struct resource *mem, |
364 | 362 | u32 irq, s16 bus_num, int num_cs, int little_endian, int bits_per_word) |
365 | 363 | |
... | ... | @@ -394,9 +392,7 @@ |
394 | 392 | |
395 | 393 | master->bus_num = bus_num; |
396 | 394 | master->num_chipselect = num_cs; |
397 | -#ifdef CONFIG_OF | |
398 | 395 | master->dev.of_node = dev->of_node; |
399 | -#endif | |
400 | 396 | |
401 | 397 | xspi->mem = *mem; |
402 | 398 | xspi->irq = irq; |
403 | 399 | |
... | ... | @@ -539,9 +535,7 @@ |
539 | 535 | .driver = { |
540 | 536 | .name = XILINX_SPI_NAME, |
541 | 537 | .owner = THIS_MODULE, |
542 | -#ifdef CONFIG_OF | |
543 | 538 | .of_match_table = xilinx_spi_of_match, |
544 | -#endif | |
545 | 539 | }, |
546 | 540 | }; |
547 | 541 |
include/linux/device.h
... | ... | @@ -128,9 +128,7 @@ |
128 | 128 | |
129 | 129 | bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ |
130 | 130 | |
131 | -#if defined(CONFIG_OF) | |
132 | 131 | const struct of_device_id *of_match_table; |
133 | -#endif | |
134 | 132 | |
135 | 133 | int (*probe) (struct device *dev); |
136 | 134 | int (*remove) (struct device *dev); |
... | ... | @@ -441,9 +439,8 @@ |
441 | 439 | override */ |
442 | 440 | /* arch specific additions */ |
443 | 441 | struct dev_archdata archdata; |
444 | -#ifdef CONFIG_OF | |
445 | - struct device_node *of_node; | |
446 | -#endif | |
442 | + | |
443 | + struct device_node *of_node; /* associated device tree node */ | |
447 | 444 | |
448 | 445 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
449 | 446 |
include/linux/i2c.h
include/linux/of.h
... | ... | @@ -23,8 +23,6 @@ |
23 | 23 | |
24 | 24 | #include <asm/byteorder.h> |
25 | 25 | |
26 | -#ifdef CONFIG_OF | |
27 | - | |
28 | 26 | typedef u32 phandle; |
29 | 27 | typedef u32 ihandle; |
30 | 28 | |
... | ... | @@ -64,6 +62,8 @@ |
64 | 62 | struct of_irq_controller *irq_trans; |
65 | 63 | #endif |
66 | 64 | }; |
65 | + | |
66 | +#ifdef CONFIG_OF | |
67 | 67 | |
68 | 68 | /* Pointer for first entry in chain of all nodes. */ |
69 | 69 | extern struct device_node *allnodes; |