1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 06:23:18 +02:00

lspcon_i2c_spi: Extract I2C bus parameter handling

Introduce the `i2c_open_from_programmer_params` function to avoid having
to duplicate parameter parsing code on all I2C programmers. This also
allows having the same programmer parameters on all I2C programmers.

Change-Id: I006b311c88feea37fe4b217f769b21ca1505def9
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52830
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
This commit is contained in:
Angel Pons
2021-05-02 18:56:45 +02:00
committed by Edward O'Callaghan
parent c7dd17062c
commit db23295f8d
3 changed files with 57 additions and 61 deletions

View File

@ -79,6 +79,15 @@ int i2c_open(int bus, uint16_t addr, int force);
*/
int i2c_open_path(const char *path, uint16_t addr, int force);
/**
* i2c_open_from_programmer_params: open an I2C device from programmer params
*
* This function is a wrapper for i2c_open and i2c_open_path that obtains the
* I2C device to use from programmer parameters. It is meant to be called
* from I2C-based programmers to avoid repeating parameter parsing code.
*/
int i2c_open_from_programmer_params(uint16_t addr, int force);
/**
* i2c_close - closes the file descriptor returned by i2c_open
*