diff options
author | Arend van Spriel <arend@broadcom.com> | 2012-09-27 08:17:52 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-09-28 13:54:08 -0400 |
commit | b451ec94de3338da33aedd1768a197790bf23eca (patch) | |
tree | f2b681b623e1539a15ccddbfd9c33366cbec773b /drivers/net/wireless/brcm80211 | |
parent | c3567a04cd63c98a27a7b5f2d9059f159943de5f (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.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 48 | ||||
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h | 12 |
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 | ||
58 | static u32 brcmf_dbg_level = WL_DBG_ERR; | 58 | static u32 brcmf_dbg_level = WL_DBG_ERR; |
59 | 59 | ||
60 | static void brcmf_set_drvdata(struct brcmf_cfg80211_dev *dev, void *data) | ||
61 | { | ||
62 | dev->driver_data = data; | ||
63 | } | ||
64 | |||
65 | static 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 | |||
74 | static | ||
75 | struct 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 | |||
81 | static bool check_sys_up(struct wiphy *wiphy) | 60 | static 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 | ||
4341 | struct brcmf_cfg80211_dev *brcmf_cfg80211_attach(struct net_device *ndev, | 4320 | struct 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 | ||
4383 | cfg80211_attach_out: | 4361 | cfg80211_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 | ||
4389 | void brcmf_cfg80211_detach(struct brcmf_cfg80211_dev *cfg_dev) | 4367 | void 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 | ||
4401 | void | 4373 | void |
@@ -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 | ||
4757 | s32 brcmf_cfg80211_up(struct brcmf_cfg80211_dev *cfg_dev) | 4729 | s32 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 | ||
4770 | s32 brcmf_cfg80211_down(struct brcmf_cfg80211_dev *cfg_dev) | 4740 | s32 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 | ||
500 | struct brcmf_cfg80211_dev *brcmf_cfg80211_attach(struct net_device *ndev, | 500 | struct 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); |
503 | void brcmf_cfg80211_detach(struct brcmf_cfg80211_dev *cfg); | 503 | void brcmf_cfg80211_detach(struct brcmf_cfg80211_priv *cfg_priv); |
504 | 504 | ||
505 | /* event handler from dongle */ | 505 | /* event handler from dongle */ |
506 | void brcmf_cfg80211_event(struct net_device *ndev, | 506 | void 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); |
508 | s32 brcmf_cfg80211_up(struct brcmf_cfg80211_dev *cfg_dev); | 508 | s32 brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv); |
509 | s32 brcmf_cfg80211_down(struct brcmf_cfg80211_dev *cfg_dev); | 509 | s32 brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv); |
510 | 510 | ||
511 | #endif /* _wl_cfg80211_h_ */ | 511 | #endif /* _wl_cfg80211_h_ */ |