aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index a9e5c79ae52a..b5a78a1f4421 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -23,6 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/cache.h> 24#include <linux/cache.h>
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/of_device.h>
26#include <linux/slab.h> 27#include <linux/slab.h>
27#include <linux/mod_devicetable.h> 28#include <linux/mod_devicetable.h>
28#include <linux/spi/spi.h> 29#include <linux/spi/spi.h>
@@ -86,6 +87,10 @@ static int spi_match_device(struct device *dev, struct device_driver *drv)
86 const struct spi_device *spi = to_spi_device(dev); 87 const struct spi_device *spi = to_spi_device(dev);
87 const struct spi_driver *sdrv = to_spi_driver(drv); 88 const struct spi_driver *sdrv = to_spi_driver(drv);
88 89
90 /* Attempt an OF style match */
91 if (of_driver_match_device(dev, drv))
92 return 1;
93
89 if (sdrv->id_table) 94 if (sdrv->id_table)
90 return !!spi_match_id(sdrv->id_table, spi); 95 return !!spi_match_id(sdrv->id_table, spi);
91 96
@@ -554,11 +559,9 @@ done:
554EXPORT_SYMBOL_GPL(spi_register_master); 559EXPORT_SYMBOL_GPL(spi_register_master);
555 560
556 561
557static int __unregister(struct device *dev, void *master_dev) 562static int __unregister(struct device *dev, void *null)
558{ 563{
559 /* note: before about 2.6.14-rc1 this would corrupt memory: */ 564 spi_unregister_device(to_spi_device(dev));
560 if (dev != master_dev)
561 spi_unregister_device(to_spi_device(dev));
562 return 0; 565 return 0;
563} 566}
564 567
@@ -576,8 +579,7 @@ void spi_unregister_master(struct spi_master *master)
576{ 579{
577 int dummy; 580 int dummy;
578 581
579 dummy = device_for_each_child(master->dev.parent, &master->dev, 582 dummy = device_for_each_child(&master->dev, NULL, __unregister);
580 __unregister);
581 device_unregister(&master->dev); 583 device_unregister(&master->dev);
582} 584}
583EXPORT_SYMBOL_GPL(spi_unregister_master); 585EXPORT_SYMBOL_GPL(spi_unregister_master);