diff options
author | Franky Lin <frankyl@broadcom.com> | 2011-12-16 21:37:09 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-12-19 14:40:46 -0500 |
commit | 712ac5b37a3348cac4e040c551a6ca6186d33682 (patch) | |
tree | 0aa61830dd8f12fd130073bc41fff09e30a19152 /drivers/net/wireless/brcm80211/brcmfmac | |
parent | c8bf34849f92c5894a3d7e12573d3789d7851f23 (diff) |
brcm80211: fmac: stop referencing brcmf_pub in bus layer
brcmf_pub is the data structure for common layer. Since brcmf_bus
should be the only structure shared by common layer and bus layer,
stop referencing brcmf_pub from bus layer. This patch is part of
the fullmac bus interface refactoring.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac')
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/dhd.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | 15 | ||||
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 43 |
3 files changed, 29 insertions, 33 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h index 980bf70d89fd..dcb1bb550f48 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h | |||
@@ -669,8 +669,8 @@ extern uint brcmf_c_mkiovar(char *name, char *data, uint datalen, | |||
669 | * Returned structure should have bus and prot pointers filled in. | 669 | * Returned structure should have bus and prot pointers filled in. |
670 | * bus_hdrlen specifies required headroom for bus module header. | 670 | * bus_hdrlen specifies required headroom for bus module header. |
671 | */ | 671 | */ |
672 | extern struct brcmf_pub *brcmf_attach(struct brcmf_sdio *bus, | 672 | extern int brcmf_attach(struct brcmf_sdio *bus, |
673 | uint bus_hdrlen, struct device *dev); | 673 | uint bus_hdrlen, struct device *dev); |
674 | extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx); | 674 | extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx); |
675 | extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev); | 675 | extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev); |
676 | 676 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 130cab1e2a24..533418e11c7f 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | |||
@@ -922,17 +922,18 @@ void brcmf_del_if(struct brcmf_pub *drvr, int ifidx) | |||
922 | } | 922 | } |
923 | } | 923 | } |
924 | 924 | ||
925 | struct brcmf_pub *brcmf_attach(struct brcmf_sdio *bus, uint bus_hdrlen, | 925 | int brcmf_attach(struct brcmf_sdio *bus, uint bus_hdrlen, |
926 | struct device *dev) | 926 | struct device *dev) |
927 | { | 927 | { |
928 | struct brcmf_pub *drvr = NULL; | 928 | struct brcmf_pub *drvr = NULL; |
929 | int ret = 0; | ||
929 | 930 | ||
930 | brcmf_dbg(TRACE, "Enter\n"); | 931 | brcmf_dbg(TRACE, "Enter\n"); |
931 | 932 | ||
932 | /* Allocate primary brcmf_info */ | 933 | /* Allocate primary brcmf_info */ |
933 | drvr = kzalloc(sizeof(struct brcmf_pub), GFP_ATOMIC); | 934 | drvr = kzalloc(sizeof(struct brcmf_pub), GFP_ATOMIC); |
934 | if (!drvr) | 935 | if (!drvr) |
935 | goto fail; | 936 | return -ENOMEM; |
936 | 937 | ||
937 | mutex_init(&drvr->proto_block); | 938 | mutex_init(&drvr->proto_block); |
938 | 939 | ||
@@ -944,7 +945,8 @@ struct brcmf_pub *brcmf_attach(struct brcmf_sdio *bus, uint bus_hdrlen, | |||
944 | drvr->dev = dev; | 945 | drvr->dev = dev; |
945 | 946 | ||
946 | /* Attach and link in the protocol */ | 947 | /* Attach and link in the protocol */ |
947 | if (brcmf_proto_attach(drvr) != 0) { | 948 | ret = brcmf_proto_attach(drvr); |
949 | if (ret != 0) { | ||
948 | brcmf_dbg(ERROR, "brcmf_prot_attach failed\n"); | 950 | brcmf_dbg(ERROR, "brcmf_prot_attach failed\n"); |
949 | goto fail; | 951 | goto fail; |
950 | } | 952 | } |
@@ -952,13 +954,12 @@ struct brcmf_pub *brcmf_attach(struct brcmf_sdio *bus, uint bus_hdrlen, | |||
952 | INIT_WORK(&drvr->setmacaddr_work, _brcmf_set_mac_address); | 954 | INIT_WORK(&drvr->setmacaddr_work, _brcmf_set_mac_address); |
953 | INIT_WORK(&drvr->multicast_work, _brcmf_set_multicast_list); | 955 | INIT_WORK(&drvr->multicast_work, _brcmf_set_multicast_list); |
954 | 956 | ||
955 | return drvr; | 957 | return ret; |
956 | 958 | ||
957 | fail: | 959 | fail: |
958 | if (drvr) | 960 | brcmf_detach(dev); |
959 | brcmf_detach(dev); | ||
960 | 961 | ||
961 | return NULL; | 962 | return ret; |
962 | } | 963 | } |
963 | 964 | ||
964 | int brcmf_bus_start(struct device *dev) | 965 | int brcmf_bus_start(struct device *dev) |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index a7fe00fc6843..399567f7b6a6 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -450,8 +450,6 @@ struct sdpcm_shared_le { | |||
450 | /* misc chip info needed by some of the routines */ | 450 | /* misc chip info needed by some of the routines */ |
451 | /* Private data for SDIO bus interaction */ | 451 | /* Private data for SDIO bus interaction */ |
452 | struct brcmf_sdio { | 452 | struct brcmf_sdio { |
453 | struct brcmf_pub *drvr; | ||
454 | |||
455 | struct brcmf_sdio_dev *sdiodev; /* sdio device handler */ | 453 | struct brcmf_sdio_dev *sdiodev; /* sdio device handler */ |
456 | struct chip_info *ci; /* Chip info struct */ | 454 | struct chip_info *ci; /* Chip info struct */ |
457 | char *vars; /* Variables (from CIS and/or other) */ | 455 | char *vars; /* Variables (from CIS and/or other) */ |
@@ -1077,7 +1075,7 @@ static void brcmf_sdbrcm_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx) | |||
1077 | 1075 | ||
1078 | /* If we can't reach the device, signal failure */ | 1076 | /* If we can't reach the device, signal failure */ |
1079 | if (err || brcmf_sdcard_regfail(bus->sdiodev)) | 1077 | if (err || brcmf_sdcard_regfail(bus->sdiodev)) |
1080 | bus->drvr->bus_if->state = BRCMF_BUS_DOWN; | 1078 | bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; |
1081 | } | 1079 | } |
1082 | 1080 | ||
1083 | /* copy a buffer into a pkt buffer chain */ | 1081 | /* copy a buffer into a pkt buffer chain */ |
@@ -1724,7 +1722,7 @@ brcmf_sdbrcm_readframes(struct brcmf_sdio *bus, uint maxframes, bool *finished) | |||
1724 | 1722 | ||
1725 | for (rxseq = bus->rx_seq, rxleft = maxframes; | 1723 | for (rxseq = bus->rx_seq, rxleft = maxframes; |
1726 | !bus->rxskip && rxleft && | 1724 | !bus->rxskip && rxleft && |
1727 | bus->drvr->bus_if->state != BRCMF_BUS_DOWN; | 1725 | bus->sdiodev->bus_if->state != BRCMF_BUS_DOWN; |
1728 | rxseq++, rxleft--) { | 1726 | rxseq++, rxleft--) { |
1729 | 1727 | ||
1730 | /* Handle glomming separately */ | 1728 | /* Handle glomming separately */ |
@@ -2259,8 +2257,6 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes) | |||
2259 | uint datalen; | 2257 | uint datalen; |
2260 | u8 tx_prec_map; | 2258 | u8 tx_prec_map; |
2261 | 2259 | ||
2262 | struct brcmf_pub *drvr = bus->drvr; | ||
2263 | |||
2264 | brcmf_dbg(TRACE, "Enter\n"); | 2260 | brcmf_dbg(TRACE, "Enter\n"); |
2265 | 2261 | ||
2266 | tx_prec_map = ~bus->flowcontrol; | 2262 | tx_prec_map = ~bus->flowcontrol; |
@@ -2297,8 +2293,8 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_sdio *bus, uint maxframes) | |||
2297 | } | 2293 | } |
2298 | 2294 | ||
2299 | /* Deflow-control stack if needed */ | 2295 | /* Deflow-control stack if needed */ |
2300 | if (drvr->bus_if->drvr_up && | 2296 | if (bus->sdiodev->bus_if->drvr_up && |
2301 | (drvr->bus_if->state == BRCMF_BUS_DATA) && | 2297 | (bus->sdiodev->bus_if->state == BRCMF_BUS_DATA) && |
2302 | bus->txoff && (pktq_len(&bus->txq) < TXLOW)) { | 2298 | bus->txoff && (pktq_len(&bus->txq) < TXLOW)) { |
2303 | bus->txoff = OFF; | 2299 | bus->txoff = OFF; |
2304 | brcmf_txflowcontrol(bus->sdiodev->dev, 0, OFF); | 2300 | brcmf_txflowcontrol(bus->sdiodev->dev, 0, OFF); |
@@ -2335,7 +2331,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) | |||
2335 | SBSDIO_DEVICE_CTL, &err); | 2331 | SBSDIO_DEVICE_CTL, &err); |
2336 | if (err) { | 2332 | if (err) { |
2337 | brcmf_dbg(ERROR, "error reading DEVCTL: %d\n", err); | 2333 | brcmf_dbg(ERROR, "error reading DEVCTL: %d\n", err); |
2338 | bus->drvr->bus_if->state = BRCMF_BUS_DOWN; | 2334 | bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; |
2339 | } | 2335 | } |
2340 | #endif /* BCMDBG */ | 2336 | #endif /* BCMDBG */ |
2341 | 2337 | ||
@@ -2345,7 +2341,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) | |||
2345 | if (err) { | 2341 | if (err) { |
2346 | brcmf_dbg(ERROR, "error reading CSR: %d\n", | 2342 | brcmf_dbg(ERROR, "error reading CSR: %d\n", |
2347 | err); | 2343 | err); |
2348 | bus->drvr->bus_if->state = BRCMF_BUS_DOWN; | 2344 | bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; |
2349 | } | 2345 | } |
2350 | 2346 | ||
2351 | brcmf_dbg(INFO, "DPC: PENDING, devctl 0x%02x clkctl 0x%02x\n", | 2347 | brcmf_dbg(INFO, "DPC: PENDING, devctl 0x%02x clkctl 0x%02x\n", |
@@ -2358,7 +2354,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) | |||
2358 | if (err) { | 2354 | if (err) { |
2359 | brcmf_dbg(ERROR, "error reading DEVCTL: %d\n", | 2355 | brcmf_dbg(ERROR, "error reading DEVCTL: %d\n", |
2360 | err); | 2356 | err); |
2361 | bus->drvr->bus_if->state = BRCMF_BUS_DOWN; | 2357 | bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; |
2362 | } | 2358 | } |
2363 | devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; | 2359 | devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; |
2364 | brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, | 2360 | brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1, |
@@ -2366,7 +2362,7 @@ static bool brcmf_sdbrcm_dpc(struct brcmf_sdio *bus) | |||
2366 | if (err) { | 2362 | if (err) { |
2367 | brcmf_dbg(ERROR, "error writing DEVCTL: %d\n", | 2363 | brcmf_dbg(ERROR, "error writing DEVCTL: %d\n", |
2368 | err); | 2364 | err); |
2369 | bus->drvr->bus_if->state = BRCMF_BUS_DOWN; | 2365 | bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; |
2370 | } | 2366 | } |
2371 | bus->clkstate = CLK_AVAIL; | 2367 | bus->clkstate = CLK_AVAIL; |
2372 | } else { | 2368 | } else { |
@@ -2522,11 +2518,11 @@ clkwait: | |||
2522 | else await next interrupt */ | 2518 | else await next interrupt */ |
2523 | /* On failed register access, all bets are off: | 2519 | /* On failed register access, all bets are off: |
2524 | no resched or interrupts */ | 2520 | no resched or interrupts */ |
2525 | if ((bus->drvr->bus_if->state == BRCMF_BUS_DOWN) || | 2521 | if ((bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) || |
2526 | brcmf_sdcard_regfail(bus->sdiodev)) { | 2522 | brcmf_sdcard_regfail(bus->sdiodev)) { |
2527 | brcmf_dbg(ERROR, "failed backplane access over SDIO, halting operation %d\n", | 2523 | brcmf_dbg(ERROR, "failed backplane access over SDIO, halting operation %d\n", |
2528 | brcmf_sdcard_regfail(bus->sdiodev)); | 2524 | brcmf_sdcard_regfail(bus->sdiodev)); |
2529 | bus->drvr->bus_if->state = BRCMF_BUS_DOWN; | 2525 | bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; |
2530 | bus->intstatus = 0; | 2526 | bus->intstatus = 0; |
2531 | } else if (bus->clkstate == CLK_PENDING) { | 2527 | } else if (bus->clkstate == CLK_PENDING) { |
2532 | brcmf_dbg(INFO, "rescheduled due to CLK_PENDING awaiting I_CHIPACTIVE interrupt\n"); | 2528 | brcmf_dbg(INFO, "rescheduled due to CLK_PENDING awaiting I_CHIPACTIVE interrupt\n"); |
@@ -2563,7 +2559,7 @@ static int brcmf_sdbrcm_dpc_thread(void *data) | |||
2563 | if (!wait_for_completion_interruptible(&bus->dpc_wait)) { | 2559 | if (!wait_for_completion_interruptible(&bus->dpc_wait)) { |
2564 | /* Call bus dpc unless it indicated down | 2560 | /* Call bus dpc unless it indicated down |
2565 | (then clean stop) */ | 2561 | (then clean stop) */ |
2566 | if (bus->drvr->bus_if->state != BRCMF_BUS_DOWN) { | 2562 | if (bus->sdiodev->bus_if->state != BRCMF_BUS_DOWN) { |
2567 | if (brcmf_sdbrcm_dpc(bus)) | 2563 | if (brcmf_sdbrcm_dpc(bus)) |
2568 | complete(&bus->dpc_wait); | 2564 | complete(&bus->dpc_wait); |
2569 | } else { | 2565 | } else { |
@@ -3137,7 +3133,7 @@ static int brcmf_sdbrcm_download_state(struct brcmf_sdio *bus, bool enter) | |||
3137 | /* Allow HT Clock now that the ARM is running. */ | 3133 | /* Allow HT Clock now that the ARM is running. */ |
3138 | bus->alp_only = false; | 3134 | bus->alp_only = false; |
3139 | 3135 | ||
3140 | bus->drvr->bus_if->state = BRCMF_BUS_LOAD; | 3136 | bus->sdiodev->bus_if->state = BRCMF_BUS_LOAD; |
3141 | } | 3137 | } |
3142 | fail: | 3138 | fail: |
3143 | return bcmerror; | 3139 | return bcmerror; |
@@ -3383,7 +3379,7 @@ void brcmf_sdbrcm_bus_stop(struct device *dev) | |||
3383 | bus->hostintmask = 0; | 3379 | bus->hostintmask = 0; |
3384 | 3380 | ||
3385 | /* Change our idea of bus state */ | 3381 | /* Change our idea of bus state */ |
3386 | bus->drvr->bus_if->state = BRCMF_BUS_DOWN; | 3382 | bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; |
3387 | 3383 | ||
3388 | /* Force clocks on backplane to be sure F2 interrupt propagates */ | 3384 | /* Force clocks on backplane to be sure F2 interrupt propagates */ |
3389 | saveclk = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1, | 3385 | saveclk = brcmf_sdcard_cfg_read(bus->sdiodev, SDIO_FUNC_1, |
@@ -3446,7 +3442,7 @@ int brcmf_sdbrcm_bus_init(struct device *dev) | |||
3446 | return -1; | 3442 | return -1; |
3447 | } | 3443 | } |
3448 | 3444 | ||
3449 | if (!bus->drvr) | 3445 | if (!bus->sdiodev->bus_if->drvr) |
3450 | return 0; | 3446 | return 0; |
3451 | 3447 | ||
3452 | /* Start the watchdog timer */ | 3448 | /* Start the watchdog timer */ |
@@ -3542,7 +3538,7 @@ void brcmf_sdbrcm_isr(void *arg) | |||
3542 | return; | 3538 | return; |
3543 | } | 3539 | } |
3544 | 3540 | ||
3545 | if (bus->drvr->bus_if->state == BRCMF_BUS_DOWN) { | 3541 | if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) { |
3546 | brcmf_dbg(ERROR, "bus is down. we have nothing to do\n"); | 3542 | brcmf_dbg(ERROR, "bus is down. we have nothing to do\n"); |
3547 | return; | 3543 | return; |
3548 | } | 3544 | } |
@@ -3798,7 +3794,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_sdio *bus) | |||
3798 | brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0, SDIO_CCCR_IOEx, | 3794 | brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0, SDIO_CCCR_IOEx, |
3799 | SDIO_FUNC_ENABLE_1, NULL); | 3795 | SDIO_FUNC_ENABLE_1, NULL); |
3800 | 3796 | ||
3801 | bus->drvr->bus_if->state = BRCMF_BUS_DOWN; | 3797 | bus->sdiodev->bus_if->state = BRCMF_BUS_DOWN; |
3802 | bus->sleeping = false; | 3798 | bus->sleeping = false; |
3803 | bus->rxflow = false; | 3799 | bus->rxflow = false; |
3804 | 3800 | ||
@@ -3884,7 +3880,6 @@ static void brcmf_sdbrcm_release(struct brcmf_sdio *bus) | |||
3884 | if (bus->sdiodev->bus_if->drvr) { | 3880 | if (bus->sdiodev->bus_if->drvr) { |
3885 | brcmf_detach(bus->sdiodev->dev); | 3881 | brcmf_detach(bus->sdiodev->dev); |
3886 | brcmf_sdbrcm_release_dongle(bus); | 3882 | brcmf_sdbrcm_release_dongle(bus); |
3887 | bus->drvr = NULL; | ||
3888 | } | 3883 | } |
3889 | 3884 | ||
3890 | brcmf_sdbrcm_release_malloc(bus); | 3885 | brcmf_sdbrcm_release_malloc(bus); |
@@ -3958,8 +3953,8 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) | |||
3958 | } | 3953 | } |
3959 | 3954 | ||
3960 | /* Attach to the brcmf/OS/network interface */ | 3955 | /* Attach to the brcmf/OS/network interface */ |
3961 | bus->drvr = brcmf_attach(bus, SDPCM_RESERVE, bus->sdiodev->dev); | 3956 | ret = brcmf_attach(bus, SDPCM_RESERVE, bus->sdiodev->dev); |
3962 | if (!bus->drvr) { | 3957 | if (ret != 0) { |
3963 | brcmf_dbg(ERROR, "brcmf_attach failed\n"); | 3958 | brcmf_dbg(ERROR, "brcmf_attach failed\n"); |
3964 | goto fail; | 3959 | goto fail; |
3965 | } | 3960 | } |
@@ -4032,7 +4027,7 @@ brcmf_sdbrcm_wd_timer(struct brcmf_sdio *bus, uint wdtick) | |||
4032 | } | 4027 | } |
4033 | 4028 | ||
4034 | /* don't start the wd until fw is loaded */ | 4029 | /* don't start the wd until fw is loaded */ |
4035 | if (bus->drvr->bus_if->state == BRCMF_BUS_DOWN) | 4030 | if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) |
4036 | return; | 4031 | return; |
4037 | 4032 | ||
4038 | if (wdtick) { | 4033 | if (wdtick) { |