Re: [PATCH 14/14] cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards
From: Ian Munsie <hidden>
Date: 2016-07-07 06:27:28
Excerpts from andrew.donnellan's message of 2016-07-07 11:18:37 +1000:
quoted
This is to balance the 'get' done in cxl_check_and_switch_mode(), right? A comment wouldn't hurt. I think we're missing the 'put' on the first error path above (!bridge).Yep, it's to balance the pci_dev_get() in cxl_check_and_switch_mode() - you're right, a comment to that effect wouldn't hurt. You're also right about the error path. Will fix in V2.
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.
quoted
I was half-expecting to see a new entry in the cxl_pci_tbl pci ID table for the Mellanox entry, but no such thing. By what magic is cxl_probe() called after the switch? Because of the device class?It matches against the class, as function 0 of the device after reset comes up as a class 1200 processing accelerator. Perhaps we should be a bit more explicit though...
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. Cheers, -Ian