All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: adilkaraoz <adilkaraoz@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] PCI1711 Rtdm driver reading and writing error
Date: Tue, 04 Jan 2011 22:08:20 +0100	[thread overview]
Message-ID: <4D238C44.8000101@domain.hid> (raw)
In-Reply-To: <AANLkTim+BeV2q5stB-ErSVqF9Oy5BJTHtZF29aPN1c6w@domain.hid>

adilkaraoz wrote:
>   pci1711_card->location = pci_resource_start(dev, PCI_1711_BAR & 0xFFFFFFF0
> );
>   pci1711_card->mem_size = pci_resource_len(dev, PCI_1711_BAR & 0xFFFFFFF0
> );

I really have doubts about this: the arguments passed to these functions
should be a something ranging from 0 to 5 inclusive. Now, PCI_1711_BAR &
0xFFFFFFF0 seems odd.
If PCI_1711_BAR is less than 0x10, the result of this mask will always be 0.
If PCI_1711_BAR is greater than 0xf, you end up accessing random memory.

Also note that since 2.6.28, there is a pci_ioremap_bar function, which
does all the pci_resouce and ioremap job.

> 
>   //if(pci1711_card->location == 0){
>     printk( KERN_WARNING "xeno_pc1711_driver: location = %lx mem = %lx\n",
> pci1711_card->location, pci1711_card->mem_size);
>   //}
> 
>     ret_val = pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
>     if (!ret_val){
> rtdm_printk("interrupt line no:%d",irq);
>  }

That is not the way to get the interrupt line either, you should use
dev->irq.

-- 
                                                                Gilles.


      parent reply	other threads:[~2011-01-04 21:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-26 18:39 [Xenomai-help] PCI1711 Rtdm driver reading and writing error adilkaraoz
2011-01-01 22:23 ` Gilles Chanteperdrix
2011-01-04 21:08 ` Gilles Chanteperdrix [this message]

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=4D238C44.8000101@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=adilkaraoz@domain.hid \
    --cc=xenomai@xenomai.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.