Changeset 4096


Ignore:
Timestamp:
02/21/08 09:37:05 (5 years ago)
Author:
werner
Message:

http://moko.mwester.net/s3cmci_diff_from_svn4082.patch by Mike Westerhof

Changing the structure of the loops slightly: "while
((condition1) && fifo--)" is a bad idea if you need to ensure that fifo
doesn't go below zero when the loop exits (follow the code with the case
where we have an unaligned buffer, and need to read or write 1 byte).

s3c_mci.patch:

  • drivers/mmc/host/s3cmci.c (do_pio_read, do_pio_write): don't decrement "fifo" past zero
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/src/target/kernel/2.6.24.x/patches/s3c_mci.patch

    r4082 r4096  
    9090--- /dev/null 
    9191+++ linux-2.6.24/drivers/mmc/host/s3cmci.c 
    92 @@ -0,0 +1,1411 @@ 
     92@@ -0,0 +1,1419 @@ 
    9393+/* 
    9494+ *  linux/drivers/mmc/s3cmci.h - Samsung S3C MCI driver 
     
    344344+ 
    345345+               /* we might have an unaligned start of data */ 
    346 +               while (((unsigned long)host->pio_ptr & 0x03) && fifo--) 
     346+               while (((unsigned long)host->pio_ptr & 0x03) && fifo) { 
    347347+                       *(host->pio_ptr++) = readb(host->base + host->sdidata_b); 
     348+                       fifo--; 
     349+               } 
    348350+ 
    349351+               /* and a major chunk of data in the middle */ 
     
    354356+ 
    355357+               /* as well as some non-modulo-four trailer */ 
    356 +               while (fifo) 
     358+               while (fifo) { 
    357359+                       *(host->pio_ptr++) = readb(host->base + host->sdidata_b); 
     360+                       fifo--; 
     361+               } 
    358362+       } 
    359363+ 
     
    408412+ 
    409413+               /* we might have an unaligned start of data */ 
    410 +               while ((unsigned long)host->pio_ptr & 0x03) 
     414+               while (((unsigned long)host->pio_ptr & 0x03) && fifo) { 
    411415+                       writeb(*(host->pio_ptr++), host->base + host->sdidata_b); 
     416+                       fifo--; 
     417+               } 
    412418+ 
    413419+               /* and a major chunk of data in the middle */ 
     
    418424+ 
    419425+               /* as well as some non-modulo-four trailer */ 
    420 +               while (fifo--) 
     426+               while (fifo) { 
    421427+                       writeb(*(host->pio_ptr++), host->base + host->sdidata_b); 
     428+                       fifo--; 
     429+               } 
    422430+       } 
    423431+ 
     
    15801588--- linux-2.6.24.orig/drivers/mmc/host/Kconfig 
    15811589+++ linux-2.6.24/drivers/mmc/host/Kconfig 
    1582 @@ -130,3 +130,14 @@ 
     1590@@ -130,3 +130,14 @@ config MMC_SPI 
    15831591  
    15841592          If unsure, or if your system has no SPI master driver, say N. 
     
    15991607--- linux-2.6.24.orig/drivers/mmc/host/Makefile 
    16001608+++ linux-2.6.24/drivers/mmc/host/Makefile 
    1601 @@ -17,4 +17,4 @@ 
     1609@@ -17,4 +17,4 @@ obj-$(CONFIG_MMC_OMAP)                += omap.o 
    16021610 obj-$(CONFIG_MMC_AT91)         += at91_mci.o 
    16031611 obj-$(CONFIG_MMC_TIFM_SD)      += tifm_sd.o 
     
    16271635--- linux-2.6.24.orig/arch/arm/mach-s3c2412/s3c2412.c 
    16281636+++ linux-2.6.24/arch/arm/mach-s3c2412/s3c2412.c 
    1629 @@ -214,5 +214,8 @@ 
     1637@@ -214,5 +214,8 @@ int __init s3c2412_init(void) 
    16301638 { 
    16311639        printk("S3C2412: Initialising architecture\n"); 
     
    16401648--- linux-2.6.24.orig/arch/arm/mach-s3c2440/s3c2440.c 
    16411649+++ linux-2.6.24/arch/arm/mach-s3c2440/s3c2440.c 
    1642 @@ -46,6 +46,9 @@ 
     1650@@ -46,6 +46,9 @@ int __init s3c2440_init(void) 
    16431651        s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT; 
    16441652        s3c_device_wdt.resource[1].end   = IRQ_S3C2440_WDT; 
     
    16621670 static struct sys_device s3c2442_sysdev = { 
    16631671        .cls            = &s3c2442_sysclass, 
    1664 @@ -30,5 +31,8 @@ 
     1672@@ -30,5 +31,8 @@ int __init s3c2442_init(void) 
    16651673 { 
    16661674        printk("S3C2442: Initialising architecture\n"); 
Note: See TracChangeset for help on using the changeset viewer.