mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-09-22 12:42:50 +00:00
of/spi: Fix OF-style driver binding of spi devices
This patch adds the OF hook to the spi core so that devices can automatically be registered based on device tree data. This fixes a problem with spi devices not binding to drivers after the cleanup of the spi & i2c binding code. Signed-off-by: Sinan Akman <sinan@writeme.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
This commit is contained in:
parent
23699f98f8
commit
2b7a32f7ec
1 changed files with 5 additions and 0 deletions
|
@ -23,6 +23,7 @@
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/cache.h>
|
#include <linux/cache.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
|
#include <linux/of_device.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/mod_devicetable.h>
|
#include <linux/mod_devicetable.h>
|
||||||
#include <linux/spi/spi.h>
|
#include <linux/spi/spi.h>
|
||||||
|
@ -86,6 +87,10 @@ static int spi_match_device(struct device *dev, struct device_driver *drv)
|
||||||
const struct spi_device *spi = to_spi_device(dev);
|
const struct spi_device *spi = to_spi_device(dev);
|
||||||
const struct spi_driver *sdrv = to_spi_driver(drv);
|
const struct spi_driver *sdrv = to_spi_driver(drv);
|
||||||
|
|
||||||
|
/* Attempt an OF style match */
|
||||||
|
if (of_driver_match_device(dev, drv))
|
||||||
|
return 1;
|
||||||
|
|
||||||
if (sdrv->id_table)
|
if (sdrv->id_table)
|
||||||
return !!spi_match_id(sdrv->id_table, spi);
|
return !!spi_match_id(sdrv->id_table, spi);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue