[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4688F058.7040805@pobox.com>
Date: Mon, 02 Jul 2007 08:32:24 -0400
From: Jeff Garzik <jgarzik@...ox.com>
To: Olof Johansson <olof@...om.net>
CC: netdev@...r.kernel.org
Subject: Re: [PATCH 3/9] pasemi_mac: Abstract out register access
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 <olof@...om.net>
>
>
> 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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists