Olof Johansson wrote:
Abstract out the PCI config read/write accesses into reg read/write ones, still
calling the pci accessors on the back end.

Signed-off-by: Olof Johansson <[EMAIL PROTECTED]>


Index: netdev-2.6/drivers/net/pasemi_mac.c
===================================================================
--- netdev-2.6.orig/drivers/net/pasemi_mac.c
+++ netdev-2.6/drivers/net/pasemi_mac.c
@@ -81,6 +81,48 @@ MODULE_PARM_DESC(debug, "PA Semi MAC bit
static struct pasdma_status *dma_status; +static unsigned int read_iob_reg(struct pasemi_mac *mac, unsigned int reg)
+{
+       unsigned int val;
+
+       pci_read_config_dword(mac->iob_pdev, reg, &val);
+       return val;
+}
+
+static void write_iob_reg(struct pasemi_mac *mac, unsigned int reg,
+                         unsigned int val)
+{
+       pci_write_config_dword(mac->iob_pdev, reg, val);
+}
+
+static unsigned int read_mac_reg(struct pasemi_mac *mac, unsigned int reg)
+{
+       unsigned int val;
+
+       pci_read_config_dword(mac->pdev, reg, &val);
+       return val;
+}
+
+static void write_mac_reg(struct pasemi_mac *mac, unsigned int reg,
+                         unsigned int val)
+{
+       pci_write_config_dword(mac->pdev, reg, val);
+}
+
+static unsigned int read_dma_reg(struct pasemi_mac *mac, unsigned int reg)
+{
+       unsigned int val;
+
+       pci_read_config_dword(mac->dma_pdev, reg, &val);
+       return val;
+}
+
+static void write_dma_reg(struct pasemi_mac *mac, unsigned int reg,
+                         unsigned int val)
+{
+       pci_write_config_dword(mac->dma_pdev, reg, val);
+}

The general concept is fine, but you should use 'u32' and similar size-based types for your input and output values.


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to