aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sunhme.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sunhme.c')
-rw-r--r--drivers/net/sunhme.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 9cc13dd8a821..25ce26a882d1 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -194,21 +194,21 @@ static u32 sbus_hme_read32(void __iomem *reg)
194 194
195static void sbus_hme_write_rxd(struct happy_meal_rxd *rxd, u32 flags, u32 addr) 195static void sbus_hme_write_rxd(struct happy_meal_rxd *rxd, u32 flags, u32 addr)
196{ 196{
197 rxd->rx_addr = addr; 197 rxd->rx_addr = (__force hme32)addr;
198 wmb(); 198 wmb();
199 rxd->rx_flags = flags; 199 rxd->rx_flags = (__force hme32)flags;
200} 200}
201 201
202static void sbus_hme_write_txd(struct happy_meal_txd *txd, u32 flags, u32 addr) 202static void sbus_hme_write_txd(struct happy_meal_txd *txd, u32 flags, u32 addr)
203{ 203{
204 txd->tx_addr = addr; 204 txd->tx_addr = (__force hme32)addr;
205 wmb(); 205 wmb();
206 txd->tx_flags = flags; 206 txd->tx_flags = (__force hme32)flags;
207} 207}
208 208
209static u32 sbus_hme_read_desc32(u32 *p) 209static u32 sbus_hme_read_desc32(hme32 *p)
210{ 210{
211 return *p; 211 return (__force u32)*p;
212} 212}
213 213
214static void pci_hme_write32(void __iomem *reg, u32 val) 214static void pci_hme_write32(void __iomem *reg, u32 val)
@@ -223,21 +223,21 @@ static u32 pci_hme_read32(void __iomem *reg)
223 223
224static void pci_hme_write_rxd(struct happy_meal_rxd *rxd, u32 flags, u32 addr) 224static void pci_hme_write_rxd(struct happy_meal_rxd *rxd, u32 flags, u32 addr)
225{ 225{
226 rxd->rx_addr = cpu_to_le32(addr); 226 rxd->rx_addr = (__force hme32)cpu_to_le32(addr);
227 wmb(); 227 wmb();
228 rxd->rx_flags = cpu_to_le32(flags); 228 rxd->rx_flags = (__force hme32)cpu_to_le32(flags);
229} 229}
230 230
231static void pci_hme_write_txd(struct happy_meal_txd *txd, u32 flags, u32 addr) 231static void pci_hme_write_txd(struct happy_meal_txd *txd, u32 flags, u32 addr)
232{ 232{
233 txd->tx_addr = cpu_to_le32(addr); 233 txd->tx_addr = (__force hme32)cpu_to_le32(addr);
234 wmb(); 234 wmb();
235 txd->tx_flags = cpu_to_le32(flags); 235 txd->tx_flags = (__force hme32)cpu_to_le32(flags);
236} 236}
237 237
238static u32 pci_hme_read_desc32(u32 *p) 238static u32 pci_hme_read_desc32(hme32 *p)
239{ 239{
240 return cpu_to_le32p(p); 240 return le32_to_cpup((__le32 *)p);
241} 241}
242 242
243#define hme_write32(__hp, __reg, __val) \ 243#define hme_write32(__hp, __reg, __val) \
@@ -266,16 +266,16 @@ static u32 pci_hme_read_desc32(u32 *p)
266#define hme_read32(__hp, __reg) \ 266#define hme_read32(__hp, __reg) \
267 sbus_readl(__reg) 267 sbus_readl(__reg)
268#define hme_write_rxd(__hp, __rxd, __flags, __addr) \ 268#define hme_write_rxd(__hp, __rxd, __flags, __addr) \
269do { (__rxd)->rx_addr = (__addr); \ 269do { (__rxd)->rx_addr = (__force hme32)(u32)(__addr); \
270 wmb(); \ 270 wmb(); \
271 (__rxd)->rx_flags = (__flags); \ 271 (__rxd)->rx_flags = (__force hme32)(u32)(__flags); \
272} while(0) 272} while(0)
273#define hme_write_txd(__hp, __txd, __flags, __addr) \ 273#define hme_write_txd(__hp, __txd, __flags, __addr) \
274do { (__txd)->tx_addr = (__addr); \ 274do { (__txd)->tx_addr = (__force hme32)(u32)(__addr); \
275 wmb(); \ 275 wmb(); \
276 (__txd)->tx_flags = (__flags); \ 276 (__txd)->tx_flags = (__force hme32)(u32)(__flags); \
277} while(0) 277} while(0)
278#define hme_read_desc32(__hp, __p) (*(__p)) 278#define hme_read_desc32(__hp, __p) ((__force u32)(hme32)*(__p))
279#define hme_dma_map(__hp, __ptr, __size, __dir) \ 279#define hme_dma_map(__hp, __ptr, __size, __dir) \
280 sbus_map_single((__hp)->happy_dev, (__ptr), (__size), (__dir)) 280 sbus_map_single((__hp)->happy_dev, (__ptr), (__size), (__dir))
281#define hme_dma_unmap(__hp, __addr, __size, __dir) \ 281#define hme_dma_unmap(__hp, __addr, __size, __dir) \
@@ -291,16 +291,19 @@ do { (__txd)->tx_addr = (__addr); \
291#define hme_read32(__hp, __reg) \ 291#define hme_read32(__hp, __reg) \
292 readl(__reg) 292 readl(__reg)
293#define hme_write_rxd(__hp, __rxd, __flags, __addr) \ 293#define hme_write_rxd(__hp, __rxd, __flags, __addr) \
294do { (__rxd)->rx_addr = cpu_to_le32(__addr); \ 294do { (__rxd)->rx_addr = (__force hme32)cpu_to_le32(__addr); \
295 wmb(); \ 295 wmb(); \
296 (__rxd)->rx_flags = cpu_to_le32(__flags); \ 296 (__rxd)->rx_flags = (__force hme32)cpu_to_le32(__flags); \
297} while(0) 297} while(0)
298#define hme_write_txd(__hp, __txd, __flags, __addr) \ 298#define hme_write_txd(__hp, __txd, __flags, __addr) \
299do { (__txd)->tx_addr = cpu_to_le32(__addr); \ 299do { (__txd)->tx_addr = (__force hme32)cpu_to_le32(__addr); \
300 wmb(); \ 300 wmb(); \
301 (__txd)->tx_flags = cpu_to_le32(__flags); \ 301 (__txd)->tx_flags = (__force hme32)cpu_to_le32(__flags); \
302} while(0) 302} while(0)
303#define hme_read_desc32(__hp, __p) cpu_to_le32p(__p) 303static inline u32 hme_read_desc32(struct happy_meal *hp, hme32 *p)
304{
305 return le32_to_cpup((__le32 *)p);
306}
304#define hme_dma_map(__hp, __ptr, __size, __dir) \ 307#define hme_dma_map(__hp, __ptr, __size, __dir) \
305 pci_map_single((__hp)->happy_dev, (__ptr), (__size), (__dir)) 308 pci_map_single((__hp)->happy_dev, (__ptr), (__size), (__dir))
306#define hme_dma_unmap(__hp, __addr, __size, __dir) \ 309#define hme_dma_unmap(__hp, __addr, __size, __dir) \
@@ -2075,7 +2078,7 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev)
2075 } 2078 }
2076 2079
2077 /* This card is _fucking_ hot... */ 2080 /* This card is _fucking_ hot... */
2078 skb->csum = ntohs(csum ^ 0xffff); 2081 skb->csum = csum_unfold(~(__force __sum16)htons(csum));
2079 skb->ip_summed = CHECKSUM_COMPLETE; 2082 skb->ip_summed = CHECKSUM_COMPLETE;
2080 2083
2081 RXD(("len=%d csum=%4x]", len, csum)); 2084 RXD(("len=%d csum=%4x]", len, csum));