drivers/media/pci/mantis/mantis_pci.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/mantis/mantis_pci.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/mantis/mantis_pci.c- Extension
.c- Size
- 3599 bytes
- Lines
- 157
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/module.hlinux/moduleparam.hlinux/kernel.hasm/io.hasm/page.hlinux/kmod.hlinux/vmalloc.hlinux/init.hlinux/device.hlinux/pci.hasm/irq.hlinux/signal.hlinux/sched.hlinux/interrupt.hmedia/dmxdev.hmedia/dvbdev.hmedia/dvb_demux.hmedia/dvb_frontend.hmedia/dvb_net.hmantis_common.hmantis_reg.hmantis_pci.h
Detected Declarations
function Copyrightfunction mantis_pci_exitexport mantis_pci_initexport mantis_pci_exit
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
Mantis PCI bridge driver
Copyright (C) Manu Abraham (abraham.manu@gmail.com)
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <asm/io.h>
#include <asm/page.h>
#include <linux/kmod.h>
#include <linux/vmalloc.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/pci.h>
#include <asm/irq.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <media/dmxdev.h>
#include <media/dvbdev.h>
#include <media/dvb_demux.h>
#include <media/dvb_frontend.h>
#include <media/dvb_net.h>
#include "mantis_common.h"
#include "mantis_reg.h"
#include "mantis_pci.h"
#define DRIVER_NAME "Mantis Core"
int mantis_pci_init(struct mantis_pci *mantis)
{
u8 latency;
struct mantis_hwconfig *config = mantis->hwconfig;
struct pci_dev *pdev = mantis->pdev;
int err, ret = 0;
dprintk(MANTIS_ERROR, 0, "found a %s PCI %s device on (%02x:%02x.%x),\n",
config->model_name,
config->dev_type,
mantis->pdev->bus->number,
PCI_SLOT(mantis->pdev->devfn),
PCI_FUNC(mantis->pdev->devfn));
err = pci_enable_device(pdev);
if (err != 0) {
ret = -ENODEV;
dprintk(MANTIS_ERROR, 1, "ERROR: PCI enable failed <%i>", err);
goto fail0;
}
err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
if (err != 0) {
dprintk(MANTIS_ERROR, 1, "ERROR: Unable to obtain 32 bit DMA <%i>", err);
ret = -ENOMEM;
goto fail1;
}
pci_set_master(pdev);
if (!request_mem_region(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0),
DRIVER_NAME)) {
dprintk(MANTIS_ERROR, 1, "ERROR: BAR0 Request failed !");
ret = -ENODEV;
goto fail1;
}
mantis->mmio = ioremap(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
if (!mantis->mmio) {
dprintk(MANTIS_ERROR, 1, "ERROR: BAR0 remap failed !");
ret = -ENODEV;
goto fail2;
}
pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency);
mantis->latency = latency;
mantis->revision = pdev->revision;
dprintk(MANTIS_ERROR, 0, " Mantis Rev %d [%04x:%04x], ",
mantis->revision,
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/kernel.h`, `asm/io.h`, `asm/page.h`, `linux/kmod.h`, `linux/vmalloc.h`, `linux/init.h`.
- Detected declarations: `function Copyright`, `function mantis_pci_exit`, `export mantis_pci_init`, `export mantis_pci_exit`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.