aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/brcm80211
diff options
context:
space:
mode:
authorArend van Spriel <arend@broadcom.com>2012-09-27 08:17:52 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-09-28 13:54:08 -0400
commitb451ec94de3338da33aedd1768a197790bf23eca (patch)
treef2b681b623e1539a15ccddbfd9c33366cbec773b /drivers/net/wireless/brcm80211
parentc3567a04cd63c98a27a7b5f2d9059f159943de5f (diff)
brcmfmac: use brcmf_cfg80211_priv to interface with wl_cfg80211 code
The low-level driver part interfaces with wl_cfg80211 part using brcmf_cfg80211_dev structure as handle. As brcmf_cfg80211_priv is defined in interface it is more efficient to use that as handle in function calls. Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Hante Meuleman <meuleman@broadcom.com> Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/brcm80211')
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd.h2
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c48
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h12
3 files changed, 15 insertions, 47 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
index 9bb23b3854a..fc4bc6d6cb8 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
@@ -585,7 +585,7 @@ struct brcmf_pub {
585 /* Linkage ponters */ 585 /* Linkage ponters */
586 struct brcmf_bus *bus_if; 586 struct brcmf_bus *bus_if;
587 struct brcmf_proto *prot; 587 struct brcmf_proto *prot;
588 struct brcmf_cfg80211_dev *config; 588 struct brcmf_cfg80211_priv *config;
589 struct device *dev; /* fullmac dongle device pointer */ 589 struct device *dev; /* fullmac dongle device pointer */
590 590
591 /* Internal brcmf items */ 591 /* Internal brcmf items */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 8674d344f24..0a30f9c6782 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -57,27 +57,6 @@ static const u8 ether_bcast[ETH_ALEN] = {255, 255, 255, 255, 255, 255};
57 57
58static u32 brcmf_dbg_level = WL_DBG_ERR; 58static u32 brcmf_dbg_level = WL_DBG_ERR;
59 59
60static void brcmf_set_drvdata(struct brcmf_cfg80211_dev *dev, void *data)
61{
62 dev->driver_data = data;
63}
64
65static void *brcmf_get_drvdata(struct brcmf_cfg80211_dev *dev)
66{
67 void *data = NULL;
68
69 if (dev)
70 data = dev->driver_data;
71 return data;
72}
73
74static
75struct brcmf_cfg80211_priv *brcmf_priv_get(struct brcmf_cfg80211_dev *cfg_dev)
76{
77 struct brcmf_cfg80211_iface *ci = brcmf_get_drvdata(cfg_dev);
78 return ci->cfg_priv;
79}
80
81static bool check_sys_up(struct wiphy *wiphy) 60static bool check_sys_up(struct wiphy *wiphy)
82{ 61{
83 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 62 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy);
@@ -4338,9 +4317,9 @@ static void wl_deinit_priv(struct brcmf_cfg80211_priv *cfg_priv)
4338 brcmf_deinit_priv_mem(cfg_priv); 4317 brcmf_deinit_priv_mem(cfg_priv);
4339} 4318}
4340 4319
4341struct brcmf_cfg80211_dev *brcmf_cfg80211_attach(struct net_device *ndev, 4320struct brcmf_cfg80211_priv *brcmf_cfg80211_attach(struct net_device *ndev,
4342 struct device *busdev, 4321 struct device *busdev,
4343 struct brcmf_pub *drvr) 4322 struct brcmf_pub *drvr)
4344{ 4323{
4345 struct wireless_dev *wdev; 4324 struct wireless_dev *wdev;
4346 struct brcmf_cfg80211_priv *cfg_priv; 4325 struct brcmf_cfg80211_priv *cfg_priv;
@@ -4376,9 +4355,8 @@ struct brcmf_cfg80211_dev *brcmf_cfg80211_attach(struct net_device *ndev,
4376 WL_ERR("Failed to init iwm_priv (%d)\n", err); 4355 WL_ERR("Failed to init iwm_priv (%d)\n", err);
4377 goto cfg80211_attach_out; 4356 goto cfg80211_attach_out;
4378 } 4357 }
4379 brcmf_set_drvdata(cfg_dev, ci); 4358 kfree(cfg_dev);
4380 4359 return cfg_priv;
4381 return cfg_dev;
4382 4360
4383cfg80211_attach_out: 4361cfg80211_attach_out:
4384 brcmf_free_wdev(cfg_priv); 4362 brcmf_free_wdev(cfg_priv);
@@ -4386,16 +4364,10 @@ cfg80211_attach_out:
4386 return NULL; 4364 return NULL;
4387} 4365}
4388 4366
4389void brcmf_cfg80211_detach(struct brcmf_cfg80211_dev *cfg_dev) 4367void brcmf_cfg80211_detach(struct brcmf_cfg80211_priv *cfg_priv)
4390{ 4368{
4391 struct brcmf_cfg80211_priv *cfg_priv;
4392
4393 cfg_priv = brcmf_priv_get(cfg_dev);
4394
4395 wl_deinit_priv(cfg_priv); 4369 wl_deinit_priv(cfg_priv);
4396 brcmf_free_wdev(cfg_priv); 4370 brcmf_free_wdev(cfg_priv);
4397 brcmf_set_drvdata(cfg_dev, NULL);
4398 kfree(cfg_dev);
4399} 4371}
4400 4372
4401void 4373void
@@ -4754,12 +4726,10 @@ static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv)
4754 return 0; 4726 return 0;
4755} 4727}
4756 4728
4757s32 brcmf_cfg80211_up(struct brcmf_cfg80211_dev *cfg_dev) 4729s32 brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv)
4758{ 4730{
4759 struct brcmf_cfg80211_priv *cfg_priv;
4760 s32 err = 0; 4731 s32 err = 0;
4761 4732
4762 cfg_priv = brcmf_priv_get(cfg_dev);
4763 mutex_lock(&cfg_priv->usr_sync); 4733 mutex_lock(&cfg_priv->usr_sync);
4764 err = __brcmf_cfg80211_up(cfg_priv); 4734 err = __brcmf_cfg80211_up(cfg_priv);
4765 mutex_unlock(&cfg_priv->usr_sync); 4735 mutex_unlock(&cfg_priv->usr_sync);
@@ -4767,12 +4737,10 @@ s32 brcmf_cfg80211_up(struct brcmf_cfg80211_dev *cfg_dev)
4767 return err; 4737 return err;
4768} 4738}
4769 4739
4770s32 brcmf_cfg80211_down(struct brcmf_cfg80211_dev *cfg_dev) 4740s32 brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv)
4771{ 4741{
4772 struct brcmf_cfg80211_priv *cfg_priv;
4773 s32 err = 0; 4742 s32 err = 0;
4774 4743
4775 cfg_priv = brcmf_priv_get(cfg_dev);
4776 mutex_lock(&cfg_priv->usr_sync); 4744 mutex_lock(&cfg_priv->usr_sync);
4777 err = __brcmf_cfg80211_down(cfg_priv); 4745 err = __brcmf_cfg80211_down(cfg_priv);
4778 mutex_unlock(&cfg_priv->usr_sync); 4746 mutex_unlock(&cfg_priv->usr_sync);
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
index 9e478e0f1a8..618a600c640 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
@@ -497,15 +497,15 @@ brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_priv *cfg)
497 return &cfg->conn_info; 497 return &cfg->conn_info;
498} 498}
499 499
500struct brcmf_cfg80211_dev *brcmf_cfg80211_attach(struct net_device *ndev, 500struct brcmf_cfg80211_priv *brcmf_cfg80211_attach(struct net_device *ndev,
501 struct device *busdev, 501 struct device *busdev,
502 struct brcmf_pub *drvr); 502 struct brcmf_pub *drvr);
503void brcmf_cfg80211_detach(struct brcmf_cfg80211_dev *cfg); 503void brcmf_cfg80211_detach(struct brcmf_cfg80211_priv *cfg_priv);
504 504
505/* event handler from dongle */ 505/* event handler from dongle */
506void brcmf_cfg80211_event(struct net_device *ndev, 506void brcmf_cfg80211_event(struct net_device *ndev,
507 const struct brcmf_event_msg *e, void *data); 507 const struct brcmf_event_msg *e, void *data);
508s32 brcmf_cfg80211_up(struct brcmf_cfg80211_dev *cfg_dev); 508s32 brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv);
509s32 brcmf_cfg80211_down(struct brcmf_cfg80211_dev *cfg_dev); 509s32 brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv);
510 510
511#endif /* _wl_cfg80211_h_ */ 511#endif /* _wl_cfg80211_h_ */