drivers/iio/industrialio-acpi.c
Source file repositories/reference/linux-study-clean/drivers/iio/industrialio-acpi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/industrialio-acpi.c- Extension
.c- Size
- 3734 bytes
- Lines
- 126
- Domain
- Driver Families
- Bucket
- drivers/iio
- 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/acpi.hlinux/device.hlinux/export.hlinux/iio/iio.hlinux/sprintf.h
Detected Declarations
function iio_read_acpi_mount_matrixfunction iio_get_acpi_device_name_and_dataexport iio_read_acpi_mount_matrixexport iio_get_acpi_device_name_and_data
Annotated Snippet
if (elements[i].type != ACPI_TYPE_STRING) {
dev_err(dev, "Unknown ACPI mount matrix element format\n");
goto out_free_buffer;
}
str = elements[i].string.pointer;
if (sscanf(str, "%d %d %d", &val[0], &val[1], &val[2]) != 3) {
dev_err(dev, "Incorrect ACPI mount matrix string format\n");
goto out_free_buffer;
}
for (j = 0; j < 3; j++) {
switch (val[j]) {
case -1: str = "-1"; break;
case 0: str = "0"; break;
case 1: str = "1"; break;
default:
dev_err(dev, "Invalid value in ACPI mount matrix: %d\n", val[j]);
goto out_free_buffer;
}
orientation->rotation[i * 3 + j] = str;
}
}
ret = true;
out_free_buffer:
kfree(buffer.pointer);
return ret;
}
EXPORT_SYMBOL_GPL(iio_read_acpi_mount_matrix);
/**
* iio_get_acpi_device_name_and_data() - Return ACPI device instance name and driver data
* @dev: Device structure
* @data: Optional pointer to return driver data
*
* When device was enumerated by ACPI ID matching, the user might
* want to set description for the physical chip. In such cases
* the ACPI device instance name might be used. This call may be
* performed to retrieve this information.
*
* NOTE: This helper function exists only for backward compatibility,
* do not use in a new code!
*
* Returns: ACPI device instance name or %NULL.
*/
const char *iio_get_acpi_device_name_and_data(struct device *dev, const void **data)
{
const struct acpi_device_id *id;
acpi_handle handle;
handle = ACPI_HANDLE(dev);
if (!handle)
return NULL;
id = acpi_match_device(dev->driver->acpi_match_table, dev);
if (!id)
return NULL;
if (data)
*data = (const void *)id->driver_data;
return dev_name(dev);
}
EXPORT_SYMBOL_GPL(iio_get_acpi_device_name_and_data);
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/device.h`, `linux/export.h`, `linux/iio/iio.h`, `linux/sprintf.h`.
- Detected declarations: `function iio_read_acpi_mount_matrix`, `function iio_get_acpi_device_name_and_data`, `export iio_read_acpi_mount_matrix`, `export iio_get_acpi_device_name_and_data`.
- Atlas domain: Driver Families / drivers/iio.
- 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.