drivers/accessibility/speakup/devsynth.c

Source file repositories/reference/linux-study-clean/drivers/accessibility/speakup/devsynth.c

File Facts

System
Linux kernel
Corpus path
drivers/accessibility/speakup/devsynth.c
Extension
.c
Size
4055 bytes
Lines
179
Domain
Driver Families
Bucket
drivers/accessibility
Inferred role
Driver Families: operation-table or driver-model contract
Status
pattern 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.

Dependency Surface

Detected Declarations

Annotated Snippet

static const struct file_operations synth_fops = {
	.read = speakup_file_read,
	.write = speakup_file_write,
	.open = speakup_file_open,
	.release = speakup_file_release,
};

static const struct file_operations synthu_fops = {
	.read = speakup_file_read,
	.write = speakup_file_writeu,
	.open = speakup_file_open,
	.release = speakup_file_release,
};

static struct miscdevice synth_device = {
	.minor = MISC_DYNAMIC_MINOR,
	.name = "synth",
	.fops = &synth_fops,
};

static struct miscdevice synthu_device = {
	.minor = MISC_DYNAMIC_MINOR,
	.name = "synthu",
	.fops = &synthu_fops,
};

void speakup_register_devsynth(void)
{
	if (!synth_registered) {
		if (misc_register(&synth_device)) {
			pr_warn("Couldn't initialize miscdevice /dev/synth.\n");
		} else {
			pr_info("initialized device: /dev/synth, node (MAJOR %d, MINOR %d)\n",
				MISC_MAJOR, synth_device.minor);
			synth_registered = 1;
		}
	}
	if (!synthu_registered) {
		if (misc_register(&synthu_device)) {
			pr_warn("Couldn't initialize miscdevice /dev/synthu.\n");
		} else {
			pr_info("initialized device: /dev/synthu, node (MAJOR %d, MINOR %d)\n",
				MISC_MAJOR, synthu_device.minor);
			synthu_registered = 1;
		}
	}
}

void speakup_unregister_devsynth(void)
{
	if (synth_registered) {
		pr_info("speakup: unregistering synth device /dev/synth\n");
		misc_deregister(&synth_device);
		synth_registered = 0;
	}
	if (synthu_registered) {
		pr_info("speakup: unregistering synth device /dev/synthu\n");
		misc_deregister(&synthu_device);
		synthu_registered = 0;
	}
}

Annotation

Implementation Notes