Skip to contentSkip to conversation

ath9k: fix build errors and warnings on 64-bit systems

PATCH New Luis Rodriguez 3 participants 5 messages Jul 21, 2008 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 ath9k: fix build errors and warnings on 64-bit systems

Thanks, I split this into two patches. I've updated the patch series for wireless-testing as well:

http://www.kernel.org/pub/linux/kernel/people/mcgrof/patches/ath9k/

Luis
________________________________________
From: Pavel Roskin [proski at gnu.org]
Sent: Monday, July 21, 2008 5:33 AM
To: ath9k-devel at lists.ath9k.org; Luis Rodriguez
Subject: [PATCH] ath9k: fix build errors and warnings on 64-bit systems

Use skb_end_pointer(skb), not skb->end. The later is not portable. Avoid comparison of incompatible types.

---

 ksrc/hw.c   |    6 ++++--
 ksrc/recv.c |    5 +++--
 2 files changed, 7 insertions(+), 4 deletions(-)
ksrc/hw.c +4 -2
index b8a9321..5a24cbe 100644
@@ -852,9 +852,11 @@ static inline enum hal_status ath9k_hw_check_eeprom(struct ath_hal *ah)
        else
                el = ahp->ah_eeprom.baseEepHeader.length;
 
+       if (el < sizeof(struct ar5416_eeprom) / sizeof(u_int16_t))
+               el = sizeof(struct ar5416_eeprom) / sizeof(u_int16_t);
+
        eepdata = (u_int16_t *) (&ahp->ah_eeprom);
-       for (i = 0; i <
-               min(el, sizeof(struct ar5416_eeprom)) / sizeof(u_int16_t); i++)
+       for (i = 0; i < el; i++)
                sum ^= *eepdata++;
 
        if (need_swap) {
ksrc/recv.c +3 -2
index a48c9e9..e111e9d 100644
@@ -1380,7 +1380,7 @@ dma_addr_t ath_skb_map_single(struct ath_softc *sc,
         * Use skb's entire data area instead.
         */
        *pa = pci_map_single(sc->pdev, skb->data,
-               skb->end - skb->head, direction);
+               skb_end_pointer(skb) - skb->head, direction);
        return *pa;
 }
 
@@ -1390,5 +1390,6 @@ void ath_skb_unmap_single(struct ath_softc *sc,
                          dma_addr_t *pa)
 {
        /* Unmap skb's entire data area */
-       pci_unmap_single(sc->pdev, *pa, skb->end - skb->head, direction);
+       pci_unmap_single(sc->pdev, *pa,
+                        skb_end_pointer(skb) - skb->head, direction);
 }
#2 lore raw

PATCH 1/1 ath9k: fix build errors and warnings on 64-bit systems

Quoted 8 lines
ksrc/hw.c +0 -0
index b8a9321..5a24cbe 100644
@@ -852,9 +852,11 @@ static inline enum hal_status ath9k_hw_check_eeprom(struct ath_hal *ah)
       else
               el = ahp->ah_eeprom.baseEepHeader.length;
 

ksrc/hw.c static inline enum hal_status ath9k_hw_check_eeprom(struct ath_hal *ah) · line 862

Quoted 10 lines
ksrc/hw.c +4 -2
+       if (el < sizeof(struct ar5416_eeprom) / sizeof(u_int16_t))
+               el = sizeof(struct ar5416_eeprom) / sizeof(u_int16_t);
+
       eepdata = (u_int16_t *) (&ahp->ah_eeprom);
-       for (i = 0; i <
-               min(el, sizeof(struct ar5416_eeprom)) / sizeof(u_int16_t); i++)
+       for (i = 0; i < el; i++)
               sum ^= *eepdata++;
 
       if (need_swap) {

Its a good thing indeed I split this into two patches, as your first hunk breaks the check. Had you tested this??? Anyway I've fixed this now.

Luis

#3 lore raw

PATCH 1/1 ath9k: fix build errors and warnings on 64-bit systems

Quoted 17 lines · Luis R. Rodriguez
Quoted 17 lines
ksrc/hw.c +4 -2
index b8a9321..5a24cbe 100644
@@ -852,9 +852,11 @@ static inline enum hal_status ath9k_hw_check_eeprom(struct ath_hal *ah)
       else
               el = ahp->ah_eeprom.baseEepHeader.length;
 
+       if (el < sizeof(struct ar5416_eeprom) / sizeof(u_int16_t))
+               el = sizeof(struct ar5416_eeprom) / sizeof(u_int16_t);
+
       eepdata = (u_int16_t *) (&ahp->ah_eeprom);
-       for (i = 0; i <
-               min(el, sizeof(struct ar5416_eeprom)) / sizeof(u_int16_t); i++)
+       for (i = 0; i < el; i++)
               sum ^= *eepdata++;
 
Quoted 5 lines

ksrc/hw.c static inline enum hal_status ath9k_hw_check_eeprom(struct ath_hal *ah) · line 862

Quoted 1 line
ksrc/hw.c +0 -0
       if (need_swap) {

Its a good thing indeed I split this into two patches, as your first hunk breaks the check. Had you tested this??? Anyway I've fixed this now.

Sorry, I only compile tested it. Indeed, the first comparison should be inverted, or we get maximum, not minimum. I didn't want to change the code so much, but I wanted to avoid breaking the 80 character limit with casts.

Signature · 2 lines
Regards,
Pavel Roskin
#4 lore raw

PATCH 1/1 ath9k: fix build errors and warnings on 64-bit systems

Quoted 24 lines · Pavel Roskin
Quoted 17 lines · Luis R. Rodriguez
Quoted 17 lines
ksrc/hw.c +4 -2
index b8a9321..5a24cbe 100644
@@ -852,9 +852,11 @@ static inline enum hal_status ath9k_hw_check_eeprom(struct ath_hal *ah)
       else
               el = ahp->ah_eeprom.baseEepHeader.length;
 
+       if (el < sizeof(struct ar5416_eeprom) / sizeof(u_int16_t))
+               el = sizeof(struct ar5416_eeprom) / sizeof(u_int16_t);
+
       eepdata = (u_int16_t *) (&ahp->ah_eeprom);
-       for (i = 0; i <
-               min(el, sizeof(struct ar5416_eeprom)) / sizeof(u_int16_t); i++)
+       for (i = 0; i < el; i++)
               sum ^= *eepdata++;
 
Quoted 5 lines

ksrc/hw.c static inline enum hal_status ath9k_hw_check_eeprom(struct ath_hal *ah) · line 862

Quoted 1 line
ksrc/hw.c +0 -0
       if (need_swap) {

Its a good thing indeed I split this into two patches, as your first hunk breaks the check. Had you tested this??? Anyway I've fixed this now.

Quoted 4 lines

Sorry, I only compile tested it. Indeed, the first comparison should be inverted, or we get maximum, not minimum. I didn't want to change the code so much, but I wanted to avoid breaking the 80 character limit with casts.

We'll need to get you hardware then :)

Luis

#5 lore raw

PATCH 1/1 ath9k: fix build errors and warnings on 64-bit systems

Quoting "Luis R. Rodriguez" <[email protected]>:

Quoted 1 line

We'll need to get you hardware then :)

I have D-Link DWA-645, which has AR5008 chipset. The only problem with my Cardbus cards is that they are usually not inserted, and I'm usually on the wrong side of ssh :-)

Signature · 2 lines
Regards,
Pavel Roskin