From 1e8a52e18cfb381bc9cc1f0b720540364d2a6edd Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Sat, 19 May 2012 23:42:08 -0600 Subject: spi: By default setup spi_masters with 1 chipselect and dynamics bus number Trivial simplification. Instead of requiring spi master drivers to always set the bus number (even when a dynamic number is desired), this patch modifies spi_alloc_master() to initialize num_chipselect to 1 (because there will always be at least one CS) and bus_num to -1 for dynamic allocation. This simplifies the code needed to be written for drivers. Signed-off-by: Grant Likely --- drivers/spi/spi.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/spi/spi.c') diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 2d65b1684cd..1041cb83d67 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -936,6 +936,8 @@ struct spi_master *spi_alloc_master(struct device *dev, unsigned size) return NULL; device_initialize(&master->dev); + master->bus_num = -1; + master->num_chipselect = 1; master->dev.class = &spi_master_class; master->dev.parent = get_device(dev); spi_master_set_devdata(master, &master[1]); -- cgit v1.2.3-70-g09d2