net: dsa: sja1105: Rename sja1105_spi_send_packed_buf to sja1105_xfer_buf
The most commonly called function in the driver is long due for a rename. The "packed" word is redundant (it doesn't make sense to transfer an unpacked structure, since that is in CPU endianness yadda yadda), and the "spi" word is also redundant since argument 2 of the function is SPI_READ or SPI_WRITE. As for the sja1105_spi_send_long_packed_buf function, it is only being used from sja1105_spi.c, so remove its global prototype. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
dff79620c3
commit
1bd4487038
@@ -63,11 +63,11 @@ sja1105_spi_message_pack(void *buf, const struct sja1105_spi_message *msg)
|
||||
*
|
||||
* This function should only be called if it is priorly known that
|
||||
* @size_bytes is smaller than SIZE_SPI_MSG_MAXLEN. Larger packed buffers
|
||||
* are chunked in smaller pieces by sja1105_spi_send_long_packed_buf below.
|
||||
* are chunked in smaller pieces by sja1105_xfer_long_buf below.
|
||||
*/
|
||||
int sja1105_spi_send_packed_buf(const struct sja1105_private *priv,
|
||||
sja1105_spi_rw_mode_t rw, u64 reg_addr,
|
||||
void *packed_buf, size_t size_bytes)
|
||||
int sja1105_xfer_buf(const struct sja1105_private *priv,
|
||||
sja1105_spi_rw_mode_t rw, u64 reg_addr,
|
||||
void *packed_buf, size_t size_bytes)
|
||||
{
|
||||
u8 tx_buf[SJA1105_SIZE_SPI_TRANSFER_MAX] = {0};
|
||||
u8 rx_buf[SJA1105_SIZE_SPI_TRANSFER_MAX] = {0};
|
||||
@@ -118,7 +118,7 @@ int sja1105_xfer_u64(const struct sja1105_private *priv,
|
||||
if (rw == SPI_WRITE)
|
||||
sja1105_pack(packed_buf, value, 63, 0, 8);
|
||||
|
||||
rc = sja1105_spi_send_packed_buf(priv, rw, reg_addr, packed_buf, 8);
|
||||
rc = sja1105_xfer_buf(priv, rw, reg_addr, packed_buf, 8);
|
||||
|
||||
if (rw == SPI_READ)
|
||||
sja1105_unpack(packed_buf, value, 63, 0, 8);
|
||||
@@ -142,7 +142,7 @@ int sja1105_xfer_u32(const struct sja1105_private *priv,
|
||||
sja1105_pack(packed_buf, &tmp, 31, 0, 4);
|
||||
}
|
||||
|
||||
rc = sja1105_spi_send_packed_buf(priv, rw, reg_addr, packed_buf, 4);
|
||||
rc = sja1105_xfer_buf(priv, rw, reg_addr, packed_buf, 4);
|
||||
|
||||
if (rw == SPI_READ) {
|
||||
sja1105_unpack(packed_buf, &tmp, 31, 0, 4);
|
||||
@@ -156,9 +156,9 @@ int sja1105_xfer_u32(const struct sja1105_private *priv,
|
||||
* must be sent/received. Splitting the buffer into chunks and assembling
|
||||
* those into SPI messages is done automatically by this function.
|
||||
*/
|
||||
int sja1105_spi_send_long_packed_buf(const struct sja1105_private *priv,
|
||||
sja1105_spi_rw_mode_t rw, u64 base_addr,
|
||||
void *packed_buf, u64 buf_len)
|
||||
int sja1105_xfer_long_buf(const struct sja1105_private *priv,
|
||||
sja1105_spi_rw_mode_t rw, u64 base_addr,
|
||||
void *packed_buf, u64 buf_len)
|
||||
{
|
||||
struct chunk {
|
||||
void *buf_ptr;
|
||||
@@ -174,8 +174,8 @@ int sja1105_spi_send_long_packed_buf(const struct sja1105_private *priv,
|
||||
chunk.len = min_t(int, buf_len, SJA1105_SIZE_SPI_MSG_MAXLEN);
|
||||
|
||||
while (chunk.len) {
|
||||
rc = sja1105_spi_send_packed_buf(priv, rw, chunk.spi_address,
|
||||
chunk.buf_ptr, chunk.len);
|
||||
rc = sja1105_xfer_buf(priv, rw, chunk.spi_address,
|
||||
chunk.buf_ptr, chunk.len);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
@@ -257,8 +257,8 @@ static int sja1105et_reset_cmd(const void *ctx, const void *data)
|
||||
|
||||
sja1105et_reset_cmd_pack(packed_buf, reset);
|
||||
|
||||
return sja1105_spi_send_packed_buf(priv, SPI_WRITE, regs->rgu,
|
||||
packed_buf, SJA1105_SIZE_RESET_CMD);
|
||||
return sja1105_xfer_buf(priv, SPI_WRITE, regs->rgu, packed_buf,
|
||||
SJA1105_SIZE_RESET_CMD);
|
||||
}
|
||||
|
||||
static int sja1105pqrs_reset_cmd(const void *ctx, const void *data)
|
||||
@@ -287,8 +287,8 @@ static int sja1105pqrs_reset_cmd(const void *ctx, const void *data)
|
||||
|
||||
sja1105pqrs_reset_cmd_pack(packed_buf, reset);
|
||||
|
||||
return sja1105_spi_send_packed_buf(priv, SPI_WRITE, regs->rgu,
|
||||
packed_buf, SJA1105_SIZE_RESET_CMD);
|
||||
return sja1105_xfer_buf(priv, SPI_WRITE, regs->rgu, packed_buf,
|
||||
SJA1105_SIZE_RESET_CMD);
|
||||
}
|
||||
|
||||
static int sja1105_cold_reset(const struct sja1105_private *priv)
|
||||
@@ -355,9 +355,7 @@ static int sja1105_status_get(struct sja1105_private *priv,
|
||||
u8 packed_buf[4];
|
||||
int rc;
|
||||
|
||||
rc = sja1105_spi_send_packed_buf(priv, SPI_READ,
|
||||
regs->status,
|
||||
packed_buf, 4);
|
||||
rc = sja1105_xfer_buf(priv, SPI_READ, regs->status, packed_buf, 4);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
@@ -451,9 +449,8 @@ int sja1105_static_config_upload(struct sja1105_private *priv)
|
||||
/* Wait for the switch to come out of reset */
|
||||
usleep_range(1000, 5000);
|
||||
/* Upload the static config to the device */
|
||||
rc = sja1105_spi_send_long_packed_buf(priv, SPI_WRITE,
|
||||
regs->config,
|
||||
config_buf, buf_len);
|
||||
rc = sja1105_xfer_long_buf(priv, SPI_WRITE, regs->config,
|
||||
config_buf, buf_len);
|
||||
if (rc < 0) {
|
||||
dev_err(dev, "Failed to upload config, retrying...\n");
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user