Release 4.11 net/mac80211/led.c
/*
* Copyright 2006, Johannes Berg <johannes@sipsolutions.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/* just for IFNAMSIZ */
#include <linux/if.h>
#include <linux/slab.h>
#include <linux/export.h>
#include "led.h"
void ieee80211_led_assoc(struct ieee80211_local *local, bool associated)
{
if (!atomic_read(&local->assoc_led_active))
return;
if (associated)
led_trigger_event(&local->assoc_led, LED_FULL);
else
led_trigger_event(&local->assoc_led, LED_OFF);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 25 | 50.00% | 1 | 33.33% |
Jiri Benc | 23 | 46.00% | 1 | 33.33% |
Fabio Baltieri | 2 | 4.00% | 1 | 33.33% |
Total | 50 | 100.00% | 3 | 100.00% |
void ieee80211_led_radio(struct ieee80211_local *local, bool enabled)
{
if (!atomic_read(&local->radio_led_active))
return;
if (enabled)
led_trigger_event(&local->radio_led, LED_FULL);
else
led_trigger_event(&local->radio_led, LED_OFF);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 25 | 50.00% | 1 | 33.33% |
Jiri Benc | 23 | 46.00% | 1 | 33.33% |
Fabio Baltieri | 2 | 4.00% | 1 | 33.33% |
Total | 50 | 100.00% | 3 | 100.00% |
void ieee80211_alloc_led_names(struct ieee80211_local *local)
{
local->rx_led.name = kasprintf(GFP_KERNEL, "%srx",
wiphy_name(local->hw.wiphy));
local->tx_led.name = kasprintf(GFP_KERNEL, "%stx",
wiphy_name(local->hw.wiphy));
local->assoc_led.name = kasprintf(GFP_KERNEL, "%sassoc",
wiphy_name(local->hw.wiphy));
local->radio_led.name = kasprintf(GFP_KERNEL, "%sradio",
wiphy_name(local->hw.wiphy));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 73 | 74.49% | 1 | 50.00% |
Michael Büsch | 25 | 25.51% | 1 | 50.00% |
Total | 98 | 100.00% | 2 | 100.00% |
void ieee80211_free_led_names(struct ieee80211_local *local)
{
kfree(local->rx_led.name);
kfree(local->tx_led.name);
kfree(local->assoc_led.name);
kfree(local->radio_led.name);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ivo van Doorn | 24 | 52.17% | 1 | 50.00% |
Johannes Berg | 22 | 47.83% | 1 | 50.00% |
Total | 46 | 100.00% | 2 | 100.00% |
static void ieee80211_tx_led_activate(struct led_classdev *led_cdev)
{
struct ieee80211_local *local = container_of(led_cdev->trigger,
struct ieee80211_local,
tx_led);
atomic_inc(&local->tx_led_active);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 30 | 83.33% | 1 | 50.00% |
Jiri Benc | 6 | 16.67% | 1 | 50.00% |
Total | 36 | 100.00% | 2 | 100.00% |
static void ieee80211_tx_led_deactivate(struct led_classdev *led_cdev)
{
struct ieee80211_local *local = container_of(led_cdev->trigger,
struct ieee80211_local,
tx_led);
atomic_dec(&local->tx_led_active);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 32 | 88.89% | 2 | 66.67% |
Jiri Benc | 4 | 11.11% | 1 | 33.33% |
Total | 36 | 100.00% | 3 | 100.00% |
static void ieee80211_rx_led_activate(struct led_classdev *led_cdev)
{
struct ieee80211_local *local = container_of(led_cdev->trigger,
struct ieee80211_local,
rx_led);
atomic_inc(&local->rx_led_active);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 36 | 100.00% | 2 | 100.00% |
Total | 36 | 100.00% | 2 | 100.00% |
static void ieee80211_rx_led_deactivate(struct led_classdev *led_cdev)
{
struct ieee80211_local *local = container_of(led_cdev->trigger,
struct ieee80211_local,
rx_led);
atomic_dec(&local->rx_led_active);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 34 | 94.44% | 2 | 66.67% |
Jiri Benc | 2 | 5.56% | 1 | 33.33% |
Total | 36 | 100.00% | 3 | 100.00% |
static void ieee80211_assoc_led_activate(struct led_classdev *led_cdev)
{
struct ieee80211_local *local = container_of(led_cdev->trigger,
struct ieee80211_local,
assoc_led);
atomic_inc(&local->assoc_led_active);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 33 | 91.67% | 2 | 66.67% |
Jiri Benc | 3 | 8.33% | 1 | 33.33% |
Total | 36 | 100.00% | 3 | 100.00% |
static void ieee80211_assoc_led_deactivate(struct led_classdev *led_cdev)
{
struct ieee80211_local *local = container_of(led_cdev->trigger,
struct ieee80211_local,
assoc_led);
atomic_dec(&local->assoc_led_active);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 34 | 94.44% | 2 | 66.67% |
Jiri Benc | 2 | 5.56% | 1 | 33.33% |
Total | 36 | 100.00% | 3 | 100.00% |
static void ieee80211_radio_led_activate(struct led_classdev *led_cdev)
{
struct ieee80211_local *local = container_of(led_cdev->trigger,
struct ieee80211_local,
radio_led);
atomic_inc(&local->radio_led_active);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 36 | 100.00% | 2 | 100.00% |
Total | 36 | 100.00% | 2 | 100.00% |
static void ieee80211_radio_led_deactivate(struct led_classdev *led_cdev)
{
struct ieee80211_local *local = container_of(led_cdev->trigger,
struct ieee80211_local,
radio_led);
atomic_dec(&local->radio_led_active);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 36 | 100.00% | 2 | 100.00% |
Total | 36 | 100.00% | 2 | 100.00% |
static void ieee80211_tpt_led_activate(struct led_classdev *led_cdev)
{
struct ieee80211_local *local = container_of(led_cdev->trigger,
struct ieee80211_local,
tpt_led);
atomic_inc(&local->tpt_led_active);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 35 | 97.22% | 1 | 50.00% |
Jiri Benc | 1 | 2.78% | 1 | 50.00% |
Total | 36 | 100.00% | 2 | 100.00% |
static void ieee80211_tpt_led_deactivate(struct led_classdev *led_cdev)
{
struct ieee80211_local *local = container_of(led_cdev->trigger,
struct ieee80211_local,
tpt_led);
atomic_dec(&local->tpt_led_active);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 26 | 72.22% | 2 | 66.67% |
Jiri Benc | 10 | 27.78% | 1 | 33.33% |
Total | 36 | 100.00% | 3 | 100.00% |
void ieee80211_led_init(struct ieee80211_local *local)
{
atomic_set(&local->rx_led_active, 0);
local->rx_led.activate = ieee80211_rx_led_activate;
local->rx_led.deactivate = ieee80211_rx_led_deactivate;
if (local->rx_led.name && led_trigger_register(&local->rx_led)) {
kfree(local->rx_led.name);
local->rx_led.name = NULL;
}
atomic_set(&local->tx_led_active, 0);
local->tx_led.activate = ieee80211_tx_led_activate;
local->tx_led.deactivate = ieee80211_tx_led_deactivate;
if (local->tx_led.name && led_trigger_register(&local->tx_led)) {
kfree(local->tx_led.name);
local->tx_led.name = NULL;
}
atomic_set(&local->assoc_led_active, 0);
local->assoc_led.activate = ieee80211_assoc_led_activate;
local->assoc_led.deactivate = ieee80211_assoc_led_deactivate;
if (local->assoc_led.name && led_trigger_register(&local->assoc_led)) {
kfree(local->assoc_led.name);
local->assoc_led.name = NULL;
}
atomic_set(&local->radio_led_active, 0);
local->radio_led.activate = ieee80211_radio_led_activate;
local->radio_led.deactivate = ieee80211_radio_led_deactivate;
if (local->radio_led.name && led_trigger_register(&local->radio_led)) {
kfree(local->radio_led.name);
local->radio_led.name = NULL;
}
atomic_set(&local->tpt_led_active, 0);
if (local->tpt_led_trigger) {
local->tpt_led.activate = ieee80211_tpt_led_activate;
local->tpt_led.deactivate = ieee80211_tpt_led_deactivate;
if (led_trigger_register(&local->tpt_led)) {
kfree(local->tpt_led_trigger);
local->tpt_led_trigger = NULL;
}
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 172 | 54.95% | 3 | 50.00% |
Jiri Benc | 66 | 21.09% | 1 | 16.67% |
Michael Büsch | 38 | 12.14% | 1 | 16.67% |
Ivo van Doorn | 37 | 11.82% | 1 | 16.67% |
Total | 313 | 100.00% | 6 | 100.00% |
void ieee80211_led_exit(struct ieee80211_local *local)
{
if (local->radio_led.name)
led_trigger_unregister(&local->radio_led);
if (local->assoc_led.name)
led_trigger_unregister(&local->assoc_led);
if (local->tx_led.name)
led_trigger_unregister(&local->tx_led);
if (local->rx_led.name)
led_trigger_unregister(&local->rx_led);
if (local->tpt_led_trigger) {
led_trigger_unregister(&local->tpt_led);
kfree(local->tpt_led_trigger);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jiri Benc | 36 | 37.11% | 1 | 20.00% |
Johannes Berg | 35 | 36.08% | 2 | 40.00% |
Ivo van Doorn | 13 | 13.40% | 1 | 20.00% |
Michael Büsch | 13 | 13.40% | 1 | 20.00% |
Total | 97 | 100.00% | 5 | 100.00% |
const char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);
return local->radio_led.name;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ivo van Doorn | 25 | 86.21% | 1 | 33.33% |
Johannes Berg | 4 | 13.79% | 2 | 66.67% |
Total | 29 | 100.00% | 3 | 100.00% |
EXPORT_SYMBOL(__ieee80211_get_radio_led_name);
const char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);
return local->assoc_led.name;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Michael Büsch | 25 | 86.21% | 1 | 33.33% |
Johannes Berg | 4 | 13.79% | 2 | 66.67% |
Total | 29 | 100.00% | 3 | 100.00% |
EXPORT_SYMBOL(__ieee80211_get_assoc_led_name);
const char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);
return local->tx_led.name;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jiri Benc | 25 | 86.21% | 1 | 33.33% |
Johannes Berg | 4 | 13.79% | 2 | 66.67% |
Total | 29 | 100.00% | 3 | 100.00% |
EXPORT_SYMBOL(__ieee80211_get_tx_led_name);
const char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);
return local->rx_led.name;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jiri Benc | 25 | 86.21% | 1 | 33.33% |
Johannes Berg | 4 | 13.79% | 2 | 66.67% |
Total | 29 | 100.00% | 3 | 100.00% |
EXPORT_SYMBOL(__ieee80211_get_rx_led_name);
static unsigned long tpt_trig_traffic(struct ieee80211_local *local,
struct tpt_led_trigger *tpt_trig)
{
unsigned long traffic, delta;
traffic = tpt_trig->tx_bytes + tpt_trig->rx_bytes;
delta = traffic - tpt_trig->prev_traffic;
tpt_trig->prev_traffic = traffic;
return DIV_ROUND_UP(delta, 1024 / 8);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 57 | 100.00% | 1 | 100.00% |
Total | 57 | 100.00% | 1 | 100.00% |
static void tpt_trig_timer(unsigned long data)
{
struct ieee80211_local *local = (void *)data;
struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger;
struct led_classdev *led_cdev;
unsigned long on, off, tpt;
int i;
if (!tpt_trig->running)
return;
mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ));
tpt = tpt_trig_traffic(local, tpt_trig);
/* default to just solid on */
on = 1;
off = 0;
for (i = tpt_trig->blink_table_len - 1; i >= 0; i--) {
if (tpt_trig->blink_table[i].throughput < 0 ||
tpt > tpt_trig->blink_table[i].throughput) {
off = tpt_trig->blink_table[i].blink_time / 2;
on = tpt_trig->blink_table[i].blink_time - off;
break;
}
}
read_lock(&local->tpt_led.leddev_list_lock);
list_for_each_entry(led_cdev, &local->tpt_led.led_cdevs, trig_list)
led_blink_set(led_cdev, &on, &off);
read_unlock(&local->tpt_led.leddev_list_lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 198 | 100.00% | 2 | 100.00% |
Total | 198 | 100.00% | 2 | 100.00% |
const char *
__ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw,
unsigned int flags,
const struct ieee80211_tpt_blink *blink_table,
unsigned int blink_table_len)
{
struct ieee80211_local *local = hw_to_local(hw);
struct tpt_led_trigger *tpt_trig;
if (WARN_ON(local->tpt_led_trigger))
return NULL;
tpt_trig = kzalloc(sizeof(struct tpt_led_trigger), GFP_KERNEL);
if (!tpt_trig)
return NULL;
snprintf(tpt_trig->name, sizeof(tpt_trig->name),
"%stpt", wiphy_name(local->hw.wiphy));
local->tpt_led.name = tpt_trig->name;
tpt_trig->blink_table = blink_table;
tpt_trig->blink_table_len = blink_table_len;
tpt_trig->want = flags;
setup_timer(&tpt_trig->timer, tpt_trig_timer, (unsigned long)local);
local->tpt_led_trigger = tpt_trig;
return tpt_trig->name;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 154 | 100.00% | 4 | 100.00% |
Total | 154 | 100.00% | 4 | 100.00% |
EXPORT_SYMBOL(__ieee80211_create_tpt_led_trigger);
static void ieee80211_start_tpt_led_trig(struct ieee80211_local *local)
{
struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger;
if (tpt_trig->running)
return;
/* reset traffic */
tpt_trig_traffic(local, tpt_trig);
tpt_trig->running = true;
tpt_trig_timer((unsigned long)local);
mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 65 | 100.00% | 2 | 100.00% |
Total | 65 | 100.00% | 2 | 100.00% |
static void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local)
{
struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger;
struct led_classdev *led_cdev;
if (!tpt_trig->running)
return;
tpt_trig->running = false;
del_timer_sync(&tpt_trig->timer);
read_lock(&local->tpt_led.leddev_list_lock);
list_for_each_entry(led_cdev, &local->tpt_led.led_cdevs, trig_list)
led_set_brightness(led_cdev, LED_OFF);
read_unlock(&local->tpt_led.leddev_list_lock);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 81 | 98.78% | 3 | 75.00% |
Shuah Khan | 1 | 1.22% | 1 | 25.00% |
Total | 82 | 100.00% | 4 | 100.00% |
void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local,
unsigned int types_on, unsigned int types_off)
{
struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger;
bool allowed;
WARN_ON(types_on & types_off);
if (!tpt_trig)
return;
tpt_trig->active &= ~types_off;
tpt_trig->active |= types_on;
/*
* Regardless of wanted state, we shouldn't blink when
* the radio is disabled -- this can happen due to some
* code ordering issues with __ieee80211_recalc_idle()
* being called before the radio is started.
*/
allowed = tpt_trig->active & IEEE80211_TPT_LEDTRIG_FL_RADIO;
if (!allowed || !(tpt_trig->active & tpt_trig->want))
ieee80211_stop_tpt_led_trig(local);
else
ieee80211_start_tpt_led_trig(local);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 92 | 100.00% | 1 | 100.00% |
Total | 92 | 100.00% | 1 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Johannes Berg | 1353 | 74.46% | 7 | 50.00% |
Jiri Benc | 243 | 13.37% | 1 | 7.14% |
Michael Büsch | 106 | 5.83% | 1 | 7.14% |
Ivo van Doorn | 104 | 5.72% | 1 | 7.14% |
Fabio Baltieri | 4 | 0.22% | 1 | 7.14% |
Tejun Heo | 3 | 0.17% | 1 | 7.14% |
Paul Gortmaker | 3 | 0.17% | 1 | 7.14% |
Shuah Khan | 1 | 0.06% | 1 | 7.14% |
Total | 1817 | 100.00% | 14 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.