diff options
Diffstat (limited to 'drivers/spi/spi-dw.c')
-rw-r--r-- | drivers/spi/spi-dw.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 29f33143b795..0dd0623319b0 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -271,7 +271,7 @@ static void giveback(struct dw_spi *dws) | |||
271 | transfer_list); | 271 | transfer_list); |
272 | 272 | ||
273 | if (!last_transfer->cs_change) | 273 | if (!last_transfer->cs_change) |
274 | spi_chip_sel(dws, dws->cur_msg->spi, 0); | 274 | spi_chip_sel(dws, msg->spi, 0); |
275 | 275 | ||
276 | spi_finalize_current_message(dws->master); | 276 | spi_finalize_current_message(dws->master); |
277 | } | 277 | } |
@@ -547,8 +547,7 @@ static int dw_spi_setup(struct spi_device *spi) | |||
547 | /* Only alloc on first setup */ | 547 | /* Only alloc on first setup */ |
548 | chip = spi_get_ctldata(spi); | 548 | chip = spi_get_ctldata(spi); |
549 | if (!chip) { | 549 | if (!chip) { |
550 | chip = devm_kzalloc(&spi->dev, sizeof(struct chip_data), | 550 | chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); |
551 | GFP_KERNEL); | ||
552 | if (!chip) | 551 | if (!chip) |
553 | return -ENOMEM; | 552 | return -ENOMEM; |
554 | spi_set_ctldata(spi, chip); | 553 | spi_set_ctldata(spi, chip); |
@@ -606,6 +605,14 @@ static int dw_spi_setup(struct spi_device *spi) | |||
606 | return 0; | 605 | return 0; |
607 | } | 606 | } |
608 | 607 | ||
608 | static void dw_spi_cleanup(struct spi_device *spi) | ||
609 | { | ||
610 | struct chip_data *chip = spi_get_ctldata(spi); | ||
611 | |||
612 | kfree(chip); | ||
613 | spi_set_ctldata(spi, NULL); | ||
614 | } | ||
615 | |||
609 | /* Restart the controller, disable all interrupts, clean rx fifo */ | 616 | /* Restart the controller, disable all interrupts, clean rx fifo */ |
610 | static void spi_hw_init(struct dw_spi *dws) | 617 | static void spi_hw_init(struct dw_spi *dws) |
611 | { | 618 | { |
@@ -661,6 +668,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) | |||
661 | master->bus_num = dws->bus_num; | 668 | master->bus_num = dws->bus_num; |
662 | master->num_chipselect = dws->num_cs; | 669 | master->num_chipselect = dws->num_cs; |
663 | master->setup = dw_spi_setup; | 670 | master->setup = dw_spi_setup; |
671 | master->cleanup = dw_spi_cleanup; | ||
664 | master->transfer_one_message = dw_spi_transfer_one_message; | 672 | master->transfer_one_message = dw_spi_transfer_one_message; |
665 | master->max_speed_hz = dws->max_freq; | 673 | master->max_speed_hz = dws->max_freq; |
666 | 674 | ||