/* Returns a pointer to the new device, or NULL.  */
struct spi_device* spi_alloc_device(struct spi_master *master)
/* Returns a pointer to the new device, or NULL.  */
struct spi_device* spi_alloc_device(struct spi_master *master)
{
	struct spi_device	*spi;
	struct device		*dev = master->dev.parent;
	if (!spi_master_get(master))
		return NULL;
	spi = kzalloc(sizeof *spi, GFP_KERNEL);
	if (!spi) {
		dev_err(dev, "cannot alloc spi_device\n");
		spi_master_put(master);
		return NULL;
	}
	spi->master = master;
	spi->dev.parent = dev;
	spi->dev.bus = &spi_bus_type;
	spi->dev.release = spidev_release;
	device_initialize(&spi->dev);
	return spi;
}