/* The caller is responsible for assigning the bus number and initializing the master's methods before calling spi_register_master(); and (after errors adding the device) calling spi_master_put() to prevent a memory leak.  */
struct spi_master* spi_alloc_master(struct device *dev, unsigned size)
/* The caller is responsible for assigning the bus number and initializing the master's methods before calling spi_register_master(); and (after errors adding the device) calling spi_master_put() to prevent a memory leak.  */
struct spi_master* spi_alloc_master(struct device *dev, unsigned size)
{
	struct spi_master	*master;
	if (!dev)
		return NULL;
	master = kzalloc(size + sizeof *master, GFP_KERNEL);
	if (!master)
		return NULL;
	device_initialize(&master->dev);
	master->dev.class = &spi_master_class;
	master->dev.parent = get_device(dev);
	spi_master_set_devdata(master, &master[1]);
	return master;
}