diff options
author | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2014-07-19 22:03:29 +0000 |
---|---|---|
committer | Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> | 2014-07-19 22:03:29 +0000 |
commit | d441ea8ea864bda6b0d6c918da6da918579cf410 (patch) | |
tree | 5daecd880a16b7011be28e064fb7550f3e6b7e58 /programmer.c | |
parent | 6ba24a08730cd186fdbc32e2159ed299c210346b (diff) | |
download | flashrom-d441ea8ea864bda6b0d6c918da6da918579cf410.zip flashrom-d441ea8ea864bda6b0d6c918da6da918579cf410.tar.gz |
Rename programmer registration functions
Register_programmer suggests that we register a programmer. However,
that function registers a master for a given bus type, and a programmer
may support multiple masters (e.g. SPI, FWH). Rename a few other
functions to be more consistent.
Corresponding to flashrom svn r1831.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Diffstat (limited to 'programmer.c')
-rw-r--r-- | programmer.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/programmer.c b/programmer.c index 1874929..fd634b2 100644 --- a/programmer.c +++ b/programmer.c @@ -95,39 +95,39 @@ void fallback_chip_readn(const struct flashctx *flash, uint8_t *buf, return; } -int register_par_programmer(const struct par_programmer *pgm, +int register_par_master(const struct par_master *mst, const enum chipbustype buses) { - struct registered_programmer rpgm; - if (!pgm->chip_writeb || !pgm->chip_writew || !pgm->chip_writel || - !pgm->chip_writen || !pgm->chip_readb || !pgm->chip_readw || - !pgm->chip_readl || !pgm->chip_readn) { - msg_perr("%s called with incomplete programmer definition. " + struct registered_master rmst; + if (!mst->chip_writeb || !mst->chip_writew || !mst->chip_writel || + !mst->chip_writen || !mst->chip_readb || !mst->chip_readw || + !mst->chip_readl || !mst->chip_readn) { + msg_perr("%s called with incomplete master definition. " "Please report a bug at flashrom@flashrom.org\n", __func__); return ERROR_FLASHROM_BUG; } - rpgm.buses_supported = buses; - rpgm.par = *pgm; - return register_programmer(&rpgm); + rmst.buses_supported = buses; + rmst.par = *mst; + return register_master(&rmst); } /* The limit of 4 is totally arbitrary. */ -#define PROGRAMMERS_MAX 4 -struct registered_programmer registered_programmers[PROGRAMMERS_MAX]; -int registered_programmer_count = 0; +#define MASTERS_MAX 4 +struct registered_master registered_masters[MASTERS_MAX]; +int registered_master_count = 0; -/* This function copies the struct registered_programmer parameter. */ -int register_programmer(struct registered_programmer *pgm) +/* This function copies the struct registered_master parameter. */ +int register_master(struct registered_master *mst) { - if (registered_programmer_count >= PROGRAMMERS_MAX) { - msg_perr("Tried to register more than %i programmer " - "interfaces.\n", PROGRAMMERS_MAX); + if (registered_master_count >= MASTERS_MAX) { + msg_perr("Tried to register more than %i master " + "interfaces.\n", MASTERS_MAX); return ERROR_FLASHROM_LIMIT; } - registered_programmers[registered_programmer_count] = *pgm; - registered_programmer_count++; + registered_masters[registered_master_count] = *mst; + registered_master_count++; return 0; } @@ -137,8 +137,8 @@ enum chipbustype get_buses_supported(void) int i; enum chipbustype ret = BUS_NONE; - for (i = 0; i < registered_programmer_count; i++) - ret |= registered_programmers[i].buses_supported; + for (i = 0; i < registered_master_count; i++) + ret |= registered_masters[i].buses_supported; return ret; } |