Skip to contentSkip to conversation

spi-topcliff-pch: Fix count calculation issue

PATCH In review Tomoya MORINAGA 2 participants 3 messages Nov 17, 2011 – Dec 8, 2011 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi-topcliff-pch: Fix count calculation issue

Currently, count value is not correct more than len=8193 like below.

len Current-cnt New-cnt Anticipated-cnt
4095 1 1 1
4096 1 1 1
4097 2 2 2

8191 2 2 2
8192 2 2 2
8193 2(NG) 3 3

12287 3 3 3
12288 3 3 3
12289 3(NG) 4 4

This patch fixes the issue.

---
 drivers/spi/spi-topcliff-pch.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/spi/spi-topcliff-pch.c +3 -1
index 9fb0541..08b5f31 100644
@@ -1247,7 +1247,9 @@ static void pch_spi_process_messages(struct work_struct *pwork)
 		}
 		spin_unlock(&data->lock);
 
-		cnt = data->cur_trans->len / (PCH_BUF_SIZE + 1) + 1;
+		if (!data->cur_trans->len)
+			goto out;
+		cnt = (data->cur_trans->len - 1) / PCH_BUF_SIZE + 1;
 		data->save_total_len = data->cur_trans->len;
 		if (data->use_dma) {
 			int i;
Signature · 1 line
1.7.4.4
#1 lore raw

Hi,

Quoted 11 lines · Tomoya MORINAGA

Currently, count value is not correct more than len=8193 like below.

len Current-cnt New-cnt Anticipated-cnt
4095 1 1 1
4096 1 1 1
4097 2 2 2

8191 2 2 2
8192 2 2 2
8193 2(NG) 3 3

Quoted 7 lines

12287 3 3 3
12288 3 3 3
12289 3(NG) 4 4

This patch fixes the issue.

Which branch is this patch based on?

Regards,

Wolfram

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#2 lore raw

2011/12/8, Wolfram Sang <[email protected]>:

Quoted 4 lines
Quoted 2 lines

Which branch is this patch based on?

This patch was created for linux-3.2.
However, other patches which have dependency are not sent to upstream yet. So, I'll send the patch series again.
Sorry, for inconvenience.

thanks,
tomoya

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/