drivers/usb/atm/cxacru.c
Source file repositories/reference/linux-study-clean/drivers/usb/atm/cxacru.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/atm/cxacru.c- Extension
.c- Size
- 39459 bytes
- Lines
- 1386
- Domain
- Driver Families
- Bucket
- drivers/usb
- 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.
- 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/module.hlinux/moduleparam.hlinux/kernel.hlinux/timer.hlinux/errno.hlinux/slab.hlinux/device.hlinux/firmware.hlinux/mutex.hlinux/unaligned.husbatm.h
Detected Declarations
struct cxacru_modem_typestruct cxacru_datastruct cxacru_timerenum cxacru_fw_requestenum cxacru_cm_requestenum cxacru_cm_flashenum cxacru_cm_statusenum cxacru_info_idxenum cxacru_poll_statefunction cxacru_sysfs_showattr_u32function cxacru_sysfs_showattr_s8function cxacru_sysfs_showattr_dBfunction cxacru_sysfs_showattr_boolfunction cxacru_sysfs_showattr_LINKfunction cxacru_sysfs_showattr_LINEfunction cxacru_sysfs_showattr_MODUfunction mac_address_showfunction adsl_state_showfunction adsl_state_storefunction adsl_config_storefunction cxacru_blocking_completionfunction cxacru_timeout_killfunction cxacru_start_wait_urbfunction cxacru_cmfunction cxacru_cm_get_arrayfunction cxacru_card_statusfunction cxacru_atm_startfunction cxacru_poll_statusfunction cxacru_fwfunction cxacru_find_firmwarefunction cxacru_heavy_initfunction cxacru_bindfunction cxacru_unbindfunction cxacru_usb_probe
Annotated Snippet
struct cxacru_modem_type {
u32 pll_f_clk;
u32 pll_b_clk;
int boot_rom_patch;
};
struct cxacru_data {
struct usbatm_data *usbatm;
const struct cxacru_modem_type *modem_type;
int line_status;
struct mutex adsl_state_serialize;
int adsl_status;
struct delayed_work poll_work;
u32 card_info[CXINF_MAX];
struct mutex poll_state_serialize;
enum cxacru_poll_state poll_state;
/* control handles */
struct mutex cm_serialize;
u8 *rcv_buf;
u8 *snd_buf;
struct urb *rcv_urb;
struct urb *snd_urb;
struct completion rcv_done;
struct completion snd_done;
};
static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm,
u8 *wdata, int wsize, u8 *rdata, int rsize);
static void cxacru_poll_status(struct work_struct *work);
/* Card info exported through sysfs */
#define CXACRU__ATTR_INIT(_name) \
static DEVICE_ATTR_RO(_name)
#define CXACRU_CMD_INIT(_name) \
static DEVICE_ATTR_RW(_name)
#define CXACRU_SET_INIT(_name) \
static DEVICE_ATTR_WO(_name)
#define CXACRU_ATTR_INIT(_value, _type, _name) \
static ssize_t _name##_show(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct cxacru_data *instance = to_usbatm_driver_data(\
to_usb_interface(dev)); \
\
if (instance == NULL) \
return -ENODEV; \
\
return cxacru_sysfs_showattr_##_type(instance->card_info[_value], buf); \
} \
CXACRU__ATTR_INIT(_name)
#define CXACRU_ATTR_CREATE(_v, _t, _name) CXACRU_DEVICE_CREATE_FILE(_name)
#define CXACRU_CMD_CREATE(_name) CXACRU_DEVICE_CREATE_FILE(_name)
#define CXACRU_SET_CREATE(_name) CXACRU_DEVICE_CREATE_FILE(_name)
#define CXACRU__ATTR_CREATE(_name) CXACRU_DEVICE_CREATE_FILE(_name)
#define CXACRU_ATTR_REMOVE(_v, _t, _name) CXACRU_DEVICE_REMOVE_FILE(_name)
#define CXACRU_CMD_REMOVE(_name) CXACRU_DEVICE_REMOVE_FILE(_name)
#define CXACRU_SET_REMOVE(_name) CXACRU_DEVICE_REMOVE_FILE(_name)
#define CXACRU__ATTR_REMOVE(_name) CXACRU_DEVICE_REMOVE_FILE(_name)
static ssize_t cxacru_sysfs_showattr_u32(u32 value, char *buf)
{
return sprintf(buf, "%u\n", value);
}
static ssize_t cxacru_sysfs_showattr_s8(s8 value, char *buf)
{
return sprintf(buf, "%d\n", value);
}
static ssize_t cxacru_sysfs_showattr_dB(s16 value, char *buf)
{
if (likely(value >= 0)) {
return snprintf(buf, PAGE_SIZE, "%u.%02u\n",
value / 100, value % 100);
} else {
value = -value;
return snprintf(buf, PAGE_SIZE, "-%u.%02u\n",
value / 100, value % 100);
}
}
static ssize_t cxacru_sysfs_showattr_bool(u32 value, char *buf)
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/kernel.h`, `linux/timer.h`, `linux/errno.h`, `linux/slab.h`, `linux/device.h`, `linux/firmware.h`.
- Detected declarations: `struct cxacru_modem_type`, `struct cxacru_data`, `struct cxacru_timer`, `enum cxacru_fw_request`, `enum cxacru_cm_request`, `enum cxacru_cm_flash`, `enum cxacru_cm_status`, `enum cxacru_info_idx`, `enum cxacru_poll_state`, `function cxacru_sysfs_showattr_u32`.
- Atlas domain: Driver Families / drivers/usb.
- 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.