All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
To: Sebastian Haas <haas-zsNKPWJ8Pib6hrUXjxyGrA@public.gmane.org>
Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Subject: Re: [PATCH] ems_pci: fix size of CAN controllers BAR mapping for CPC-PCI	v2
Date: Thu, 24 Sep 2009 10:37:19 +0200	[thread overview]
Message-ID: <4ABB2FBF.8080906@grandegger.com> (raw)
In-Reply-To: <20090923153747.30154.99860.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

Hi Sebastian,

Sebastian Haas wrote:
> The driver mapped only 128 bytes of the CAN controller address space when a
> CPC-PCI v2 was detected (incl. CPC-104P). This patch will fix it by always
> mapping the whole address space (4096 bytes on all boards) of the
> corresponding PCI BAR.
> 
> Signed-off-by: Sebastian Haas <haas-zsNKPWJ8Pib6hrUXjxyGrA@public.gmane.org>
> ---
> 
>  drivers/net/can/sja1000/ems_pci.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/can/sja1000/ems_pci.c b/drivers/net/can/sja1000/ems_pci.c
> index 7d84b8a..ba98063 100644
> --- a/drivers/net/can/sja1000/ems_pci.c
> +++ b/drivers/net/can/sja1000/ems_pci.c
> @@ -94,12 +94,14 @@ struct ems_pci_card {
>  #define EMS_PCI_CDR             (CDR_CBP | CDR_CLKOUT_MASK)
>  
>  #define EMS_PCI_V1_BASE_BAR     1
> -#define EMS_PCI_V1_MEM_SIZE     4096
> +#define EMS_PCI_V1_MEM_SIZE     4096 /* size of PITA control area */
>  #define EMS_PCI_V2_BASE_BAR     2
> -#define EMS_PCI_V2_MEM_SIZE     128
> +#define EMS_PCI_V2_MEM_SIZE     128 /* size of PLX control area */
>  #define EMS_PCI_CAN_BASE_OFFSET 0x400 /* offset where the controllers starts */
>  #define EMS_PCI_CAN_CTRL_SIZE   0x200 /* memory size for each controller */
>  
> +#define EMS_PCI_CONTR_MEM_SIZE  4096 /* size of controller area */
> +
>  static struct pci_device_id ems_pci_tbl[] = {
>  	/* CPC-PCI v1 */
>  	{PCI_VENDOR_ID_SIEMENS, 0x2104, PCI_ANY_ID, PCI_ANY_ID,},
> @@ -266,7 +268,7 @@ static int __devinit ems_pci_add_card(struct pci_dev *pdev,
>  		goto failure_cleanup;
>  	}
>  
> -	card->base_addr = pci_iomap(pdev, base_bar, mem_size);
> +	card->base_addr = pci_iomap(pdev, base_bar, EMS_PCI_CONTR_MEM_SIZE);
>  	if (card->base_addr == NULL) {
>  		err = -ENOMEM;
>  		goto failure_cleanup;

I see. To avoid confusion I suggest renaming some variables and defines:

s/EMS_PCI_V1_MEM_SIZE/EMS_PCI_V1_CONF_SIZE/
s/EMS_PCI_V2_MEM_SIZE/EMS_PCI_V2_CONF_SIZE/
s/mem_size/conf_size/
s/EMS_PCI_CONTR_MEM_SIZE/EMS_PCI_BASE_SIZE/

Would that not be more appropriate?

Wolfgang.

  parent reply	other threads:[~2009-09-24  8:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-23 15:37 [PATCH] ems_pci: fix size of CAN controllers BAR mapping for CPC-PCI v2 Sebastian Haas
     [not found] ` <20090923153747.30154.99860.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-09-24  8:37   ` Wolfgang Grandegger [this message]
     [not found]     ` <4ABB2FBF.8080906-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2009-09-24 11:52       ` Sebastian Haas

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=4ABB2FBF.8080906@grandegger.com \
    --to=wg-5yr1bzd7o62+xt7jha+gda@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=haas-zsNKPWJ8Pib6hrUXjxyGrA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.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 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.