Changeset 11837


Ignore:
Timestamp:
2008-07-15T12:22:28+02:00 (10 years ago)
Author:
florian
Message:

Fix the CF serial number byteswapping (#3133)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/rb532/files/drivers/block/rb500/ata.c

    r10768 r11837  
    359359        int res; 
    360360        char tstr[17]; //serial 
     361        char tmp; 
     362        int i; 
    361363        BUG_ON(dev->tstate!=TS_IDLE); 
    362364        dev->tbuf = (char *) sbuf; 
     
    382384        dev->sectors = ((unsigned long) sbuf[7] << 16) | sbuf[8]; 
    383385        dev->dtype=sbuf[0]; 
    384         memcpy(tstr,&sbuf[12],16); 
    385         tstr[16]=0; 
     386        memcpy(tstr, &sbuf[12], 16); 
     387        tstr[16] = '\0'; 
     388 
     389        /* Byte-swap the serial number */ 
     390        for (i = 0; i<8; i++) { 
     391                tmp = tstr[i * 2]; 
     392                tstr[i * 2] = tstr[i * 2 +1]; 
     393                tstr[i * 2 + 1] = tmp; 
     394        } 
     395 
    386396        printk(KERN_INFO "cf-mips: %s detected, C/H/S=%d/%d/%d sectors=%u (%uMB) Serial=%s\n", 
    387397               (sbuf[0] == 0x848A ? "CF card" : "ATA drive"), dev->cyl, dev->head, 
Note: See TracChangeset for help on using the changeset viewer.