aboutsummaryrefslogtreecommitdiffstats
path: root/i2c_helper.h
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-05-02 18:56:45 +0200
committerEdward O'Callaghan <quasisec@chromium.org>2021-05-09 03:34:05 +0000
commitdb23295f8d2a1ecc08f279c3f295558cc55fbeb5 (patch)
tree979f4304b82dba5a1d1650fa4ae30dbf260385c4 /i2c_helper.h
parentc7dd17062c1c0936d649f285c0013bb4a397e41c (diff)
downloadflashrom-db23295f8d2a1ecc08f279c3f295558cc55fbeb5.tar.gz
flashrom-db23295f8d2a1ecc08f279c3f295558cc55fbeb5.tar.bz2
flashrom-db23295f8d2a1ecc08f279c3f295558cc55fbeb5.zip
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>
Diffstat (limited to 'i2c_helper.h')
-rw-r--r--i2c_helper.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/i2c_helper.h b/i2c_helper.h
index cab2ce6f..709a748d 100644
--- a/i2c_helper.h
+++ b/i2c_helper.h
@@ -80,6 +80,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
*
* @fd: file descriptor to be closed.