Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 122603
b: refs/heads/master
c: 23d30f0
h: refs/heads/master
i:
  122601: 1da2e82
  122599: f0fd62b
v: v3
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Dec 13, 2008
1 parent d289982 commit fd03bbd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a17102b1ba847ca31d9151b877fbf9a38a39a8bb
refs/heads/master: 23d30f027d1e8ad3bcd6192613122ce925947563
19 changes: 10 additions & 9 deletions trunk/drivers/net/sfc/falcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ void falcon_fini_interrupt(struct efx_nic *efx)
**************************************************************************
*/

#define FALCON_SPI_MAX_LEN ((unsigned) sizeof(efx_oword_t))
#define FALCON_SPI_MAX_LEN sizeof(efx_oword_t)

/* Wait for SPI command completion */
static int falcon_spi_wait(struct efx_nic *efx)
Expand All @@ -1630,7 +1630,7 @@ static int falcon_spi_wait(struct efx_nic *efx)

int falcon_spi_cmd(const struct efx_spi_device *spi,
unsigned int command, int address,
const void *in, void *out, unsigned int len)
const void *in, void *out, size_t len)
{
struct efx_nic *efx = spi->efx;
bool addressed = (address >= 0);
Expand Down Expand Up @@ -1686,8 +1686,8 @@ int falcon_spi_cmd(const struct efx_spi_device *spi,
return 0;
}

static unsigned int
falcon_spi_write_limit(const struct efx_spi_device *spi, unsigned int start)
static size_t
falcon_spi_write_limit(const struct efx_spi_device *spi, size_t start)
{
return min(FALCON_SPI_MAX_LEN,
(spi->block_size - (start & (spi->block_size - 1))));
Expand Down Expand Up @@ -1725,12 +1725,12 @@ int falcon_spi_fast_wait(const struct efx_spi_device *spi)
int falcon_spi_read(const struct efx_spi_device *spi, loff_t start,
size_t len, size_t *retlen, u8 *buffer)
{
unsigned int command, block_len, pos = 0;
size_t block_len, pos = 0;
unsigned int command;
int rc = 0;

while (pos < len) {
block_len = min((unsigned int)len - pos,
FALCON_SPI_MAX_LEN);
block_len = min(len - pos, FALCON_SPI_MAX_LEN);

command = efx_spi_munge_command(spi, SPI_READ, start + pos);
rc = falcon_spi_cmd(spi, command, start + pos, NULL,
Expand All @@ -1756,15 +1756,16 @@ int falcon_spi_write(const struct efx_spi_device *spi, loff_t start,
size_t len, size_t *retlen, const u8 *buffer)
{
u8 verify_buffer[FALCON_SPI_MAX_LEN];
unsigned int command, block_len, pos = 0;
size_t block_len, pos = 0;
unsigned int command;
int rc = 0;

while (pos < len) {
rc = falcon_spi_cmd(spi, SPI_WREN, -1, NULL, NULL, 0);
if (rc)
break;

block_len = min((unsigned int)len - pos,
block_len = min(len - pos,
falcon_spi_write_limit(spi, start + pos));
command = efx_spi_munge_command(spi, SPI_WRITE, start + pos);
rc = falcon_spi_cmd(spi, command, start + pos,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/sfc/spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct efx_spi_device {
};

int falcon_spi_cmd(const struct efx_spi_device *spi, unsigned int command,
int address, const void* in, void *out, unsigned int len);
int address, const void* in, void *out, size_t len);
int falcon_spi_fast_wait(const struct efx_spi_device *spi);
int falcon_spi_read(const struct efx_spi_device *spi, loff_t start,
size_t len, size_t *retlen, u8 *buffer);
Expand Down

0 comments on commit fd03bbd

Please sign in to comment.