drivers/media/radio/radio-si476x.c

Source file repositories/reference/linux-study-clean/drivers/media/radio/radio-si476x.c

File Facts

System
Linux kernel
Corpus path
drivers/media/radio/radio-si476x.c
Extension
.c
Size
39786 bytes
Lines
1524
Domain
Driver Families
Bucket
drivers/media
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 radio_acf_fops = {
	.open	= simple_open,
	.llseek = default_llseek,
	.read	= si476x_radio_read_acf_blob,
};

static ssize_t si476x_radio_read_rds_blckcnt_blob(struct file *file,
						  char __user *user_buf,
						  size_t count, loff_t *ppos)
{
	int err;
	struct si476x_radio *radio = file->private_data;
	struct si476x_rds_blockcount_report report;

	si476x_core_lock(radio->core);
	if (radio->ops->rds_blckcnt)
		err = radio->ops->rds_blckcnt(radio->core, true,
					       &report);
	else
		err = -ENOENT;
	si476x_core_unlock(radio->core);

	if (err < 0)
		return err;

	return simple_read_from_buffer(user_buf, count, ppos, &report,
				       sizeof(report));
}

static const struct file_operations radio_rds_blckcnt_fops = {
	.open	= simple_open,
	.llseek = default_llseek,
	.read	= si476x_radio_read_rds_blckcnt_blob,
};

static ssize_t si476x_radio_read_agc_blob(struct file *file,
					  char __user *user_buf,
					  size_t count, loff_t *ppos)
{
	int err;
	struct si476x_radio *radio = file->private_data;
	struct si476x_agc_status_report report;

	si476x_core_lock(radio->core);
	if (radio->ops->rds_blckcnt)
		err = radio->ops->agc_status(radio->core, &report);
	else
		err = -ENOENT;
	si476x_core_unlock(radio->core);

	if (err < 0)
		return err;

	return simple_read_from_buffer(user_buf, count, ppos, &report,
				       sizeof(report));
}

static const struct file_operations radio_agc_fops = {
	.open	= simple_open,
	.llseek = default_llseek,
	.read	= si476x_radio_read_agc_blob,
};

static ssize_t si476x_radio_read_rsq_blob(struct file *file,
					  char __user *user_buf,
					  size_t count, loff_t *ppos)
{
	int err;
	struct si476x_radio *radio = file->private_data;
	struct si476x_rsq_status_report report;
	struct si476x_rsq_status_args args = {
		.primary	= false,
		.rsqack		= false,
		.attune		= false,
		.cancel		= false,
		.stcack		= false,
	};

	si476x_core_lock(radio->core);
	if (radio->ops->rds_blckcnt)
		err = radio->ops->rsq_status(radio->core, &args, &report);
	else
		err = -ENOENT;
	si476x_core_unlock(radio->core);

	if (err < 0)
		return err;

	return simple_read_from_buffer(user_buf, count, ppos, &report,
				       sizeof(report));

Annotation

Implementation Notes