aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/main.c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2011-10-06 06:05:25 -0400
committerLuciano Coelho <coelho@ti.com>2011-10-11 09:01:19 -0400
commitf79f890c9ccd8d10f7e5e2f7c590b0c2e854bfb6 (patch)
tree0214ae98ed73920c6b0b843803f0cc75039ed138 /drivers/net/wireless/wl12xx/main.c
parent4b32a2c9a636eaab69c797d9ebc7e086a6bd2fb7 (diff)
wl12xx: drop unneeded plat_dev
now that useless plat_dev is unnecessary, we can remove it. Signed-off-by: Felipe Balbi <balbi@ti.com> [forward ported and fixed sysfs file creation] Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/main.c')
-rw-r--r--drivers/net/wireless/wl12xx/main.c104
1 files changed, 30 insertions, 74 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 56927051f665..c72f7497db09 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -383,22 +383,6 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl,
383static void wl1271_op_stop(struct ieee80211_hw *hw); 383static void wl1271_op_stop(struct ieee80211_hw *hw);
384static void wl1271_free_ap_keys(struct wl1271 *wl, struct wl12xx_vif *wlvif); 384static void wl1271_free_ap_keys(struct wl1271 *wl, struct wl12xx_vif *wlvif);
385 385
386
387static void wl1271_device_release(struct device *dev)
388{
389
390}
391
392static struct platform_device wl1271_device = {
393 .name = "wl1271",
394 .id = -1,
395
396 /* device model insists to have a release function */
397 .dev = {
398 .release = wl1271_device_release,
399 },
400};
401
402static DEFINE_MUTEX(wl_list_mutex); 386static DEFINE_MUTEX(wl_list_mutex);
403static LIST_HEAD(wl_list); 387static LIST_HEAD(wl_list);
404 388
@@ -4992,7 +4976,6 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)
4992static struct ieee80211_hw *wl1271_alloc_hw(void) 4976static struct ieee80211_hw *wl1271_alloc_hw(void)
4993{ 4977{
4994 struct ieee80211_hw *hw; 4978 struct ieee80211_hw *hw;
4995 struct platform_device *plat_dev = NULL;
4996 struct wl1271 *wl; 4979 struct wl1271 *wl;
4997 int i, j, ret; 4980 int i, j, ret;
4998 unsigned int order; 4981 unsigned int order;
@@ -5006,13 +4989,6 @@ static struct ieee80211_hw *wl1271_alloc_hw(void)
5006 goto err_hw_alloc; 4989 goto err_hw_alloc;
5007 } 4990 }
5008 4991
5009 plat_dev = kmemdup(&wl1271_device, sizeof(wl1271_device), GFP_KERNEL);
5010 if (!plat_dev) {
5011 wl1271_error("could not allocate platform_device");
5012 ret = -ENOMEM;
5013 goto err_plat_alloc;
5014 }
5015
5016 wl = hw->priv; 4992 wl = hw->priv;
5017 memset(wl, 0, sizeof(*wl)); 4993 memset(wl, 0, sizeof(*wl));
5018 4994
@@ -5020,7 +4996,6 @@ static struct ieee80211_hw *wl1271_alloc_hw(void)
5020 INIT_LIST_HEAD(&wl->wlvif_list); 4996 INIT_LIST_HEAD(&wl->wlvif_list);
5021 4997
5022 wl->hw = hw; 4998 wl->hw = hw;
5023 wl->plat_dev = plat_dev;
5024 4999
5025 for (i = 0; i < NUM_TX_QUEUES; i++) 5000 for (i = 0; i < NUM_TX_QUEUES; i++)
5026 for (j = 0; j < WL12XX_MAX_LINKS; j++) 5001 for (j = 0; j < WL12XX_MAX_LINKS; j++)
@@ -5095,49 +5070,8 @@ static struct ieee80211_hw *wl1271_alloc_hw(void)
5095 goto err_dummy_packet; 5070 goto err_dummy_packet;
5096 } 5071 }
5097 5072
5098 /* Register platform device */
5099 ret = platform_device_register(wl->plat_dev);
5100 if (ret) {
5101 wl1271_error("couldn't register platform device");
5102 goto err_fwlog;
5103 }
5104 dev_set_drvdata(&wl->plat_dev->dev, wl);
5105
5106 /* Create sysfs file to control bt coex state */
5107 ret = device_create_file(&wl->plat_dev->dev, &dev_attr_bt_coex_state);
5108 if (ret < 0) {
5109 wl1271_error("failed to create sysfs file bt_coex_state");
5110 goto err_platform;
5111 }
5112
5113 /* Create sysfs file to get HW PG version */
5114 ret = device_create_file(&wl->plat_dev->dev, &dev_attr_hw_pg_ver);
5115 if (ret < 0) {
5116 wl1271_error("failed to create sysfs file hw_pg_ver");
5117 goto err_bt_coex_state;
5118 }
5119
5120 /* Create sysfs file for the FW log */
5121 ret = device_create_bin_file(&wl->plat_dev->dev, &fwlog_attr);
5122 if (ret < 0) {
5123 wl1271_error("failed to create sysfs file fwlog");
5124 goto err_hw_pg_ver;
5125 }
5126
5127 return hw; 5073 return hw;
5128 5074
5129err_hw_pg_ver:
5130 device_remove_file(&wl->plat_dev->dev, &dev_attr_hw_pg_ver);
5131
5132err_bt_coex_state:
5133 device_remove_file(&wl->plat_dev->dev, &dev_attr_bt_coex_state);
5134
5135err_platform:
5136 platform_device_unregister(wl->plat_dev);
5137
5138err_fwlog:
5139 free_page((unsigned long)wl->fwlog);
5140
5141err_dummy_packet: 5075err_dummy_packet:
5142 dev_kfree_skb(wl->dummy_packet); 5076 dev_kfree_skb(wl->dummy_packet);
5143 5077
@@ -5149,9 +5083,6 @@ err_wq:
5149 5083
5150err_hw: 5084err_hw:
5151 wl1271_debugfs_exit(wl); 5085 wl1271_debugfs_exit(wl);
5152 kfree(plat_dev);
5153
5154err_plat_alloc:
5155 ieee80211_free_hw(hw); 5086 ieee80211_free_hw(hw);
5156 5087
5157err_hw_alloc: 5088err_hw_alloc:
@@ -5167,17 +5098,15 @@ static int wl1271_free_hw(struct wl1271 *wl)
5167 wake_up_interruptible_all(&wl->fwlog_waitq); 5098 wake_up_interruptible_all(&wl->fwlog_waitq);
5168 mutex_unlock(&wl->mutex); 5099 mutex_unlock(&wl->mutex);
5169 5100
5170 device_remove_bin_file(&wl->plat_dev->dev, &fwlog_attr); 5101 device_remove_bin_file(wl->dev, &fwlog_attr);
5171 5102
5172 device_remove_file(&wl->plat_dev->dev, &dev_attr_hw_pg_ver); 5103 device_remove_file(wl->dev, &dev_attr_hw_pg_ver);
5173 5104
5174 device_remove_file(&wl->plat_dev->dev, &dev_attr_bt_coex_state); 5105 device_remove_file(wl->dev, &dev_attr_bt_coex_state);
5175 platform_device_unregister(wl->plat_dev);
5176 free_page((unsigned long)wl->fwlog); 5106 free_page((unsigned long)wl->fwlog);
5177 dev_kfree_skb(wl->dummy_packet); 5107 dev_kfree_skb(wl->dummy_packet);
5178 free_pages((unsigned long)wl->aggr_buf, 5108 free_pages((unsigned long)wl->aggr_buf,
5179 get_order(WL1271_AGGR_BUFFER_SIZE)); 5109 get_order(WL1271_AGGR_BUFFER_SIZE));
5180 kfree(wl->plat_dev);
5181 5110
5182 wl1271_debugfs_exit(wl); 5111 wl1271_debugfs_exit(wl);
5183 5112
@@ -5281,8 +5210,35 @@ static int __devinit wl12xx_probe(struct platform_device *pdev)
5281 if (ret) 5210 if (ret)
5282 goto out_irq; 5211 goto out_irq;
5283 5212
5213 /* Create sysfs file to control bt coex state */
5214 ret = device_create_file(wl->dev, &dev_attr_bt_coex_state);
5215 if (ret < 0) {
5216 wl1271_error("failed to create sysfs file bt_coex_state");
5217 goto out_irq;
5218 }
5219
5220 /* Create sysfs file to get HW PG version */
5221 ret = device_create_file(wl->dev, &dev_attr_hw_pg_ver);
5222 if (ret < 0) {
5223 wl1271_error("failed to create sysfs file hw_pg_ver");
5224 goto out_bt_coex_state;
5225 }
5226
5227 /* Create sysfs file for the FW log */
5228 ret = device_create_bin_file(wl->dev, &fwlog_attr);
5229 if (ret < 0) {
5230 wl1271_error("failed to create sysfs file fwlog");
5231 goto out_hw_pg_ver;
5232 }
5233
5284 return 0; 5234 return 0;
5285 5235
5236out_hw_pg_ver:
5237 device_remove_file(wl->dev, &dev_attr_hw_pg_ver);
5238
5239out_bt_coex_state:
5240 device_remove_file(wl->dev, &dev_attr_bt_coex_state);
5241
5286out_irq: 5242out_irq:
5287 free_irq(wl->irq, wl); 5243 free_irq(wl->irq, wl);
5288 5244