Re: [PATCH] Add new uio device for PCI with dynamic memory allocation

From: Stahl, Manuel
Date: Wed Oct 04 2017 - 05:39:27 EST

On Mi, 2017-10-04 at 10:59 +0300, Dan Carpenter wrote:
> On Wed, Oct 04, 2017 at 07:24:49AM +0000, Stahl, Manuel wrote:
> > Hi Dan. Thanks for your comments. I can fix all of those.
> > Probably there is also some upgrade needed for the MSI stuff.
> > pci_disable_msi() is not there anymore, so I have to use
> > pci_alloc_irq_vectors(). Doing tests with my PCIe HW I had some
> > problems with masking the legacy IRQs. Probably uio_pci_generic
> > suffers from the same problems.
> >
> > Can someone tell me how to properly handle legacy and MSI
> > interrupts in irqhandler()? Or should I implement a irqcontrol()
> > function?
> >
> These questions about above my pay grade. I've never used the code, I
> just do mechanical reviews. I'm not certain who to ask either...

Alright. I checked again your comments. Some are copy&paste from the
other drivers, but I can improve this. Some cannot be changed:

1) continue instead of break:
Actually size=0 makes no sense for the maps, so open() and release()
take this as abort condition (see also uio_dmem_genirq.c). The parser
continues in that case, but we could break there as well.

2) char * const buf = kstrdup(uio_dmem_sizes, GFP_KERNEL);
Since buf is a const pointer, it has to be set during declaration.
Also I'd like to keep it const.

I will post another patch set without MSI (just the same functionality
as in uio_pci_generic) and then try to add MSI(X) support to both.