package/madwifi: refresh madwifi patches
[openwrt.git] / package / madwifi / patches / 470-mac_addresss_from_ath5k_platform_data.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -63,6 +63,8 @@
4  #include <linux/rtnetlink.h>
5  #include <linux/time.h>
6  #include <linux/pci.h>
7 +#include <linux/device.h>
8 +#include <linux/ath5k_platform.h>
9  #include <asm/uaccess.h>
10  
11  #include "if_ethersubr.h"              /* for ETHER_IS_MULTICAST */
12 @@ -587,6 +589,10 @@ ath_attach(u_int16_t devid, struct net_d
13         unsigned int i;
14         int autocreatemode = -1;
15         u_int8_t csz;
16 +#ifdef ATH_PCI
17 +       struct ath5k_platform_data *pdata;
18 +       struct pci_dev *pdev;
19 +#endif
20  
21         sc->devid = devid;
22  #ifdef AR_DEBUG
23 @@ -648,6 +654,13 @@ ath_attach(u_int16_t devid, struct net_d
24         }
25         sc->sc_ah = ah;
26  
27 +#ifdef ATH_PCI
28 +       /* set MAC from ath_platform_data */
29 +       pdev = (struct pci_dev *)sc->sc_bdev;
30 +       pdata = pdev->dev.platform_data;
31 +       if (pdata && pdata->macaddr)
32 +               ath_hal_setmac(ah, pdata->macaddr);
33 +#endif
34         /* WAR for AR7100 PCI bug */
35  #ifdef CONFIG_ATHEROS_AR71XX
36         if ((ar_device(sc->devid) >= 5210) && (ar_device(sc->devid) < 5416)) {