[PATCH 2/5] SPI: Put SPI devices on their own bus bus

Sascha Hauer s.hauer at pengutronix.de
Tue Sep 11 10:26:37 EDT 2012


On Tue, Sep 11, 2012 at 04:03:49PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 15:31 Tue 11 Sep     , Sascha Hauer wrote:
> > This patch adds a SPI bus on which the SPI devices and drivers register.
> > This makes it cleaner as SPI devices won't accidently end up probed by
> > a platform_device driver.
> > 
> >  EXPORT_SYMBOL(spi_write_then_read);
> > +
> > +static int spi_match(struct device_d *dev, struct driver_d *drv)
> > +{
> > +	return strcmp(dev->name, drv->name) ? -1 : 0;
> > +}
> > +
> > +static int spi_probe(struct device_d *dev)
> > +{
> > +	return dev->driver->probe(dev);
> > +}
> > +
> > +static void spi_remove(struct device_d *dev)
> > +{
> > +	dev->driver->remove(dev);
> > +}
> this is code is commonon with the generix drvier can we share it?

One of the next step in this area probably is to call a device->probe
function with a struct i2c_device / struct spi_device, so I don't think
it's worth the effort now.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list