mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 23:07:18 +00:00
[module] add logging for kvmfr_pci_probe
This commit is contained in:
parent
4f4cf2be7d
commit
063a859de1
@ -346,13 +346,22 @@ static int kvmfr_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
|||||||
|
|
||||||
kdev = kzalloc(sizeof(struct kvmfr_dev), GFP_KERNEL);
|
kdev = kzalloc(sizeof(struct kvmfr_dev), GFP_KERNEL);
|
||||||
if (!kdev)
|
if (!kdev)
|
||||||
|
{
|
||||||
|
printk(KERN_INFO "kvmfr: kvmfr_pci_probe: failed to allocate memory!\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
if (pci_enable_device(dev))
|
if (pci_enable_device(dev))
|
||||||
|
{
|
||||||
|
printk(KERN_INFO "kvmfr: kvmfr_pci_probe: failed to enable device!\n");
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
}
|
||||||
|
|
||||||
if (pci_request_regions(dev, KVMFR_DEV_NAME))
|
if (pci_request_regions(dev, KVMFR_DEV_NAME))
|
||||||
|
{
|
||||||
|
printk(KERN_INFO "kvmfr: kvmfr_pci_probe: failed to request regions!\n");
|
||||||
goto out_disable;
|
goto out_disable;
|
||||||
|
}
|
||||||
|
|
||||||
kdev->size = pci_resource_len(dev, 2);
|
kdev->size = pci_resource_len(dev, 2);
|
||||||
kdev->type = KVMFR_TYPE_PCI;
|
kdev->type = KVMFR_TYPE_PCI;
|
||||||
@ -361,6 +370,7 @@ static int kvmfr_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
|||||||
kdev->minor = idr_alloc(&kvmfr_idr, kdev, 0, KVMFR_MAX_DEVICES, GFP_KERNEL);
|
kdev->minor = idr_alloc(&kvmfr_idr, kdev, 0, KVMFR_MAX_DEVICES, GFP_KERNEL);
|
||||||
if (kdev->minor < 0)
|
if (kdev->minor < 0)
|
||||||
{
|
{
|
||||||
|
printk(KERN_INFO "kvmfr: kvmfr_pci_probe: failed to allocate ID!\n");
|
||||||
mutex_unlock(&minor_lock);
|
mutex_unlock(&minor_lock);
|
||||||
goto out_release;
|
goto out_release;
|
||||||
}
|
}
|
||||||
@ -370,7 +380,13 @@ static int kvmfr_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
|||||||
kdev->pDev = device_create(kvmfr->pClass, NULL, kdev->devNo, NULL,
|
kdev->pDev = device_create(kvmfr->pClass, NULL, kdev->devNo, NULL,
|
||||||
KVMFR_DEV_NAME "%d", kdev->minor);
|
KVMFR_DEV_NAME "%d", kdev->minor);
|
||||||
if (IS_ERR(kdev->pDev))
|
if (IS_ERR(kdev->pDev))
|
||||||
|
{
|
||||||
|
printk(
|
||||||
|
KERN_INFO "kvmfr: kvmfr_pci_probe: failed to create /dev/%s%d device!\n",
|
||||||
|
KVMFR_DEV_NAME,
|
||||||
|
kdev->minor);
|
||||||
goto out_unminor;
|
goto out_unminor;
|
||||||
|
}
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
|
||||||
kdev->pgmap.res.start = pci_resource_start(dev, 2);
|
kdev->pgmap.res.start = pci_resource_start(dev, 2);
|
||||||
@ -390,9 +406,18 @@ static int kvmfr_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
|||||||
|
|
||||||
kdev->addr = devm_memremap_pages(&dev->dev, &kdev->pgmap);
|
kdev->addr = devm_memremap_pages(&dev->dev, &kdev->pgmap);
|
||||||
if (IS_ERR(kdev->addr))
|
if (IS_ERR(kdev->addr))
|
||||||
|
{
|
||||||
|
printk(
|
||||||
|
KERN_INFO "kvmfr: kvmfr_pci_probe: failed to remap pages! ret = %ld\n",
|
||||||
|
PTR_ERR(kdev->addr));
|
||||||
goto out_destroy;
|
goto out_destroy;
|
||||||
|
}
|
||||||
|
|
||||||
pci_set_drvdata(dev, kdev);
|
pci_set_drvdata(dev, kdev);
|
||||||
|
printk(
|
||||||
|
KERN_INFO "kvmfr: kvmfr_pci_probe: /dev/%s%d created\n",
|
||||||
|
KVMFR_DEV_NAME,
|
||||||
|
kdev->minor);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_destroy:
|
out_destroy:
|
||||||
|
Loading…
Reference in New Issue
Block a user