Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / misc / pvpanic / pvpanic-pci.c
blobb21598a18f6da81568dedb0817bf74da55f81a15
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * Pvpanic PCI Device Support
5 * Copyright (C) 2021 Oracle.
6 */
8 #include <linux/errno.h>
9 #include <linux/module.h>
10 #include <linux/pci.h>
11 #include <linux/types.h>
13 #include "pvpanic.h"
15 #define PCI_DEVICE_ID_REDHAT_PVPANIC 0x0011
17 MODULE_AUTHOR("Mihai Carabas <mihai.carabas@oracle.com>");
18 MODULE_DESCRIPTION("pvpanic device driver");
19 MODULE_LICENSE("GPL");
21 static int pvpanic_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
23 void __iomem *base;
24 int ret;
26 ret = pcim_enable_device(pdev);
27 if (ret < 0)
28 return ret;
30 base = pcim_iomap(pdev, 0, 0);
31 if (!base)
32 return -ENOMEM;
34 return devm_pvpanic_probe(&pdev->dev, base);
37 static const struct pci_device_id pvpanic_pci_id_tbl[] = {
38 { PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_PVPANIC)},
41 MODULE_DEVICE_TABLE(pci, pvpanic_pci_id_tbl);
43 static struct pci_driver pvpanic_pci_driver = {
44 .name = "pvpanic-pci",
45 .id_table = pvpanic_pci_id_tbl,
46 .probe = pvpanic_pci_probe,
47 .dev_groups = pvpanic_dev_groups,
49 module_pci_driver(pvpanic_pci_driver);