summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSujith.Manoharan@atheros.com <Sujith.Manoharan@atheros.com>2010-05-11 16:24:41 +0530
committerJohn W. Linville <linville@tuxdriver.com>2010-05-12 16:39:06 -0400
commit47fce026d5de5d11e161da73208171e9c91b659a (patch)
treeb63ac53195fd7d069a4bc79c5ec49d32a2c57e5d
parent1d8af8caccceab91ba65b7f659678b92093f9203 (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.c22
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_hst.c38
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_hst.h9
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 453cf56eba7..46dc41a16fa 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,
#endif
usb_set_intfdata(interface, hif_dev);
+ hif_dev->htc_handle = ath9k_htc_hw_alloc(hif_dev, &hif_usb,
+ &hif_dev->udev->dev);
+ if (hif_dev->htc_handle == NULL) {
+ ret = -ENOMEM;
+ goto err_htc_hw_alloc;
+ }
+
ret = ath9k_hif_usb_dev_init(hif_dev, fw_name);
if (ret) {
ret = -EINVAL;
goto err_hif_init_usb;
}
- hif_dev->htc_handle = ath9k_htc_hw_alloc(hif_dev);
- if (hif_dev->htc_handle == NULL) {
- ret = -ENOMEM;
- goto err_htc_hw_alloc;
- }
-
- ret = ath9k_htc_hw_init(&hif_usb, hif_dev->htc_handle, hif_dev,
- &hif_dev->udev->dev, hif_dev->device_id,
- ATH9K_HIF_USB);
+ ret = ath9k_htc_hw_init(hif_dev->htc_handle,
+ &hif_dev->udev->dev, hif_dev->device_id);
if (ret) {
ret = -EINVAL;
goto err_htc_hw_init;
@@ -884,10 +884,10 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface,
return 0;
err_htc_hw_init:
- ath9k_htc_hw_free(hif_dev->htc_handle);
-err_htc_hw_alloc:
ath9k_hif_usb_dev_deinit(hif_dev);
err_hif_init_usb:
+ ath9k_htc_hw_free(hif_dev->htc_handle);
+err_htc_hw_alloc:
usb_set_intfdata(interface, NULL);
kfree(hif_dev);
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 7bf6ce1e7e2..2c8006ae278 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,
}
}
-struct htc_target *ath9k_htc_hw_alloc(void *hif_handle)
+struct htc_target *ath9k_htc_hw_alloc(void *hif_handle,
+ struct ath9k_htc_hif *hif,
+ struct device *dev)
{
+ struct htc_endpoint *endpoint;
struct htc_target *target;
target = kzalloc(sizeof(struct htc_target), GFP_KERNEL);
- if (!target)
+ if (!target) {
printk(KERN_ERR "Unable to allocate memory for"
"target device\n");
-
- return target;
-}
-
-void ath9k_htc_hw_free(struct htc_target *htc)
-{
- kfree(htc);
-}
-
-int ath9k_htc_hw_init(struct ath9k_htc_hif *hif, struct htc_target *target,
- void *hif_handle, struct device *dev, u16 devid,
- enum ath9k_hif_transports transport)
-{
- struct htc_endpoint *endpoint;
- int err = 0;
+ return NULL;
+ }
init_completion(&target->target_wait);
init_completion(&target->cmd_wait);
@@ -461,8 +451,18 @@ int ath9k_htc_hw_init(struct ath9k_htc_hif *hif, struct htc_target *target,
endpoint->ul_pipeid = hif->control_ul_pipe;
endpoint->dl_pipeid = hif->control_dl_pipe;
- err = ath9k_htc_probe_device(target, dev, devid);
- if (err) {
+ return target;
+}
+
+void ath9k_htc_hw_free(struct htc_target *htc)
+{
+ kfree(htc);
+}
+
+int ath9k_htc_hw_init(struct htc_target *target,
+ struct device *dev, u16 devid)
+{
+ if (ath9k_htc_probe_device(target, dev, devid)) {
printk(KERN_ERR "Failed to initialize the device\n");
return -ENODEV;
}
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.h b/drivers/net/wireless/ath/ath9k/htc_hst.h
index ea50ab032d2..d216c0f4d16 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,
void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle,
struct sk_buff *skb, bool txok);
-struct htc_target *ath9k_htc_hw_alloc(void *hif_handle);
+struct htc_target *ath9k_htc_hw_alloc(void *hif_handle,
+ struct ath9k_htc_hif *hif,
+ struct device *dev);
void ath9k_htc_hw_free(struct htc_target *htc);
-int ath9k_htc_hw_init(struct ath9k_htc_hif *hif, struct htc_target *target,
- void *hif_handle, struct device *dev, u16 devid,
- enum ath9k_hif_transports transport);
+int ath9k_htc_hw_init(struct htc_target *target,
+ struct device *dev, u16 devid);
void ath9k_htc_hw_deinit(struct htc_target *target, bool hot_unplug);
#endif /* HTC_HST_H */