Skip to content

Commit bc1abb9

Browse files
committed
dmascc: use proper 'virt_to_bus()' rather than casting to 'int'
The old dmascc driver depends on the legacy ISA_DMA_API, and blindly just casts the kernel virtual address to 'int' for set_dma_addr(). That works only incidentally, and because the high bits of the address will be ignored anyway. And on 64-bit architectures it causes warnings. Admittedly, 64-bit architectures with ISA are basically dead - I think the only example of this is alpha, and nobody would ever use the dmascc driver there. But hey, the fix is easy enough, the end result is cleaner, and it's yet another configuration that now builds without warnings. If somebody actually uses this driver on an alpha and this fixes it for you, please email me. Because that is just incredibly bizarre. Signed-off-by: Linus Torvalds <[email protected]>
1 parent 4fef611 commit bc1abb9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/net/hamradio/dmascc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ static inline void tx_on(struct scc_priv *priv)
973973
flags = claim_dma_lock();
974974
set_dma_mode(priv->param.dma, DMA_MODE_WRITE);
975975
set_dma_addr(priv->param.dma,
976-
(int) priv->tx_buf[priv->tx_tail] + n);
976+
virt_to_bus(priv->tx_buf[priv->tx_tail]) + n);
977977
set_dma_count(priv->param.dma,
978978
priv->tx_len[priv->tx_tail] - n);
979979
release_dma_lock(flags);
@@ -1020,7 +1020,7 @@ static inline void rx_on(struct scc_priv *priv)
10201020
flags = claim_dma_lock();
10211021
set_dma_mode(priv->param.dma, DMA_MODE_READ);
10221022
set_dma_addr(priv->param.dma,
1023-
(int) priv->rx_buf[priv->rx_head]);
1023+
virt_to_bus(priv->rx_buf[priv->rx_head]));
10241024
set_dma_count(priv->param.dma, BUF_SIZE);
10251025
release_dma_lock(flags);
10261026
enable_dma(priv->param.dma);
@@ -1233,7 +1233,7 @@ static void special_condition(struct scc_priv *priv, int rc)
12331233
if (priv->param.dma >= 0) {
12341234
flags = claim_dma_lock();
12351235
set_dma_addr(priv->param.dma,
1236-
(int) priv->rx_buf[priv->rx_head]);
1236+
virt_to_bus(priv->rx_buf[priv->rx_head]));
12371237
set_dma_count(priv->param.dma, BUF_SIZE);
12381238
release_dma_lock(flags);
12391239
} else {

0 commit comments

Comments
 (0)