summaryrefslogtreecommitdiffstats
path: root/jedec.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2010-07-03 11:02:10 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2010-07-03 11:02:10 +0000
commitad3cc55e139b2e239325815464fe5f7d828aa794 (patch)
tree46568cf766d19740418be5ca8eaa494c7e69cc36 /jedec.c
parentb63b067ae22803689592db482611093b33a29eef (diff)
downloadast2050-flashrom-ad3cc55e139b2e239325815464fe5f7d828aa794.zip
ast2050-flashrom-ad3cc55e139b2e239325815464fe5f7d828aa794.tar.gz
Kill global variables, constants and functions if local scope suffices
Constify variables where possible. Initialize programmer-related variables explicitly in programmer_init to allow running programmer_init from a clean state after programmer_shutdown. Prohibit registering programmer shutdown functions before init or after shutdown. Kill some dead code. Rename global variables with namespace-polluting names. Use a previously unused locking helper function in sst49lfxxxc.c. This is needed for libflashrom. Effects on the binary size of flashrom are minimal (300 bytes shrinkage), but the data section shrinks by 4384 bytes, and that's a good thing if flashrom is operating in constrained envionments. Corresponding to flashrom svn r1068. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Diffstat (limited to 'jedec.c')
-rw-r--r--jedec.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/jedec.c b/jedec.c
index 30c343f..05cba79 100644
--- a/jedec.c
+++ b/jedec.c
@@ -38,7 +38,7 @@ uint8_t oddparity(uint8_t val)
return (val ^ (val >> 1)) & 0x1;
}
-void toggle_ready_jedec_common(chipaddr dst, int delay)
+static void toggle_ready_jedec_common(chipaddr dst, int delay)
{
unsigned int i = 0;
uint8_t tmp1, tmp2;
@@ -70,7 +70,7 @@ void toggle_ready_jedec(chipaddr dst)
* Given that erase is slow on all chips, it is recommended to use
* toggle_ready_jedec_slow in erase functions.
*/
-void toggle_ready_jedec_slow(chipaddr dst)
+static void toggle_ready_jedec_slow(chipaddr dst)
{
toggle_ready_jedec_common(dst, 8 * 1000);
}
@@ -92,7 +92,7 @@ void data_polling_jedec(chipaddr dst, uint8_t data)
msg_cdbg("%s: excessive loops, i=0x%x\n", __func__, i);
}
-void start_program_jedec_common(struct flashchip *flash, unsigned int mask)
+static void start_program_jedec_common(struct flashchip *flash, unsigned int mask)
{
chipaddr bios = flash->virtual_memory;
chip_writeb(0xAA, bios + (0x5555 & mask));
@@ -100,7 +100,7 @@ void start_program_jedec_common(struct flashchip *flash, unsigned int mask)
chip_writeb(0xA0, bios + (0x5555 & mask));
}
-int probe_jedec_common(struct flashchip *flash, unsigned int mask)
+static int probe_jedec_common(struct flashchip *flash, unsigned int mask)
{
chipaddr bios = flash->virtual_memory;
uint8_t id1, id2;
@@ -199,7 +199,7 @@ int probe_jedec_common(struct flashchip *flash, unsigned int mask)
return 1;
}
-int erase_sector_jedec_common(struct flashchip *flash, unsigned int page,
+static int erase_sector_jedec_common(struct flashchip *flash, unsigned int page,
unsigned int pagesize, unsigned int mask)
{
chipaddr bios = flash->virtual_memory;
@@ -229,7 +229,7 @@ int erase_sector_jedec_common(struct flashchip *flash, unsigned int page,
return 0;
}
-int erase_block_jedec_common(struct flashchip *flash, unsigned int block,
+static int erase_block_jedec_common(struct flashchip *flash, unsigned int block,
unsigned int blocksize, unsigned int mask)
{
chipaddr bios = flash->virtual_memory;
@@ -259,7 +259,7 @@ int erase_block_jedec_common(struct flashchip *flash, unsigned int block,
return 0;
}
-int erase_chip_jedec_common(struct flashchip *flash, unsigned int mask)
+static int erase_chip_jedec_common(struct flashchip *flash, unsigned int mask)
{
int total_size = flash->total_size * 1024;
chipaddr bios = flash->virtual_memory;
@@ -288,7 +288,7 @@ int erase_chip_jedec_common(struct flashchip *flash, unsigned int mask)
return 0;
}
-int write_byte_program_jedec_common(struct flashchip *flash, uint8_t *src,
+static int write_byte_program_jedec_common(struct flashchip *flash, uint8_t *src,
chipaddr dst, unsigned int mask)
{
int tried = 0, failed = 0;
@@ -335,7 +335,7 @@ int write_sector_jedec_common(struct flashchip *flash, uint8_t *src,
return failed;
}
-int write_page_write_jedec_common(struct flashchip *flash, uint8_t *src,
+static int write_page_write_jedec_common(struct flashchip *flash, uint8_t *src,
int start, int page_size, unsigned int mask)
{
int i, tried = 0, failed;
@@ -374,7 +374,7 @@ retry:
return failed;
}
-int getaddrmask(struct flashchip *flash)
+static int getaddrmask(struct flashchip *flash)
{
switch (flash->feature_bits & FEATURE_ADDR_MASK) {
case FEATURE_ADDR_FULL:
OpenPOWER on IntegriCloud