aboutsummaryrefslogtreecommitdiffstats
path: root/mstarddc_spi.c
diff options
context:
space:
mode:
authorAnastasia Klimchuk <aklm@chromium.org>2021-05-18 09:34:55 +1000
committerEdward O'Callaghan <quasisec@chromium.org>2021-05-26 06:29:07 +0000
commitf57486e5d3000a0476b5f03afc9aa1b360045562 (patch)
tree9892e98adb2569000c74b52069d4d374c65cee81 /mstarddc_spi.c
parentbfb211cf273d731e4f67313f9cf2636156f8b117 (diff)
downloadflashrom-f57486e5d3000a0476b5f03afc9aa1b360045562.tar.gz
flashrom-f57486e5d3000a0476b5f03afc9aa1b360045562.tar.bz2
flashrom-f57486e5d3000a0476b5f03afc9aa1b360045562.zip
mstarddc_spi.c: Drop mstarddc_ prefix for spi data struct members
The name of the struct already contains mstarddc_ prefix, so prefix doesn't need to be repeated in members names. BUG=b:185191942 TEST=builds Change-Id: Ic04b14ce502917ae3b959cf2acf23d58b8752d47 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/54034 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'mstarddc_spi.c')
-rw-r--r--mstarddc_spi.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/mstarddc_spi.c b/mstarddc_spi.c
index da9f1521..0f638df2 100644
--- a/mstarddc_spi.c
+++ b/mstarddc_spi.c
@@ -32,9 +32,9 @@
#include "spi.h"
struct mstarddc_spi_data {
- int mstarddc_fd;
- int mstarddc_addr;
- int mstarddc_doreset;
+ int fd;
+ int addr;
+ int doreset;
};
// MSTAR DDC Commands
@@ -49,9 +49,9 @@ static int mstarddc_spi_shutdown(void *data)
struct mstarddc_spi_data *mstarddc_data = data;
// Reset, disables ISP mode
- if (mstarddc_data->mstarddc_doreset == 1) {
+ if (mstarddc_data->doreset == 1) {
uint8_t cmd = MSTARDDC_SPI_RESET;
- if (write(mstarddc_data->mstarddc_fd, &cmd, 1) < 0) {
+ if (write(mstarddc_data->fd, &cmd, 1) < 0) {
msg_perr("Error sending reset command: errno %d.\n",
errno);
return -1;
@@ -62,7 +62,7 @@ static int mstarddc_spi_shutdown(void *data)
"or an error occurred.\n");
}
- if (close(mstarddc_data->mstarddc_fd) < 0) {
+ if (close(mstarddc_data->fd) < 0) {
msg_perr("Error closing device: errno %d.\n", errno);
return -1;
}
@@ -89,7 +89,7 @@ static int mstarddc_spi_send_command(const struct flashctx *flash,
if (!ret && writecnt) {
cmd[0] = MSTARDDC_SPI_WRITE;
memcpy(cmd + 1, writearr, writecnt);
- if (write(mstarddc_data->mstarddc_fd, cmd, writecnt + 1) < 0) {
+ if (write(mstarddc_data->fd, cmd, writecnt + 1) < 0) {
msg_perr("Error sending write command: errno %d.\n",
errno);
ret = -1;
@@ -103,16 +103,16 @@ static int mstarddc_spi_send_command(const struct flashctx *flash,
cmd[0] = MSTARDDC_SPI_READ;
i2c_data.nmsgs = 2;
i2c_data.msgs = msg;
- i2c_data.msgs[0].addr = mstarddc_data->mstarddc_addr;
+ i2c_data.msgs[0].addr = mstarddc_data->addr;
i2c_data.msgs[0].len = 1;
i2c_data.msgs[0].flags = 0;
i2c_data.msgs[0].buf = cmd;
- i2c_data.msgs[1].addr = mstarddc_data->mstarddc_addr;
+ i2c_data.msgs[1].addr = mstarddc_data->addr;
i2c_data.msgs[1].len = readcnt;
i2c_data.msgs[1].flags = I2C_M_RD;
i2c_data.msgs[1].buf = readarr;
- if (ioctl(mstarddc_data->mstarddc_fd, I2C_RDWR, &i2c_data) < 0) {
+ if (ioctl(mstarddc_data->fd, I2C_RDWR, &i2c_data) < 0) {
msg_perr("Error sending read command: errno %d.\n",
errno);
ret = -1;
@@ -121,7 +121,7 @@ static int mstarddc_spi_send_command(const struct flashctx *flash,
if (!ret && (writecnt || readcnt)) {
cmd[0] = MSTARDDC_SPI_END;
- if (write(mstarddc_data->mstarddc_fd, cmd, 1) < 0) {
+ if (write(mstarddc_data->fd, cmd, 1) < 0) {
msg_perr("Error sending end command: errno %d.\n",
errno);
ret = -1;
@@ -131,7 +131,7 @@ static int mstarddc_spi_send_command(const struct flashctx *flash,
/* Do not reset if something went wrong, as it might prevent from
* retrying flashing. */
if (ret != 0)
- mstarddc_data->mstarddc_doreset = 0;
+ mstarddc_data->doreset = 0;
if (cmd)
free(cmd);
@@ -235,9 +235,10 @@ int mstarddc_spi_init(void)
ret = -1;
goto out;
}
- mstarddc_data->mstarddc_fd = mstarddc_fd;
- mstarddc_data->mstarddc_addr = mstarddc_addr;
- mstarddc_data->mstarddc_doreset = mstarddc_doreset;
+
+ mstarddc_data->fd = mstarddc_fd;
+ mstarddc_data->addr = mstarddc_addr;
+ mstarddc_data->doreset = mstarddc_doreset;
// Register shutdown function
register_shutdown(mstarddc_spi_shutdown, mstarddc_data);