Replace pci_enable_msix() with pci_alloc_irq_vectors() - #5
Replace pci_enable_msix() with pci_alloc_irq_vectors()#5andreas-rollbuehler wants to merge 2 commits into
Conversation
henning-schild
left a comment
There was a problem hiding this comment.
Thanks, i found a few minor style problems and it seems the free is missing on one path.
| #include <linux/uio_driver.h> | ||
| #include <linux/io.h> | ||
|
|
||
| #include <linux/version.h> |
There was a problem hiding this comment.
please add this right under the other includes, some people like to order them somehow but i do not care
| #else | ||
| err = pci_alloc_irq_vectors(ivs_info->dev, 1, ivs_info->nvectors, | ||
| PCI_IRQ_MSIX); | ||
|
|
There was a problem hiding this comment.
Indentation of the second line is wrong
| ivs_info->msix_entries[i].entry = i; | ||
|
|
||
| #if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0) | ||
|
|
There was a problem hiding this comment.
skip the empty line
| } else { | ||
| ivs_info->nvectors = err; | ||
| } | ||
| #endif |
There was a problem hiding this comment.
I think with a bit of restructuring both the error handling and the assignment of "nvectors = err" can be reused across the two cases.
| "%s-config", name); | ||
|
|
||
| #if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0) | ||
|
|
| goto error; | ||
| } | ||
| #endif | ||
| } |
There was a problem hiding this comment.
The only real change is the first argument for request_irq, right? If you factor that out all the rest can be reused in both cases instead of copying it.
Did the return value of request_irq change? Why the change from if (err) to if (err < 0)?
| #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0) | ||
| pci_free_irq_vectors(ivs_info->dev); | ||
| #endif | ||
| return err; |
There was a problem hiding this comment.
Something similar will also have to go into ivshmem_pci_remove. I think that should be called when you unbind the device from the driver or when you rmmod the module.
This patch doesn't change any functionality. It just refactors some code to make the changes in the subsequent patch easier to read. Signed-off-by: Andreas Rollbühler <andreas.rollbuehler@siemens.com>
Since kernel version 4.8. pci_enable_msix() isn't available any more. Therefore it is replaced with pci_alloc_irq_vectors() if the used kernel version is >= 4.8 Signed-off-by: Andreas Rollbühler <andreas.rollbuehler@siemens.com>
6ee195b to
14d609d
Compare
Since kernel version 4.8. pci_enable_msix() isn't available any more.
Therefore it is replaced with pci_alloc_irq_vectors() if used
kernel version is >= 4.8
Signed-off-by: Andreas Rollbühler andreas.rollbuehler@siemens.com