On Friday 07 November 2008 22:07:11 Matthew Wilcox wrote: > On Thu, Nov 06, 2008 at 04:21:11PM +0800, Sheng Yang wrote: > > Hi Jesse/Matthew > > > > Here is v2 of this patchset. The mainly change is I addressed comments > > from Matthew to avoid a megafunction to handle all. Though now logic is a > > little duplicate, I think it's clear and safe. > > I think we can redeuce the amount of duplicate logic this way: Yes, that's much clean. I would update the patchset, as well as modified the "u8 *". -- regards Yang, Sheng > > int pcie_flr(struct pci_dev *pdev, int probe) > { > u16 status; > u32 cap; > int exppos = pci_find_capability(dev, PCI_CAP_ID_EXP); > > if (!exppos) > return -ENOTTY; > pci_read_config_dword(dev, exppos + PCI_EXP_DEVCAP, &cap); > if (!(cap & PCI_EXP_DEVCAP_FLR)) > return -ENOTTY; > > if (probe) > return 0; > > pci_block_user_cfg_access(dev); > > [...] > } > > static int __pci_reset_function(struct pci_dev *pdev, int probe) > { > int res; > > res = pcie_flr(pdev, probe); > if (res != -ENOTTY) > return res; > > res = pci_af_flr(pdev, probe); > if (res != -ENOTTY) > return res; > > if (pdev->driver && pdev->driver->reset) { > if (probe) > return 0; > res = pdev->driver->reset(pdev); > } > > return res; > } > > int pci_execute_reset_function(struct pci_dev *dev) > { > return __pci_reset_function(dev, 0); > } > > int pci_reset_function(struct pci_dev *dev) > { > int res = __pci_reset_function(dev, 1); > if (res < 0) > return res; > > [... disable_irq ...] > > res = pci_execute_reset_function(dev); > > [... enable irq ...] > > return res; > } -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html