drivers/net/wireless/intel/ipw2x00/libipw_geo.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/ipw2x00/libipw_geo.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/ipw2x00/libipw_geo.c- Extension
.c- Size
- 4774 bytes
- Lines
- 180
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/compiler.hlinux/errno.hlinux/if_arp.hlinux/in6.hlinux/in.hlinux/ip.hlinux/kernel.hlinux/module.hlinux/netdevice.hlinux/proc_fs.hlinux/skbuff.hlinux/tcp.hlinux/types.hlinux/wireless.hlinux/etherdevice.hlinux/uaccess.hlibipw.h
Detected Declarations
function Copyrightfunction libipw_channel_to_indexfunction libipw_channel_to_freqfunction libipw_freq_to_channelfunction libipw_set_geofunction libipw_get_channel_flagsexport libipw_get_channelexport libipw_get_channel_flagsexport libipw_is_valid_channelexport libipw_freq_to_channelexport libipw_channel_to_freqexport libipw_channel_to_indexexport libipw_set_geoexport libipw_get_geo
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/******************************************************************************
Copyright(c) 2005 Intel Corporation. All rights reserved.
Contact Information:
Intel Linux Wireless <ilw@linux.intel.com>
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
******************************************************************************/
#include <linux/compiler.h>
#include <linux/errno.h>
#include <linux/if_arp.h>
#include <linux/in6.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/proc_fs.h>
#include <linux/skbuff.h>
#include <linux/tcp.h>
#include <linux/types.h>
#include <linux/wireless.h>
#include <linux/etherdevice.h>
#include <linux/uaccess.h>
#include "libipw.h"
int libipw_is_valid_channel(struct libipw_device *ieee, u8 channel)
{
int i;
/* Driver needs to initialize the geography map before using
* these helper functions */
if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0)
return 0;
if (ieee->freq_band & LIBIPW_24GHZ_BAND)
for (i = 0; i < ieee->geo.bg_channels; i++)
/* NOTE: If G mode is currently supported but
* this is a B only channel, we don't see it
* as valid. */
if ((ieee->geo.bg[i].channel == channel) &&
!(ieee->geo.bg[i].flags & LIBIPW_CH_INVALID) &&
(!(ieee->mode & IEEE_G) ||
!(ieee->geo.bg[i].flags & LIBIPW_CH_B_ONLY)))
return LIBIPW_24GHZ_BAND;
if (ieee->freq_band & LIBIPW_52GHZ_BAND)
for (i = 0; i < ieee->geo.a_channels; i++)
if ((ieee->geo.a[i].channel == channel) &&
!(ieee->geo.a[i].flags & LIBIPW_CH_INVALID))
return LIBIPW_52GHZ_BAND;
return 0;
}
int libipw_channel_to_index(struct libipw_device *ieee, u8 channel)
{
int i;
/* Driver needs to initialize the geography map before using
* these helper functions */
if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0)
return -1;
if (ieee->freq_band & LIBIPW_24GHZ_BAND)
for (i = 0; i < ieee->geo.bg_channels; i++)
if (ieee->geo.bg[i].channel == channel)
return i;
if (ieee->freq_band & LIBIPW_52GHZ_BAND)
for (i = 0; i < ieee->geo.a_channels; i++)
if (ieee->geo.a[i].channel == channel)
return i;
return -1;
}
u32 libipw_channel_to_freq(struct libipw_device * ieee, u8 channel)
{
const struct libipw_channel * ch;
/* Driver needs to initialize the geography map before using
* these helper functions */
if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0)
return 0;
Annotation
- Immediate include surface: `linux/compiler.h`, `linux/errno.h`, `linux/if_arp.h`, `linux/in6.h`, `linux/in.h`, `linux/ip.h`, `linux/kernel.h`, `linux/module.h`.
- Detected declarations: `function Copyright`, `function libipw_channel_to_index`, `function libipw_channel_to_freq`, `function libipw_freq_to_channel`, `function libipw_set_geo`, `function libipw_get_channel_flags`, `export libipw_get_channel`, `export libipw_get_channel_flags`, `export libipw_is_valid_channel`, `export libipw_freq_to_channel`.
- 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.