diff options
author | Rui Miguel Silva <rui.silva@linaro.org> | 2015-12-15 19:09:57 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-12-15 14:32:12 -0800 |
commit | 65fabd1848f2ddd00a1af5a1eaeb4f95dcb25b77 (patch) | |
tree | 259b40685a80c530dcd85b09aab0c4c5816df6b2 /drivers | |
parent | 4a0c4453e3f99335db3e7786b1a66e3b6cfa0653 (diff) |
greybus: spi: fix and cleanup spi devices handling
Cleanup and remove the spi_devices from the greybus spi handling as they
are not needed and they were completely misused.
With this the gb_spi_init does not make sense to exist anymore, so just
remove it and handle the master config directly from connection init.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Reported-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/greybus/spi.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/drivers/staging/greybus/spi.c b/drivers/staging/greybus/spi.c index e49dc56495b5..ad4a1d62587d 100644 --- a/drivers/staging/greybus/spi.c +++ b/drivers/staging/greybus/spi.c @@ -23,7 +23,6 @@ struct gb_spi { u8 num_chipselect; u32 min_speed_hz; u32 max_speed_hz; - struct spi_device *spi_devices; }; static struct spi_master *get_master_from_spi(struct gb_spi *spi) @@ -284,7 +283,7 @@ static int gb_spi_setup_device(struct gb_spi *spi, u8 cs) struct gb_spi_device_config_request request; struct gb_spi_device_config_response response; struct spi_board_info spi_board = { {0} }; - struct spi_device *spidev = &spi->spi_devices[cs]; + struct spi_device *spidev; int ret; request.chip_select = cs; @@ -308,24 +307,6 @@ static int gb_spi_setup_device(struct gb_spi *spi, u8 cs) return 0; } -static int gb_spi_init(struct gb_spi *spi) -{ - int ret; - - /* get master configuration */ - ret = gb_spi_get_master_config(spi); - if (ret) - return ret; - - spi->spi_devices = kcalloc(spi->num_chipselect, - sizeof(struct spi_device), GFP_KERNEL); - if (!spi->spi_devices) - return -ENOMEM; - - return ret; -} - - static int gb_spi_connection_init(struct gb_connection *connection) { struct gb_spi *spi; @@ -344,7 +325,8 @@ static int gb_spi_connection_init(struct gb_connection *connection) spi->connection = connection; connection->private = master; - ret = gb_spi_init(spi); + /* get master configuration */ + ret = gb_spi_get_master_config(spi); if (ret) goto out_put_master; |