drivers/i2c/busses/i2c-pasemi-pci.c
Source file repositories/reference/linux-study-clean/drivers/i2c/busses/i2c-pasemi-pci.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/i2c/busses/i2c-pasemi-pci.c- Extension
.c- Size
- 1889 bytes
- Lines
- 87
- Domain
- Driver Families
- Bucket
- drivers/i2c
- 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.
- 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/delay.hlinux/i2c.hlinux/io.hlinux/kernel.hlinux/module.hlinux/pci.hlinux/sched.hlinux/slab.hlinux/stddef.hi2c-pasemi-core.h
Detected Declarations
function pasemi_smb_pci_probe
Annotated Snippet
static struct pci_driver pasemi_smb_pci_driver;
static int pasemi_smb_pci_probe(struct pci_dev *dev,
const struct pci_device_id *id)
{
struct pasemi_smbus *smbus;
unsigned long base;
int size;
int error;
if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO))
return -ENODEV;
smbus = devm_kzalloc(&dev->dev, sizeof(*smbus), GFP_KERNEL);
if (!smbus)
return -ENOMEM;
smbus->dev = &dev->dev;
base = pci_resource_start(dev, 0);
size = pci_resource_len(dev, 0);
smbus->clk_div = CLK_100K_DIV;
/*
* The original PASemi PCI controllers don't have a register for
* their HW revision.
*/
smbus->hw_rev = PASEMI_HW_REV_PCI;
if (!devm_request_region(&dev->dev, base, size,
pasemi_smb_pci_driver.name))
return -EBUSY;
smbus->ioaddr = pcim_iomap(dev, 0, 0);
if (!smbus->ioaddr)
return -EBUSY;
smbus->adapter.class = I2C_CLASS_HWMON;
error = pasemi_i2c_common_probe(smbus);
if (error)
return error;
pci_set_drvdata(dev, smbus);
return 0;
}
static const struct pci_device_id pasemi_smb_pci_ids[] = {
{ PCI_DEVICE(0x1959, 0xa003) },
{ 0, }
};
MODULE_DEVICE_TABLE(pci, pasemi_smb_pci_ids);
static struct pci_driver pasemi_smb_pci_driver = {
.name = "i2c-pasemi",
.id_table = pasemi_smb_pci_ids,
.probe = pasemi_smb_pci_probe,
};
module_pci_driver(pasemi_smb_pci_driver);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Olof Johansson <olof@lixom.net>");
MODULE_DESCRIPTION("PA Semi PWRficient SMBus driver");
Annotation
- Immediate include surface: `linux/delay.h`, `linux/i2c.h`, `linux/io.h`, `linux/kernel.h`, `linux/module.h`, `linux/pci.h`, `linux/sched.h`, `linux/slab.h`.
- Detected declarations: `function pasemi_smb_pci_probe`.
- Atlas domain: Driver Families / drivers/i2c.
- Implementation status: pattern 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.