Re: [PATCH 14/14] cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards
From: Andrew Donnellan <hidden>
Date: 2016-07-07 06:44:58
On 07/07/16 16:26, Ian Munsie wrote:
We could probably use a dedicated error label for all the error paths before the pci_dev_put in the main function so we don't need it in every error path.
Yep, I've added that.
If we explicitly match the Vendor + Device ID we will also match the networking functions, which we can't do, because before the mode switch there *IS* a CAPI VSEC in one of the networking functions and our driver would mistake it as a generic accelerator and try to initialise it. We could add a comment to this effect to the PCI ID table.
We can match the vendor, device ID *and* class code - unfortunately there isn't a macro for this, which makes it a little bit less aesthetically pleasing, but I'm pretty sure this works. I'm not entirely sure how I feel about our current strategy of matching on all class 1200 devices (though if it weren't a CAPI device we'd bail very quickly...) - my quick grepping tells me we're one of a very small set of drivers in the kernel that uses PCI_DEVICE_CLASS. -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnellan@au1.ibm.com IBM Australia Limited