From: Matthew Wilcox <matthew@wil•cx>
To: Val Henson <val_henson@linux•intel.com>,
Greg Kroah-Hartman <gregkh@suse•de>
Cc: netdev@vger•kernel.org, linux-pci@atrey•karlin.mff.cuni.cz,
linux-kernel@vger•kernel.org, Matthew Wilcox <matthew@wil•cx>
Subject: From: Matthew Wilcox <matthew@wil•cx>
Date: Fri, 06 Oct 2006 13:01:33 -0600 [thread overview]
Message-ID: <11601612941804-git-send-email-matthew@wil.cx> (raw)
Since some devices may not implement the MWI bit, we should check that
the write did set it and return an error if it didn't.
Signed-off-by: Matthew Wilcox <matthew@wil•cx>
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a544997..3d041f4 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -900,13 +900,17 @@ #endif
return rc;
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));
- cmd |= PCI_COMMAND_INVALIDATE;
- pci_write_config_word(dev, PCI_COMMAND, cmd);
- }
-
- return 0;
+ if (cmd & PCI_COMMAND_INVALIDATE)
+ return 0;
+
+ 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);
+
+ /* read result from hardware (in case bit refused to enable) */
+ pci_read_config_word(dev, PCI_COMMAND, &cmd);
+
+ return (cmd & PCI_COMMAND_INVALIDATE) ? 0 : -EINVAL;
}
/**
next reply other threads:[~2006-10-06 19:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-06 19:01 Matthew Wilcox [this message]
2006-10-06 19:01 ` From: Matthew Wilcox <matthew@wil•cx> Matthew Wilcox
2006-10-06 19:26 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11601612941804-git-send-email-matthew@wil.cx \
--to=matthew@wil$(echo .)cx \
--cc=gregkh@suse$(echo .)de \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-pci@atrey$(echo .)karlin.mff.cuni.cz \
--cc=netdev@vger$(echo .)kernel.org \
--cc=val_henson@linux$(echo .)intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox