diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-04-27 02:06:00 -0400 |
---|---|---|
committer | Mark Brown <broonie@sirena.org.uk> | 2013-04-27 21:18:13 -0400 |
commit | cd8d984f0def2a8c5733a9468634ec3e0feec03d (patch) | |
tree | fd089569eb9c1c6c02ecc4ab13eea455e4f3e961 | |
parent | 0113f22ee49ff1972de55632dda44eb9299e625d (diff) |
spi-topcliff-pch: fix to use list_for_each_entry_safe() when delete list items
Since we will remove items off the list using list_del_init() we need
to use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
-rw-r--r-- | drivers/spi/spi-topcliff-pch.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c index c8b672e07ba0..35f60bd252dd 100644 --- a/drivers/spi/spi-topcliff-pch.c +++ b/drivers/spi/spi-topcliff-pch.c | |||
@@ -615,7 +615,7 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw) | |||
615 | int size; | 615 | int size; |
616 | u32 n_writes; | 616 | u32 n_writes; |
617 | int j; | 617 | int j; |
618 | struct spi_message *pmsg; | 618 | struct spi_message *pmsg, *tmp; |
619 | const u8 *tx_buf; | 619 | const u8 *tx_buf; |
620 | const u16 *tx_sbuf; | 620 | const u16 *tx_sbuf; |
621 | 621 | ||
@@ -656,7 +656,7 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw) | |||
656 | if (!data->pkt_rx_buff) { | 656 | if (!data->pkt_rx_buff) { |
657 | /* flush queue and set status of all transfers to -ENOMEM */ | 657 | /* flush queue and set status of all transfers to -ENOMEM */ |
658 | dev_err(&data->master->dev, "%s :kzalloc failed\n", __func__); | 658 | dev_err(&data->master->dev, "%s :kzalloc failed\n", __func__); |
659 | list_for_each_entry(pmsg, data->queue.next, queue) { | 659 | list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) { |
660 | pmsg->status = -ENOMEM; | 660 | pmsg->status = -ENOMEM; |
661 | 661 | ||
662 | if (pmsg->complete != 0) | 662 | if (pmsg->complete != 0) |
@@ -703,7 +703,7 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw) | |||
703 | 703 | ||
704 | static void pch_spi_nomore_transfer(struct pch_spi_data *data) | 704 | static void pch_spi_nomore_transfer(struct pch_spi_data *data) |
705 | { | 705 | { |
706 | struct spi_message *pmsg; | 706 | struct spi_message *pmsg, *tmp; |
707 | dev_dbg(&data->master->dev, "%s called\n", __func__); | 707 | dev_dbg(&data->master->dev, "%s called\n", __func__); |
708 | /* Invoke complete callback | 708 | /* Invoke complete callback |
709 | * [To the spi core..indicating end of transfer] */ | 709 | * [To the spi core..indicating end of transfer] */ |
@@ -740,7 +740,7 @@ static void pch_spi_nomore_transfer(struct pch_spi_data *data) | |||
740 | dev_dbg(&data->master->dev, | 740 | dev_dbg(&data->master->dev, |
741 | "%s suspend/remove initiated, flushing queue\n", | 741 | "%s suspend/remove initiated, flushing queue\n", |
742 | __func__); | 742 | __func__); |
743 | list_for_each_entry(pmsg, data->queue.next, queue) { | 743 | list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) { |
744 | pmsg->status = -EIO; | 744 | pmsg->status = -EIO; |
745 | 745 | ||
746 | if (pmsg->complete) | 746 | if (pmsg->complete) |
@@ -1187,7 +1187,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw) | |||
1187 | 1187 | ||
1188 | static void pch_spi_process_messages(struct work_struct *pwork) | 1188 | static void pch_spi_process_messages(struct work_struct *pwork) |
1189 | { | 1189 | { |
1190 | struct spi_message *pmsg; | 1190 | struct spi_message *pmsg, *tmp; |
1191 | struct pch_spi_data *data; | 1191 | struct pch_spi_data *data; |
1192 | int bpw; | 1192 | int bpw; |
1193 | 1193 | ||
@@ -1199,7 +1199,7 @@ static void pch_spi_process_messages(struct work_struct *pwork) | |||
1199 | if (data->board_dat->suspend_sts || (data->status == STATUS_EXITING)) { | 1199 | if (data->board_dat->suspend_sts || (data->status == STATUS_EXITING)) { |
1200 | dev_dbg(&data->master->dev, "%s suspend/remove initiated," | 1200 | dev_dbg(&data->master->dev, "%s suspend/remove initiated," |
1201 | "flushing queue\n", __func__); | 1201 | "flushing queue\n", __func__); |
1202 | list_for_each_entry(pmsg, data->queue.next, queue) { | 1202 | list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) { |
1203 | pmsg->status = -EIO; | 1203 | pmsg->status = -EIO; |
1204 | 1204 | ||
1205 | if (pmsg->complete != 0) { | 1205 | if (pmsg->complete != 0) { |