Merge branch 'for-next/driver'
This commit is contained in:
commit
eb5565f003
|
@ -46,3 +46,27 @@ int bus_register(struct bus_type *bus)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int device_match(struct device_d *dev, struct driver_d *drv)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_OFDEVICE) && dev->device_node &&
|
||||
drv->of_compatible)
|
||||
return of_match(dev, drv);
|
||||
|
||||
if (!strcmp(dev->name, drv->name))
|
||||
return 0;
|
||||
|
||||
if (drv->id_table) {
|
||||
struct platform_device_id *id = drv->id_table;
|
||||
|
||||
while (id->name) {
|
||||
if (!strcmp(id->name, dev->name)) {
|
||||
dev->id_entry = id;
|
||||
return 0;
|
||||
}
|
||||
id++;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -21,30 +21,6 @@
|
|||
#include <errno.h>
|
||||
#include <init.h>
|
||||
|
||||
static int platform_match(struct device_d *dev, struct driver_d *drv)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_OFDEVICE) && dev->device_node &&
|
||||
drv->of_compatible)
|
||||
return of_match(dev, drv);
|
||||
|
||||
if (!strcmp(dev->name, drv->name))
|
||||
return 0;
|
||||
|
||||
if (drv->id_table) {
|
||||
struct platform_device_id *id = drv->id_table;
|
||||
|
||||
while (id->name) {
|
||||
if (!strcmp(id->name, dev->name)) {
|
||||
dev->id_entry = id;
|
||||
return 0;
|
||||
}
|
||||
id++;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int platform_probe(struct device_d *dev)
|
||||
{
|
||||
return dev->driver->probe(dev);
|
||||
|
@ -71,7 +47,7 @@ int platform_device_register(struct device_d *new_device)
|
|||
|
||||
struct bus_type platform_bus = {
|
||||
.name = "platform",
|
||||
.match = platform_match,
|
||||
.match = device_match,
|
||||
.probe = platform_probe,
|
||||
.remove = platform_remove,
|
||||
};
|
||||
|
|
|
@ -454,26 +454,6 @@ int i2c_add_numbered_adapter(struct i2c_adapter *adapter)
|
|||
}
|
||||
EXPORT_SYMBOL(i2c_add_numbered_adapter);
|
||||
|
||||
static int i2c_match(struct device_d *dev, struct driver_d *drv)
|
||||
{
|
||||
if (!strcmp(dev->name, drv->name))
|
||||
return 0;
|
||||
|
||||
if (drv->id_table) {
|
||||
struct platform_device_id *id = drv->id_table;
|
||||
|
||||
while (id->name) {
|
||||
if (!strcmp(id->name, dev->name)) {
|
||||
dev->id_entry = id;
|
||||
return 0;
|
||||
}
|
||||
id++;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int i2c_probe(struct device_d *dev)
|
||||
{
|
||||
return dev->driver->probe(dev);
|
||||
|
@ -486,7 +466,7 @@ static void i2c_remove(struct device_d *dev)
|
|||
|
||||
struct bus_type i2c_bus = {
|
||||
.name = "i2c",
|
||||
.match = i2c_match,
|
||||
.match = device_match,
|
||||
.probe = i2c_probe,
|
||||
.remove = i2c_remove,
|
||||
};
|
||||
|
|
|
@ -289,15 +289,6 @@ int spi_write_then_read(struct spi_device *spi,
|
|||
}
|
||||
EXPORT_SYMBOL(spi_write_then_read);
|
||||
|
||||
static int spi_match(struct device_d *dev, struct driver_d *drv)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_OFDEVICE) && dev->device_node &&
|
||||
drv->of_compatible)
|
||||
return of_match(dev, drv);
|
||||
|
||||
return strcmp(dev->name, drv->name) ? -1 : 0;
|
||||
}
|
||||
|
||||
static int spi_probe(struct device_d *dev)
|
||||
{
|
||||
return dev->driver->probe(dev);
|
||||
|
@ -310,7 +301,7 @@ static void spi_remove(struct device_d *dev)
|
|||
|
||||
struct bus_type spi_bus = {
|
||||
.name = "spi",
|
||||
.match = spi_match,
|
||||
.match = device_match,
|
||||
.probe = spi_probe,
|
||||
.remove = spi_remove,
|
||||
};
|
||||
|
|
|
@ -384,6 +384,7 @@ struct bus_type {
|
|||
};
|
||||
|
||||
int bus_register(struct bus_type *bus);
|
||||
int device_match(struct device_d *dev, struct driver_d *drv);
|
||||
|
||||
extern struct list_head bus_list;
|
||||
|
||||
|
|
Loading…
Reference in New Issue