Show
Ignore:
Timestamp:
07/07/08 08:38:51 (5 months ago)
Author:
stuge
Message:

flashrom: Trivial SPI cleanups

While writing a new SPI driver I fixed some things in the SPI code:
All calls to spi_command() had unneccessary #define duplications, and in some
cases the read count define could theoretically become harmful because NULL was
passed for the read buffer. Avoid a crash, should someone change the #defines.

I also noticed that the only caller of spi_page_program() was the it87 driver,
and spi_page_program() could only call back into the it87 driver. Removed the
function for easier-to-follow code and made it8716f_spi_page_program() static.
The ichspi driver's static page functions are already static.

Signed-off-by: Peter Stuge <peter@…>
Acked-by: Peter Stuge <peter@…>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/util/flashrom/it87spi.c

    r3401 r3418  
    193193 
    194194/* Page size is usually 256 bytes */ 
    195 void it8716f_spi_page_program(int block, uint8_t *buf, uint8_t *bios) { 
     195static void it8716f_spi_page_program(int block, uint8_t *buf, uint8_t *bios) { 
    196196        int i; 
    197197 
     
    262262        } else { 
    263263                for (i = 0; i < total_size / 256; i++) { 
    264                         spi_page_program(i, buf, (uint8_t *)flash->virtual_memory); 
    265                 } 
    266         } 
    267         return 0; 
    268 } 
    269  
     264                        it8716f_spi_page_program(i, buf, (uint8_t *)flash->virtual_memory); 
     265                } 
     266        } 
     267        return 0; 
     268} 
     269