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:02 UTC|newest]
Thread overview: 8+ 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
-- strict thread matches above, loose matches on Subject: below --
2005-12-15 20:58 [PATCH] Move scsi_print_msg to SPI code Matthew Wilcox
2005-12-15 21:07 ` From: Matthew Wilcox <matthew@wil.cx> Matthew Wilcox
2005-12-15 21:07 ` Matthew Wilcox
2005-12-15 21:07 ` Matthew Wilcox
2005-12-15 21:07 ` Matthew Wilcox
2005-12-15 21:07 ` 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.cx \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=netdev@vger.kernel.org \
--cc=val_henson@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.