use broken-out patches for the coldfire to make it easier to follow differences again...
[15.05/openwrt.git] / target / linux / coldfire / patches / 028-mcfv4e_cache_ck_0_len.patch
1 From 679a5be6f06b909adccc9c588feb26bf6d6df402 Mon Sep 17 00:00:00 2001
2 From: Kurt Mahan <kmahan@freescale.com>
3 Date: Thu, 6 Dec 2007 16:40:39 -0700
4 Subject: [PATCH] Add zero length checking to cache routines.
5
6 LTIBName: mcfv4e-cache-ck-0-len
7 Signed-off-by: Kurt Mahan <kmahan@freescale.com>
8 ---
9  include/asm-m68k/cf_cacheflush.h |   14 +++++++++++---
10  1 files changed, 11 insertions(+), 3 deletions(-)
11
12 --- a/include/asm-m68k/cf_cacheflush.h
13 +++ b/include/asm-m68k/cf_cacheflush.h
14 @@ -127,7 +127,9 @@ static inline void flush_bcache(void)
15  static inline void cf_cache_clear(unsigned long paddr, int len)
16  {
17         /* number of lines */
18 -       len =  (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
19 +       len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
20 +       if (len == 0)
21 +               return;
22  
23         /* align on set boundary */
24         paddr &= 0xfffffff0;
25 @@ -161,7 +163,9 @@ static inline void cf_cache_clear(unsign
26  static inline void cf_cache_push(unsigned long paddr, int len)
27  {
28         /* number of lines */
29 -       len =  (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
30 +       len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
31 +       if (len == 0)
32 +               return;
33  
34         /* align on set boundary */
35         paddr &= 0xfffffff0;
36 @@ -195,7 +199,9 @@ static inline void cf_cache_push(unsigne
37  static inline void cf_cache_flush(unsigned long paddr, int len)
38  {
39         /* number of lines */
40 -       len =  (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
41 +       len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
42 +       if (len == 0)
43 +               return;
44  
45         /* align on set boundary */
46         paddr &= 0xfffffff0;
47 @@ -234,6 +240,8 @@ static inline void cf_cache_flush_range(
48         vstart &= 0xfffffff0;
49         vend = PAGE_ALIGN((vend + (CACHE_LINE_SIZE-1))) & 0xfffffff0;
50         len = vend - vstart;
51 +       if (len == 0)
52 +               return;
53         vstart = __pa(vstart);
54         vend = vstart + len;
55