drivers/input/misc/ati_remote2.c
Source file repositories/reference/linux-study-clean/drivers/input/misc/ati_remote2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/misc/ati_remote2.c- Extension
.c- Size
- 23683 bytes
- Lines
- 1001
- Domain
- Driver Families
- Bucket
- drivers/input
- 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/usb/input.hlinux/slab.hlinux/module.h
Detected Declarations
struct ati_remote2function ati_remote2_set_maskfunction ati_remote2_set_channel_maskfunction ati_remote2_get_channel_maskfunction ati_remote2_set_mode_maskfunction ati_remote2_get_mode_maskfunction ati_remote2_submit_urbsfunction ati_remote2_kill_urbsfunction ati_remote2_openfunction scoped_guardfunction ati_remote2_closefunction ati_remote2_input_mousefunction ati_remote2_lookupfunction ati_remote2_input_keyfunction ati_remote2_complete_mousefunction ati_remote2_complete_keyfunction ati_remote2_getkeycodefunction ati_remote2_setkeycodefunction ati_remote2_input_initfunction ati_remote2_urb_initfunction ati_remote2_urb_cleanupfunction ati_remote2_setupfunction ati_remote2_show_channel_maskfunction ati_remote2_store_channel_maskfunction scoped_guardfunction ati_remote2_show_mode_maskfunction ati_remote2_store_mode_maskfunction ati_remote2_probefunction ati_remote2_disconnectfunction ati_remote2_suspendfunction ati_remote2_resumefunction ati_remote2_reset_resumefunction ati_remote2_pre_resetfunction ati_remote2_post_reset
Annotated Snippet
struct ati_remote2 {
struct input_dev *idev;
struct usb_device *udev;
struct usb_interface *intf[2];
struct usb_endpoint_descriptor *ep[2];
struct urb *urb[2];
void *buf[2];
dma_addr_t buf_dma[2];
unsigned long jiffies;
int mode;
char name[64];
char phys[64];
/* Each mode (AUX1-AUX4 and PC) can have an independent keymap. */
u16 keycode[ATI_REMOTE2_MODES][ARRAY_SIZE(ati_remote2_key_table)];
unsigned int flags;
unsigned int channel_mask;
unsigned int mode_mask;
};
static struct usb_driver ati_remote2_driver;
static int ati_remote2_submit_urbs(struct ati_remote2 *ar2)
{
int r;
r = usb_submit_urb(ar2->urb[0], GFP_KERNEL);
if (r) {
dev_err(&ar2->intf[0]->dev,
"%s(): usb_submit_urb() = %d\n", __func__, r);
return r;
}
r = usb_submit_urb(ar2->urb[1], GFP_KERNEL);
if (r) {
usb_kill_urb(ar2->urb[0]);
dev_err(&ar2->intf[1]->dev,
"%s(): usb_submit_urb() = %d\n", __func__, r);
return r;
}
return 0;
}
static void ati_remote2_kill_urbs(struct ati_remote2 *ar2)
{
usb_kill_urb(ar2->urb[1]);
usb_kill_urb(ar2->urb[0]);
}
static int ati_remote2_open(struct input_dev *idev)
{
struct ati_remote2 *ar2 = input_get_drvdata(idev);
int r;
dev_dbg(&ar2->intf[0]->dev, "%s()\n", __func__);
r = usb_autopm_get_interface(ar2->intf[0]);
if (r) {
dev_err(&ar2->intf[0]->dev,
"%s(): usb_autopm_get_interface() = %d\n", __func__, r);
return r;
}
scoped_guard(mutex, &ati_remote2_mutex) {
if (!(ar2->flags & ATI_REMOTE2_SUSPENDED)) {
r = ati_remote2_submit_urbs(ar2);
if (r)
break;
}
ar2->flags |= ATI_REMOTE2_OPENED;
}
usb_autopm_put_interface(ar2->intf[0]);
return r;
}
static void ati_remote2_close(struct input_dev *idev)
{
struct ati_remote2 *ar2 = input_get_drvdata(idev);
dev_dbg(&ar2->intf[0]->dev, "%s()\n", __func__);
guard(mutex)(&ati_remote2_mutex);
Annotation
- Immediate include surface: `linux/usb/input.h`, `linux/slab.h`, `linux/module.h`.
- Detected declarations: `struct ati_remote2`, `function ati_remote2_set_mask`, `function ati_remote2_set_channel_mask`, `function ati_remote2_get_channel_mask`, `function ati_remote2_set_mode_mask`, `function ati_remote2_get_mode_mask`, `function ati_remote2_submit_urbs`, `function ati_remote2_kill_urbs`, `function ati_remote2_open`, `function scoped_guard`.
- Atlas domain: Driver Families / drivers/input.
- 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.