aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorRandy Dunlap <randy.dunlap@oracle.com>2007-07-09 14:55:54 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:02:11 -0400
commit694625c0b322905d6892fad873029f764cd4823f (patch)
treec48ac2c0095f2ac4044bd12b27ea318eb6156c73 /drivers/pci
parentf5609d7e679db3f29433f56e1f2e397a2f815288 (diff)
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 <randy.dunlap@oracle.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index d9fc1bd1f3e8..35fa30aa3065 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1186,6 +1186,11 @@ int pci_set_mwi(struct pci_dev *dev)
1186 return 0; 1186 return 0;
1187} 1187}
1188 1188
1189int pci_try_set_mwi(struct pci_dev *dev)
1190{
1191 return 0;
1192}
1193
1189void pci_clear_mwi(struct pci_dev *dev) 1194void pci_clear_mwi(struct pci_dev *dev)
1190{ 1195{
1191} 1196}
@@ -1242,9 +1247,7 @@ pci_set_cacheline_size(struct pci_dev *dev)
1242 * pci_set_mwi - enables memory-write-invalidate PCI transaction 1247 * pci_set_mwi - enables memory-write-invalidate PCI transaction
1243 * @dev: the PCI device for which MWI is enabled 1248 * @dev: the PCI device for which MWI is enabled
1244 * 1249 *
1245 * Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND, 1250 * Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND.
1246 * and then calls @pcibios_set_mwi to do the needed arch specific
1247 * operations or a generic mwi-prep function.
1248 * 1251 *
1249 * RETURNS: An appropriate -ERRNO error value on error, or zero for success. 1252 * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
1250 */ 1253 */
@@ -1260,7 +1263,8 @@ pci_set_mwi(struct pci_dev *dev)
1260 1263
1261 pci_read_config_word(dev, PCI_COMMAND, &cmd); 1264 pci_read_config_word(dev, PCI_COMMAND, &cmd);
1262 if (! (cmd & PCI_COMMAND_INVALIDATE)) { 1265 if (! (cmd & PCI_COMMAND_INVALIDATE)) {
1263 pr_debug("PCI: Enabling Mem-Wr-Inval for device %s\n", pci_name(dev)); 1266 pr_debug("PCI: Enabling Mem-Wr-Inval for device %s\n",
1267 pci_name(dev));
1264 cmd |= PCI_COMMAND_INVALIDATE; 1268 cmd |= PCI_COMMAND_INVALIDATE;
1265 pci_write_config_word(dev, PCI_COMMAND, cmd); 1269 pci_write_config_word(dev, PCI_COMMAND, cmd);
1266 } 1270 }
@@ -1269,6 +1273,21 @@ pci_set_mwi(struct pci_dev *dev)
1269} 1273}
1270 1274
1271/** 1275/**
1276 * pci_try_set_mwi - enables memory-write-invalidate PCI transaction
1277 * @dev: the PCI device for which MWI is enabled
1278 *
1279 * Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND.
1280 * Callers are not required to check the return value.
1281 *
1282 * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
1283 */
1284int pci_try_set_mwi(struct pci_dev *dev)
1285{
1286 int rc = pci_set_mwi(dev);
1287 return rc;
1288}
1289
1290/**
1272 * pci_clear_mwi - disables Memory-Write-Invalidate for device dev 1291 * pci_clear_mwi - disables Memory-Write-Invalidate for device dev
1273 * @dev: the PCI device to disable 1292 * @dev: the PCI device to disable
1274 * 1293 *
@@ -1600,6 +1619,7 @@ EXPORT_SYMBOL(pci_release_selected_regions);
1600EXPORT_SYMBOL(pci_request_selected_regions); 1619EXPORT_SYMBOL(pci_request_selected_regions);
1601EXPORT_SYMBOL(pci_set_master); 1620EXPORT_SYMBOL(pci_set_master);
1602EXPORT_SYMBOL(pci_set_mwi); 1621EXPORT_SYMBOL(pci_set_mwi);
1622EXPORT_SYMBOL(pci_try_set_mwi);
1603EXPORT_SYMBOL(pci_clear_mwi); 1623EXPORT_SYMBOL(pci_clear_mwi);
1604EXPORT_SYMBOL_GPL(pci_intx); 1624EXPORT_SYMBOL_GPL(pci_intx);
1605EXPORT_SYMBOL(pci_set_dma_mask); 1625EXPORT_SYMBOL(pci_set_dma_mask);