drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtl818x/rtl8187/leds.c- Extension
.c- Size
- 6419 bytes
- Lines
- 243
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/mac80211.hlinux/usb.hlinux/eeprom_93cx6.hrtl8187.hleds.h
Detected Declarations
function Copyrightfunction led_turn_offfunction rtl8187_led_brightness_setfunction rtl8187_register_ledfunction rtl8187_unregister_ledfunction rtl8187_leds_initfunction rtl8187_leds_exit
Annotated Snippet
if (brightness == LED_FULL) {
ieee80211_queue_delayed_work(hw, &priv->led_on, 0);
radio_on = true;
} else if (radio_on) {
radio_on = false;
cancel_delayed_work(&priv->led_on);
ieee80211_queue_delayed_work(hw, &priv->led_off, 0);
}
} else if (radio_on) {
if (brightness == LED_OFF) {
ieee80211_queue_delayed_work(hw, &priv->led_off, 0);
/* The LED is off for 1/20 sec - it just blinks. */
ieee80211_queue_delayed_work(hw, &priv->led_on,
HZ / 20);
} else
ieee80211_queue_delayed_work(hw, &priv->led_on, 0);
}
}
static int rtl8187_register_led(struct ieee80211_hw *dev,
struct rtl8187_led *led, const char *name,
const char *default_trigger, u8 ledpin,
bool is_radio)
{
int err;
struct rtl8187_priv *priv = dev->priv;
if (led->dev)
return -EEXIST;
if (!default_trigger)
return -EINVAL;
led->dev = dev;
led->ledpin = ledpin;
led->is_radio = is_radio;
strscpy(led->name, name, sizeof(led->name));
led->led_dev.name = led->name;
led->led_dev.default_trigger = default_trigger;
led->led_dev.brightness_set = rtl8187_led_brightness_set;
err = led_classdev_register(&priv->udev->dev, &led->led_dev);
if (err) {
printk(KERN_INFO "LEDs: Failed to register %s\n", name);
led->dev = NULL;
return err;
}
return 0;
}
static void rtl8187_unregister_led(struct rtl8187_led *led)
{
struct ieee80211_hw *hw = led->dev;
struct rtl8187_priv *priv = hw->priv;
led_classdev_unregister(&led->led_dev);
flush_delayed_work(&priv->led_off);
led->dev = NULL;
}
void rtl8187_leds_init(struct ieee80211_hw *dev, u16 custid)
{
struct rtl8187_priv *priv = dev->priv;
char name[RTL8187_LED_MAX_NAME_LEN + 1];
u8 ledpin;
int err;
/* According to the vendor driver, the LED operation depends on the
* customer ID encoded in the EEPROM
*/
printk(KERN_INFO "rtl8187: Customer ID is 0x%02X\n", custid);
switch (custid) {
case EEPROM_CID_RSVD0:
case EEPROM_CID_RSVD1:
case EEPROM_CID_SERCOMM_PS:
case EEPROM_CID_QMI:
case EEPROM_CID_DELL:
case EEPROM_CID_TOSHIBA:
ledpin = LED_PIN_GPIO0;
break;
case EEPROM_CID_ALPHA0:
ledpin = LED_PIN_LED0;
break;
case EEPROM_CID_HW:
ledpin = LED_PIN_HW;
break;
default:
ledpin = LED_PIN_GPIO0;
}
INIT_DELAYED_WORK(&priv->led_on, led_turn_on);
Annotation
- Immediate include surface: `net/mac80211.h`, `linux/usb.h`, `linux/eeprom_93cx6.h`, `rtl8187.h`, `leds.h`.
- Detected declarations: `function Copyright`, `function led_turn_off`, `function rtl8187_led_brightness_set`, `function rtl8187_register_led`, `function rtl8187_unregister_led`, `function rtl8187_leds_init`, `function rtl8187_leds_exit`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.