From 694625c0b322905d6892fad873029f764cd4823f Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Mon, 9 Jul 2007 11:55:54 -0700 Subject: PCI: add pci_try_set_mwi As suggested by Andrew, add pci_try_set_mwi(), which does not require return-value checking. - add pci_try_set_mwi() without __must_check - make it return 0 on success, errno if the "try" failed or error - review callers Signed-off-by: Randy Dunlap Cc: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pci.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'drivers/pci/pci.c') diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index d9fc1bd1f3e..35fa30aa306 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1186,6 +1186,11 @@ int pci_set_mwi(struct pci_dev *dev) return 0; } +int pci_try_set_mwi(struct pci_dev *dev) +{ + return 0; +} + void pci_clear_mwi(struct pci_dev *dev) { } @@ -1242,9 +1247,7 @@ pci_set_cacheline_size(struct pci_dev *dev) * pci_set_mwi - enables memory-write-invalidate PCI transaction * @dev: the PCI device for which MWI is enabled * - * Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND, - * and then calls @pcibios_set_mwi to do the needed arch specific - * operations or a generic mwi-prep function. + * Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND. * * RETURNS: An appropriate -ERRNO error value on error, or zero for success. */ @@ -1260,7 +1263,8 @@ pci_set_mwi(struct pci_dev *dev) pci_read_config_word(dev, PCI_COMMAND, &cmd); if (! (cmd & PCI_COMMAND_INVALIDATE)) { - pr_debug("PCI: Enabling Mem-Wr-Inval for device %s\n", pci_name(dev)); + pr_debug("PCI: Enabling Mem-Wr-Inval for device %s\n", + pci_name(dev)); cmd |= PCI_COMMAND_INVALIDATE; pci_write_config_word(dev, PCI_COMMAND, cmd); } @@ -1268,6 +1272,21 @@ pci_set_mwi(struct pci_dev *dev) return 0; } +/** + * pci_try_set_mwi - enables memory-write-invalidate PCI transaction + * @dev: the PCI device for which MWI is enabled + * + * Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND. + * Callers are not required to check the return value. + * + * RETURNS: An appropriate -ERRNO error value on error, or zero for success. + */ +int pci_try_set_mwi(struct pci_dev *dev) +{ + int rc = pci_set_mwi(dev); + return rc; +} + /** * pci_clear_mwi - disables Memory-Write-Invalidate for device dev * @dev: the PCI device to disable @@ -1600,6 +1619,7 @@ EXPORT_SYMBOL(pci_release_selected_regions); EXPORT_SYMBOL(pci_request_selected_regions); EXPORT_SYMBOL(pci_set_master); EXPORT_SYMBOL(pci_set_mwi); +EXPORT_SYMBOL(pci_try_set_mwi); EXPORT_SYMBOL(pci_clear_mwi); EXPORT_SYMBOL_GPL(pci_intx); EXPORT_SYMBOL(pci_set_dma_mask); -- cgit v1.2.3