drivers/net/wireless/intersil/p54/eeprom.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intersil/p54/eeprom.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intersil/p54/eeprom.c- Extension
.c- Size
- 25124 bytes
- Lines
- 978
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hlinux/etherdevice.hlinux/sort.hlinux/slab.hnet/mac80211.hlinux/crc-ccitt.hlinux/export.hp54.heeprom.hlmac.h
Detected Declarations
struct p54_channel_entrystruct p54_channel_listfunction p54_get_band_from_freqfunction same_bandfunction p54_compare_channelsfunction p54_compare_rssichanfunction p54_fill_band_bitratesfunction p54_generate_bandfunction p54_get_maxpowerfunction p54_generate_channel_listsfunction p54_convert_rev0function p54_convert_rev1function p54_parse_rssicalfunction p54_parse_default_countryfunction p54_convert_output_limitsfunction p54_parse_eepromfunction p54_read_eepromexport p54_parse_eepromexport p54_read_eeprom
Annotated Snippet
struct p54_channel_entry {
u16 freq;
u16 data;
int index;
int max_power;
enum nl80211_band band;
};
struct p54_channel_list {
struct p54_channel_entry *channels;
size_t entries;
size_t max_entries;
size_t band_channel_num[NUM_NL80211_BANDS];
};
static int p54_get_band_from_freq(u16 freq)
{
/* FIXME: sync these values with the 802.11 spec */
if ((freq >= 2412) && (freq <= 2484))
return NL80211_BAND_2GHZ;
if ((freq >= 4920) && (freq <= 5825))
return NL80211_BAND_5GHZ;
return -1;
}
static int same_band(u16 freq, u16 freq2)
{
return p54_get_band_from_freq(freq) == p54_get_band_from_freq(freq2);
}
static int p54_compare_channels(const void *_a,
const void *_b)
{
const struct p54_channel_entry *a = _a;
const struct p54_channel_entry *b = _b;
return a->freq - b->freq;
}
static int p54_compare_rssichan(const void *_a,
const void *_b)
{
const struct p54_rssi_db_entry *a = _a;
const struct p54_rssi_db_entry *b = _b;
return a->freq - b->freq;
}
static int p54_fill_band_bitrates(struct ieee80211_hw *dev,
struct ieee80211_supported_band *band_entry,
enum nl80211_band band)
{
/* TODO: generate rate array dynamically */
switch (band) {
case NL80211_BAND_2GHZ:
band_entry->bitrates = p54_bgrates;
band_entry->n_bitrates = ARRAY_SIZE(p54_bgrates);
break;
case NL80211_BAND_5GHZ:
band_entry->bitrates = p54_arates;
band_entry->n_bitrates = ARRAY_SIZE(p54_arates);
break;
default:
return -EINVAL;
}
return 0;
}
static int p54_generate_band(struct ieee80211_hw *dev,
struct p54_channel_list *list,
unsigned int *chan_num,
enum nl80211_band band)
{
struct p54_common *priv = dev->priv;
struct ieee80211_supported_band *tmp, *old;
unsigned int i, j;
int ret = -ENOMEM;
if ((!list->entries) || (!list->band_channel_num[band]))
return -EINVAL;
tmp = kzalloc_obj(*tmp);
if (!tmp)
goto err_out;
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/etherdevice.h`, `linux/sort.h`, `linux/slab.h`, `net/mac80211.h`, `linux/crc-ccitt.h`, `linux/export.h`, `p54.h`.
- Detected declarations: `struct p54_channel_entry`, `struct p54_channel_list`, `function p54_get_band_from_freq`, `function same_band`, `function p54_compare_channels`, `function p54_compare_rssichan`, `function p54_fill_band_bitrates`, `function p54_generate_band`, `function p54_get_maxpower`, `function p54_generate_channel_lists`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
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.