diff options
author | Sujith.Manoharan@atheros.com <Sujith.Manoharan@atheros.com> | 2010-05-11 06:54:41 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-12 16:39:06 -0400 |
commit | 47fce026d5de5d11e161da73208171e9c91b659a (patch) | |
tree | b63ac53195fd7d069a4bc79c5ec49d32a2c57e5d | |
parent | 1d8af8caccceab91ba65b7f659678b92093f9203 (diff) |
ath9k_htc: Reorder HTC initialization
The HTC state has to be setup before initializing
the target because the ready message could possibly
come before the control endpoints in HTC have been
identified.
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hif_usb.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/htc_hst.c | 38 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/htc_hst.h | 9 |
3 files changed, 35 insertions, 34 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 453cf56eba78..46dc41a16faa 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -859,21 +859,21 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, | |||
859 | #endif | 859 | #endif |
860 | usb_set_intfdata(interface, hif_dev); | 860 | usb_set_intfdata(interface, hif_dev); |
861 | 861 | ||
862 | hif_dev->htc_handle = ath9k_htc_hw_alloc(hif_dev, &hif_usb, | ||
863 | &hif_dev->udev->dev); | ||
864 | if (hif_dev->htc_handle == NULL) { | ||
865 | ret = -ENOMEM; | ||
866 | goto err_htc_hw_alloc; | ||
867 | } | ||
868 | |||
862 | ret = ath9k_hif_usb_dev_init(hif_dev, fw_name); | 869 | ret = ath9k_hif_usb_dev_init(hif_dev, fw_name); |
863 | if (ret) { | 870 | if (ret) { |
864 | ret = -EINVAL; | 871 | ret = -EINVAL; |
865 | goto err_hif_init_usb; | 872 | goto err_hif_init_usb; |
866 | } | 873 | } |
867 | 874 | ||
868 | hif_dev->htc_handle = ath9k_htc_hw_alloc(hif_dev); | 875 | ret = ath9k_htc_hw_init(hif_dev->htc_handle, |
869 | if (hif_dev->htc_handle == NULL) { | 876 | &hif_dev->udev->dev, hif_dev->device_id); |
870 | ret = -ENOMEM; | ||
871 | goto err_htc_hw_alloc; | ||
872 | } | ||
873 | |||
874 | ret = ath9k_htc_hw_init(&hif_usb, hif_dev->htc_handle, hif_dev, | ||
875 | &hif_dev->udev->dev, hif_dev->device_id, | ||
876 | ATH9K_HIF_USB); | ||
877 | if (ret) { | 877 | if (ret) { |
878 | ret = -EINVAL; | 878 | ret = -EINVAL; |
879 | goto err_htc_hw_init; | 879 | goto err_htc_hw_init; |
@@ -884,10 +884,10 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, | |||
884 | return 0; | 884 | return 0; |
885 | 885 | ||
886 | err_htc_hw_init: | 886 | err_htc_hw_init: |
887 | ath9k_htc_hw_free(hif_dev->htc_handle); | ||
888 | err_htc_hw_alloc: | ||
889 | ath9k_hif_usb_dev_deinit(hif_dev); | 887 | ath9k_hif_usb_dev_deinit(hif_dev); |
890 | err_hif_init_usb: | 888 | err_hif_init_usb: |
889 | ath9k_htc_hw_free(hif_dev->htc_handle); | ||
890 | err_htc_hw_alloc: | ||
891 | usb_set_intfdata(interface, NULL); | 891 | usb_set_intfdata(interface, NULL); |
892 | kfree(hif_dev); | 892 | kfree(hif_dev); |
893 | usb_put_dev(udev); | 893 | usb_put_dev(udev); |
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c index 7bf6ce1e7e2e..2c8006ae2786 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c | |||
@@ -425,29 +425,19 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle, | |||
425 | } | 425 | } |
426 | } | 426 | } |
427 | 427 | ||
428 | struct htc_target *ath9k_htc_hw_alloc(void *hif_handle) | 428 | struct htc_target *ath9k_htc_hw_alloc(void *hif_handle, |
429 | struct ath9k_htc_hif *hif, | ||
430 | struct device *dev) | ||
429 | { | 431 | { |
432 | struct htc_endpoint *endpoint; | ||
430 | struct htc_target *target; | 433 | struct htc_target *target; |
431 | 434 | ||
432 | target = kzalloc(sizeof(struct htc_target), GFP_KERNEL); | 435 | target = kzalloc(sizeof(struct htc_target), GFP_KERNEL); |
433 | if (!target) | 436 | if (!target) { |
434 | printk(KERN_ERR "Unable to allocate memory for" | 437 | printk(KERN_ERR "Unable to allocate memory for" |
435 | "target device\n"); | 438 | "target device\n"); |
436 | 439 | return NULL; | |
437 | return target; | 440 | } |
438 | } | ||
439 | |||
440 | void ath9k_htc_hw_free(struct htc_target *htc) | ||
441 | { | ||
442 | kfree(htc); | ||
443 | } | ||
444 | |||
445 | int ath9k_htc_hw_init(struct ath9k_htc_hif *hif, struct htc_target *target, | ||
446 | void *hif_handle, struct device *dev, u16 devid, | ||
447 | enum ath9k_hif_transports transport) | ||
448 | { | ||
449 | struct htc_endpoint *endpoint; | ||
450 | int err = 0; | ||
451 | 441 | ||
452 | init_completion(&target->target_wait); | 442 | init_completion(&target->target_wait); |
453 | init_completion(&target->cmd_wait); | 443 | init_completion(&target->cmd_wait); |
@@ -461,8 +451,18 @@ int ath9k_htc_hw_init(struct ath9k_htc_hif *hif, struct htc_target *target, | |||
461 | endpoint->ul_pipeid = hif->control_ul_pipe; | 451 | endpoint->ul_pipeid = hif->control_ul_pipe; |
462 | endpoint->dl_pipeid = hif->control_dl_pipe; | 452 | endpoint->dl_pipeid = hif->control_dl_pipe; |
463 | 453 | ||
464 | err = ath9k_htc_probe_device(target, dev, devid); | 454 | return target; |
465 | if (err) { | 455 | } |
456 | |||
457 | void ath9k_htc_hw_free(struct htc_target *htc) | ||
458 | { | ||
459 | kfree(htc); | ||
460 | } | ||
461 | |||
462 | int ath9k_htc_hw_init(struct htc_target *target, | ||
463 | struct device *dev, u16 devid) | ||
464 | { | ||
465 | if (ath9k_htc_probe_device(target, dev, devid)) { | ||
466 | printk(KERN_ERR "Failed to initialize the device\n"); | 466 | printk(KERN_ERR "Failed to initialize the device\n"); |
467 | return -ENODEV; | 467 | return -ENODEV; |
468 | } | 468 | } |
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.h b/drivers/net/wireless/ath/ath9k/htc_hst.h index ea50ab032d20..d216c0f4d168 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.h +++ b/drivers/net/wireless/ath/ath9k/htc_hst.h | |||
@@ -236,11 +236,12 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle, | |||
236 | void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, | 236 | void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, |
237 | struct sk_buff *skb, bool txok); | 237 | struct sk_buff *skb, bool txok); |
238 | 238 | ||
239 | struct htc_target *ath9k_htc_hw_alloc(void *hif_handle); | 239 | struct htc_target *ath9k_htc_hw_alloc(void *hif_handle, |
240 | struct ath9k_htc_hif *hif, | ||
241 | struct device *dev); | ||
240 | void ath9k_htc_hw_free(struct htc_target *htc); | 242 | void ath9k_htc_hw_free(struct htc_target *htc); |
241 | int ath9k_htc_hw_init(struct ath9k_htc_hif *hif, struct htc_target *target, | 243 | int ath9k_htc_hw_init(struct htc_target *target, |
242 | void *hif_handle, struct device *dev, u16 devid, | 244 | struct device *dev, u16 devid); |
243 | enum ath9k_hif_transports transport); | ||
244 | void ath9k_htc_hw_deinit(struct htc_target *target, bool hot_unplug); | 245 | void ath9k_htc_hw_deinit(struct htc_target *target, bool hot_unplug); |
245 | 246 | ||
246 | #endif /* HTC_HST_H */ | 247 | #endif /* HTC_HST_H */ |