spi: Use list_last_entry at appropriate places
authorAxel Lin <axel.lin@ingics.com>
Wed, 12 Feb 2014 14:13:27 +0000 (22:13 +0800)
committerMark Brown <broonie@linaro.org>
Sun, 23 Feb 2014 03:47:07 +0000 (12:47 +0900)
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-dw.c
drivers/spi/spi-pl022.c
drivers/spi/spi-pxa2xx.c

index bf98d63d92b3eabbd80ea49d125421069139c535..390da9bf2d8479c54ff9895e8dbfddf64adec5d6 100644 (file)
@@ -276,8 +276,7 @@ static void giveback(struct dw_spi *dws)
        queue_work(dws->workqueue, &dws->pump_messages);
        spin_unlock_irqrestore(&dws->lock, flags);
 
-       last_transfer = list_entry(msg->transfers.prev,
-                                       struct spi_transfer,
+       last_transfer = list_last_entry(&msg->transfers, struct spi_transfer,
                                        transfer_list);
 
        if (!last_transfer->cs_change && dws->cs_control)
index 2789b452e71159a86164ff752ef2c1e06a6da411..3c5b90559bec91dc238a0c4ba88fece6fdd01e73 100644 (file)
@@ -459,9 +459,8 @@ static void giveback(struct pl022 *pl022)
        struct spi_transfer *last_transfer;
        pl022->next_msg_cs_active = false;
 
-       last_transfer = list_entry(pl022->cur_msg->transfers.prev,
-                                       struct spi_transfer,
-                                       transfer_list);
+       last_transfer = list_last_entry(&pl022->cur_msg->transfers,
+                                       struct spi_transfer, transfer_list);
 
        /* Delay if requested before any change in chip select */
        if (last_transfer->delay_usecs)
index c702fc536a775c8400cfa64a1b208c71e2953c15..41185d0557fa5575531d6da9318b7c135198a681 100644 (file)
@@ -362,8 +362,7 @@ static void giveback(struct driver_data *drv_data)
        drv_data->cur_msg = NULL;
        drv_data->cur_transfer = NULL;
 
-       last_transfer = list_entry(msg->transfers.prev,
-                                       struct spi_transfer,
+       last_transfer = list_last_entry(&msg->transfers, struct spi_transfer,
                                        transfer_list);
 
        /* Delay if requested before any change in chip select */