diff options
author | Nicholas Mc Guire <hofrat@osadl.org> | 2015-02-08 10:11:05 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-02-10 21:14:25 -0500 |
commit | b3e7766bc459af941c311a3cb03f2082b2fe60ba (patch) | |
tree | 6fac9e3c33a7efd710239f4302874a86cf035aca /drivers/spi/spi-bcm53xx.c | |
parent | bfa76d49576599a4b9f9b7a71f23d73d6dcff735 (diff) |
spi: bcm53xx: use msecs_to_jiffies for conversion
Converting milliseconds to jiffies by "val * HZ / 1000" is technically
ok but msecs_to_jiffies(val) is the cleaner solution and handles all
corner cases correctly.
This is only an API consolidation and should make things more readable
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-bcm53xx.c')
-rw-r--r-- | drivers/spi/spi-bcm53xx.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/spi/spi-bcm53xx.c b/drivers/spi/spi-bcm53xx.c index 17b34cbadc03..1933ef332bbb 100644 --- a/drivers/spi/spi-bcm53xx.c +++ b/drivers/spi/spi-bcm53xx.c | |||
@@ -44,7 +44,7 @@ static int bcm53xxspi_wait(struct bcm53xxspi *b53spi, unsigned int timeout_ms) | |||
44 | u32 tmp; | 44 | u32 tmp; |
45 | 45 | ||
46 | /* SPE bit has to be 0 before we read MSPI STATUS */ | 46 | /* SPE bit has to be 0 before we read MSPI STATUS */ |
47 | deadline = jiffies + BCM53XXSPI_SPE_TIMEOUT_MS * HZ / 1000; | 47 | deadline = jiffies + msecs_to_jiffies(BCM53XXSPI_SPE_TIMEOUT_MS); |
48 | do { | 48 | do { |
49 | tmp = bcm53xxspi_read(b53spi, B53SPI_MSPI_SPCR2); | 49 | tmp = bcm53xxspi_read(b53spi, B53SPI_MSPI_SPCR2); |
50 | if (!(tmp & B53SPI_MSPI_SPCR2_SPE)) | 50 | if (!(tmp & B53SPI_MSPI_SPCR2_SPE)) |
@@ -56,7 +56,7 @@ static int bcm53xxspi_wait(struct bcm53xxspi *b53spi, unsigned int timeout_ms) | |||
56 | goto spi_timeout; | 56 | goto spi_timeout; |
57 | 57 | ||
58 | /* Check status */ | 58 | /* Check status */ |
59 | deadline = jiffies + timeout_ms * HZ / 1000; | 59 | deadline = jiffies + msecs_to_jiffies(timeout_ms); |
60 | do { | 60 | do { |
61 | tmp = bcm53xxspi_read(b53spi, B53SPI_MSPI_MSPI_STATUS); | 61 | tmp = bcm53xxspi_read(b53spi, B53SPI_MSPI_MSPI_STATUS); |
62 | if (tmp & B53SPI_MSPI_MSPI_STATUS_SPIF) { | 62 | if (tmp & B53SPI_MSPI_MSPI_STATUS_SPIF) { |