public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adam Kropelin <akropel1@rochester.rr.com>
To: andrew.vasquez@qlogic.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] qla2xxx: Use dword accessors for PCI_ROM_ADDRESS
Date: Tue, 13 Sep 2005 19:20:02 -0400	[thread overview]
Message-ID: <20050913192002.E10911@mail.kroptech.com> (raw)
In-Reply-To: <20050913182550.A10911@mail.kroptech.com>

PCI_ROM_ADDRESS is a 32 bit register and as such should be accessed
using pci_bus_{read,write}_config_dword(). A recent audit of drivers/
turned up several cases of byte- and word-sized accesses. The harmful
ones were fixed by Linus directly. This patches up one of the remaining
harmless-but-still-wrong cases caught in the dragnet.

Signed-off-by: Adam Kropelin <akropel1@rochester.rr.com>

--- linux-2.6.14-rc1.orig/drivers/scsi/qla2xxx/qla_init.c	2005-09-13 11:59:16.000000000 -0400
+++ linux-2.6.14-rc1/drivers/scsi/qla2xxx/qla_init.c	2005-09-13 11:54:06.000000000 -0400
@@ -201,6 +201,7 @@
 qla2100_pci_config(scsi_qla_host_t *ha)
 {
 	uint16_t w, mwi;
+	uint32_t d;
 	unsigned long flags;
 	struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
 
@@ -215,9 +216,9 @@
 	pci_write_config_word(ha->pdev, PCI_COMMAND, w);
 
 	/* Reset expansion ROM address decode enable */
-	pci_read_config_word(ha->pdev, PCI_ROM_ADDRESS, &w);
-	w &= ~PCI_ROM_ADDRESS_ENABLE;
-	pci_write_config_word(ha->pdev, PCI_ROM_ADDRESS, w);
+	pci_read_config_dword(ha->pdev, PCI_ROM_ADDRESS, &d);
+	d &= ~PCI_ROM_ADDRESS_ENABLE;
+	pci_write_config_dword(ha->pdev, PCI_ROM_ADDRESS, d);
 
 	/* Get PCI bus information. */
 	spin_lock_irqsave(&ha->hardware_lock, flags);
@@ -237,6 +238,7 @@
 qla2300_pci_config(scsi_qla_host_t *ha)
 {
 	uint16_t	w, mwi;
+	uint32_t	d;
 	unsigned long   flags = 0;
 	uint32_t	cnt;
 	struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
@@ -302,9 +304,9 @@
 	pci_write_config_byte(ha->pdev, PCI_LATENCY_TIMER, 0x80);
 
 	/* Reset expansion ROM address decode enable */
-	pci_read_config_word(ha->pdev, PCI_ROM_ADDRESS, &w);
-	w &= ~PCI_ROM_ADDRESS_ENABLE;
-	pci_write_config_word(ha->pdev, PCI_ROM_ADDRESS, w);
+	pci_read_config_dword(ha->pdev, PCI_ROM_ADDRESS, &d);
+	d &= ~PCI_ROM_ADDRESS_ENABLE;
+	pci_write_config_dword(ha->pdev, PCI_ROM_ADDRESS, d);
 
 	/* Get PCI bus information. */
 	spin_lock_irqsave(&ha->hardware_lock, flags);
@@ -324,6 +326,7 @@
 qla24xx_pci_config(scsi_qla_host_t *ha)
 {
 	uint16_t w, mwi;
+	uint32_t d;
 	unsigned long flags = 0;
 	struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
 	int pcix_cmd_reg, pcie_dctl_reg;
@@ -366,9 +369,9 @@
 	}
 
 	/* Reset expansion ROM address decode enable */
-	pci_read_config_word(ha->pdev, PCI_ROM_ADDRESS, &w);
-	w &= ~PCI_ROM_ADDRESS_ENABLE;
-	pci_write_config_word(ha->pdev, PCI_ROM_ADDRESS, w);
+	pci_read_config_dword(ha->pdev, PCI_ROM_ADDRESS, &d);
+	d &= ~PCI_ROM_ADDRESS_ENABLE;
+	pci_write_config_dword(ha->pdev, PCI_ROM_ADDRESS, d);
 
 	/* Get PCI bus information. */
 	spin_lock_irqsave(&ha->hardware_lock, flags);

  parent reply	other threads:[~2005-09-13 22:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-12 23:59 2.6.13.1 locks machine after some time, 2.6.12.5 work fine Norbert Kiesel
2005-09-13  3:00 ` Linus Torvalds
2005-09-13  3:38   ` Norbert Kiesel
2005-09-13 14:25     ` Linus Torvalds
2005-09-13 14:57       ` Linus Torvalds
2005-09-13 16:02         ` Adam Kropelin
2005-09-13 15:55           ` Linus Torvalds
2005-09-13 20:22             ` David S. Miller
2005-09-13 22:25               ` Adam Kropelin
2005-09-13 23:11                 ` [PATCH] ibmphp: Use dword accessors for PCI_ROM_ADDRESS Adam Kropelin
2005-09-13 23:15                 ` [PATCH] pciehp: " Adam Kropelin
2005-09-13 23:17                 ` [PATCH] shpchp: " Adam Kropelin
2005-09-13 23:20                 ` Adam Kropelin [this message]
2005-09-13 16:27       ` 2.6.13.1 locks machine after some time, 2.6.12.5 work fine Norbert Kiesel
2005-09-13 17:09       ` Norbert Kiesel
2005-09-13 17:23         ` Linus Torvalds
2005-09-13 21:23           ` Norbert Kiesel
2005-09-13 22:24             ` Chris Wright

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=20050913192002.E10911@mail.kroptech.com \
    --to=akropel1@rochester.rr.com \
    --cc=andrew.vasquez@qlogic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox