mac80211: Add ieee80211_hw pointer to get_expected_throughput

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>
This commit is contained in:
Maxim Altshul 2016-08-04 15:43:04 +03:00 коммит произвёл Johannes Berg
Родитель 9757235f45
Коммит 2439ca0402
3 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -5700,10 +5700,11 @@ out:
mutex_unlock(&wl->mutex); 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_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; u8 hlid = wl_sta->hlid;
/* return in units of Kbps */ /* return in units of Kbps */

Просмотреть файл

@ -3620,7 +3620,8 @@ struct ieee80211_ops {
int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
void (*leave_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 (*get_txpower)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
int *dbm); int *dbm);

Просмотреть файл

@ -1094,7 +1094,7 @@ static inline u32 drv_get_expected_throughput(struct ieee80211_local *local,
trace_drv_get_expected_throughput(sta); trace_drv_get_expected_throughput(sta);
if (local->ops->get_expected_throughput) 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); trace_drv_return_u32(local, ret);
return ret; return ret;