Browse Source

Change API

Previous API is deprecated and cannot be compiled for newer version of
kernel.
master
Ali Hatami Tajik 2 years ago
parent
commit
105ba12eaf
  1. 31
      sonoPciDrv.c

31
sonoPciDrv.c

@ -5,6 +5,7 @@
/*************************************************************************************************/
MODULE_AUTHOR("h4ndh"); //hessamoddin hediyehloo
MODULE_AUTHOR("alihatamitajik");
MODULE_LICENSE("Dual BSD/GPL");
/*************************************************************************************************/
@ -85,20 +86,18 @@ static struct pci_driver pci_driver =
};
/*************************************************************************************************/
static struct file_operations bar_fops =
static struct proc_ops bar_ops =
{
.owner = THIS_MODULE,
.open = sono_bar_open,
.release = sono_bar_close,
.mmap = sono_bar_mmap
.proc_open = sono_bar_open,
.proc_release = sono_bar_close,
.proc_mmap = sono_bar_mmap
};
static struct file_operations buffer_fops =
static struct proc_ops buffer_ops =
{
.owner = THIS_MODULE,
.open = sono_buffer_open,
.release = sono_buffer_close,
.mmap = sono_buffer_mmap
.proc_open = sono_buffer_open,
.proc_release = sono_buffer_close,
.proc_mmap = sono_buffer_mmap
};
/*************************************************************************************************/
@ -135,8 +134,8 @@ static int proc_init(void)
{
PRINT_ALERT("proc_init");
proc_create("sono_bars", 0, NULL, &bar_fops);
proc_create("sono_buffers", 0, NULL, &buffer_fops);
proc_create("sono_bars", 0, NULL, &bar_ops);
proc_create("sono_buffers", 0, NULL, &buffer_ops);
return 0;
}
@ -256,9 +255,9 @@ static int __init pcie_probe (struct pci_dev *dev, const struct pci_device_id *i
goto probe_fail_enable;
}
if (!pci_set_dma_mask(pcidev, DMA_BIT_MASK(64)))
if (!dma_set_mask(&pcidev->dev, DMA_BIT_MASK(64)))
{
if (pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(64)))
if (dma_set_coherent_mask(&pcidev->dev, DMA_BIT_MASK(64)))
{
printk(KERN_ERR "Unable to obtain 64bit DMA for consistent allocations\n");
rc = 1;
@ -275,8 +274,8 @@ static int __init pcie_probe (struct pci_dev *dev, const struct pci_device_id *i
goto probe_fail;
}
int i = 0;
for(; i < TOTAL_BAR_NUM; i++)
for(int i = 0; i < TOTAL_BAR_NUM; i++)
{
bars[i].flags = pci_resource_flags(pcidev, i);
if (!(bars[i].flags & IORESOURCE_MEM)) {

Loading…
Cancel
Save