Skip to contentSkip to conversation

cleanup pciback_reset_device

PATCH In review Akio Takebe 2 participants 3 messages Dec 18, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cleanup pciback_reset_device

Hi,

This patch is for cleanup of pciback_reset_device. is_enabled=0 and is_busmaster=0 are not necessary because pci_disable_device() do them.

diff -r c6f637694b85 linux-2.6-xen-sparse/drivers/xen/pciback/pciback_ops.c
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/pciback_ops.c Fri Dec 15 11:
53:45 2006 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/pciback_ops.c Mon Dec 18 08:
58:43 2006 +0900
@@ -22,11 +22,7 @@ void pciback_reset_device(struct pci_dev
/* Disable devices (but not bridges) */
if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
pci_disable_device(dev);
-
pci_write_config_word(dev, PCI_COMMAND, 0);
-
- dev->is_enabled = 0;
- dev->is_busmaster = 0;
} else {
pci_read_config_word(dev, PCI_COMMAND, &cmd); if (cmd & (PCI_COMMAND_INVALIDATE)) {

Best Regards,

Akio Takebe

linux-2.6-xen-sparse/drivers/xen/pciback/pciback_ops.c +0 -4
diff -r c6f637694b85 linux-2.6-xen-sparse/drivers/xen/pciback/pciback_ops.c
@@ -22,11 +22,7 @@ void pciback_reset_device(struct pci_dev
 	/* Disable devices (but not bridges) */
 	if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
 		pci_disable_device(dev);
-
 		pci_write_config_word(dev, PCI_COMMAND, 0);
-
-		dev->is_enabled = 0;
-		dev->is_busmaster = 0;
 	} else {
 		pci_read_config_word(dev, PCI_COMMAND, &cmd);
 		if (cmd & (PCI_COMMAND_INVALIDATE)) {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 3 lines · Akio Takebe

This patch is for cleanup of pciback_reset_device. is_enabled=0 and is_busmaster=0 are not necessary because pci_disable_device() do them.

If you are zapping the command register then doesn't it makes sense to zap the software flags relating to that at the same time, even if that sometimes happens to be redundant? It certainly means we can be sure they won't get out of sync.

-- Keir

#2 lore raw

Hi, Keir

Quoted 11 lines · Akio Takebe
Quoted 4 lines

This patch is for cleanup of pciback_reset_device. is_enabled=0 and is_busmaster=0 are not necessary because pci_disable_device() do them.

If you are zapping the command register then doesn't it makes sense to zap the software flags relating to that at the same time, even if that sometimes happens to be redundant? It certainly means we can be sure they won't get out of sync.

I checked linux-2.6.19 and linux-2.6.18,
both pci_disable_device()s do is_enabled=0 and is_busmaster=0. I think pci_write_config_word(dev, PCI_COMMAND, 0) is not also necessary, (though I'm not sure it.)

So I think they in pciback_reset_device() are not necessary.

But if you want to leave it for safe, I agree. :)

Best Regards,

Akio Takebe