Message ID | 038706d9bbf434642013e880300d4f597f13b514.1695329290.git.yi-chia.hsieh@mediatek.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Johannes Berg |
Headers | show |
Series | [v3] wifi: mac80211: add exported tpt_led_trig function for softmac driver | expand |
> +++ b/include/net/mac80211.h > @@ -4733,6 +4733,8 @@ __ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, > unsigned int flags, > const struct ieee80211_tpt_blink *blink_table, > unsigned int blink_table_len); > +void __ieee80211_tpt_led_trig_trx(struct ieee80211_hw *hw, > + int tx_bytes, int rx_bytes); Hm, I think you misunderstood what I said. I still think you need to have a well-documented function or two here, but now you can make the exported versions of this be inlines calling this new function. But also this now fails the build if !CONFIG_MAC80211_LEDS, you need to have an ifdef somewhere. > +void __ieee80211_tpt_led_trig_trx(struct ieee80211_hw *hw, > + int tx_bytes, int rx_bytes) > +{ > + struct ieee80211_local *local = hw_to_local(hw); > + > + if (atomic_read(&local->tpt_led_active)) { > + local->tpt_led_trigger->tx_bytes += tx_bytes; > + local->tpt_led_trigger->rx_bytes += rx_bytes; > + } > +} > +EXPORT_SYMBOL(__ieee80211_tpt_led_trig_trx); Even that won't build. > --- a/net/mac80211/led.h > +++ b/net/mac80211/led.h > @@ -71,8 +71,7 @@ static inline void > ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, int bytes) > { > #ifdef CONFIG_MAC80211_LEDS > - if (atomic_read(&local->tpt_led_active)) > - local->tpt_led_trigger->tx_bytes += bytes; > + __ieee80211_tpt_led_trig_trx(&local->hw, bytes, 0); > #endif Ah. Actually what I was thinking is that __ieee80211_tpt_led_trig_trx is still an inline, and then the ieee80211_tpt_led_trig_trx() exported to drivers can call this alongside these inlines - that way mac80211 still gets the (trivial) code inlined. johannes
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 8d993f6ab919..c32f614acb3d 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -4733,6 +4733,8 @@ __ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags, const struct ieee80211_tpt_blink *blink_table, unsigned int blink_table_len); +void __ieee80211_tpt_led_trig_trx(struct ieee80211_hw *hw, + int tx_bytes, int rx_bytes); #endif /** * ieee80211_get_tx_led_name - get name of TX LED diff --git a/net/mac80211/led.c b/net/mac80211/led.c index 2dc732147e85..1c18ebcaac20 100644 --- a/net/mac80211/led.c +++ b/net/mac80211/led.c @@ -319,6 +319,18 @@ __ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, } EXPORT_SYMBOL(__ieee80211_create_tpt_led_trigger); +void __ieee80211_tpt_led_trig_trx(struct ieee80211_hw *hw, + int tx_bytes, int rx_bytes) +{ + struct ieee80211_local *local = hw_to_local(hw); + + if (atomic_read(&local->tpt_led_active)) { + local->tpt_led_trigger->tx_bytes += tx_bytes; + local->tpt_led_trigger->rx_bytes += rx_bytes; + } +} +EXPORT_SYMBOL(__ieee80211_tpt_led_trig_trx); + static void ieee80211_start_tpt_led_trig(struct ieee80211_local *local) { struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; diff --git a/net/mac80211/led.h b/net/mac80211/led.h index d25f13346b82..6d3212443d35 100644 --- a/net/mac80211/led.h +++ b/net/mac80211/led.h @@ -71,8 +71,7 @@ static inline void ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, int bytes) { #ifdef CONFIG_MAC80211_LEDS - if (atomic_read(&local->tpt_led_active)) - local->tpt_led_trigger->tx_bytes += bytes; + __ieee80211_tpt_led_trig_trx(&local->hw, bytes, 0); #endif } @@ -80,7 +79,6 @@ static inline void ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, int bytes) { #ifdef CONFIG_MAC80211_LEDS - if (atomic_read(&local->tpt_led_active)) - local->tpt_led_trigger->rx_bytes += bytes; + __ieee80211_tpt_led_trig_trx(&local->hw, 0, bytes); #endif }