Skip to content

Commit

Permalink
mac80211: Add ieee80211_hw pointer to get_expected_throughput
Browse files Browse the repository at this point in the history
The variable is added to allow the driver an easy access to
it's own hw->priv when the op is invoked.

This fixes a crash in wlcore because it was relying on a
station pointer that wasn't initialized yet. It's the wrong
way to fix the crash, but it solves the problem for now and
it does make sense to have the hw pointer here.

Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
[rewrite commit message, fix indentation]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Maxim Altshul authored and Johannes Berg committed Aug 5, 2016
1 parent 9757235 commit 2439ca0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions drivers/net/wireless/ti/wlcore/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5700,10 +5700,11 @@ static void wlcore_op_sta_statistics(struct ieee80211_hw *hw,
mutex_unlock(&wl->mutex);
}

static u32 wlcore_op_get_expected_throughput(struct ieee80211_sta *sta)
static u32 wlcore_op_get_expected_throughput(struct ieee80211_hw *hw,
struct ieee80211_sta *sta)
{
struct wl1271_station *wl_sta = (struct wl1271_station *)sta->drv_priv;
struct wl1271 *wl = wl_sta->wl;
struct wl1271 *wl = hw->priv;
u8 hlid = wl_sta->hlid;

/* return in units of Kbps */
Expand Down
3 changes: 2 additions & 1 deletion include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -3620,7 +3620,8 @@ struct ieee80211_ops {

int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
u32 (*get_expected_throughput)(struct ieee80211_sta *sta);
u32 (*get_expected_throughput)(struct ieee80211_hw *hw,
struct ieee80211_sta *sta);
int (*get_txpower)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
int *dbm);

Expand Down
2 changes: 1 addition & 1 deletion net/mac80211/driver-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ static inline u32 drv_get_expected_throughput(struct ieee80211_local *local,

trace_drv_get_expected_throughput(sta);
if (local->ops->get_expected_throughput)
ret = local->ops->get_expected_throughput(sta);
ret = local->ops->get_expected_throughput(&local->hw, sta);
trace_drv_return_u32(local, ret);

return ret;
Expand Down

0 comments on commit 2439ca0

Please sign in to comment.