linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sumalatha <suma.aluru@gmail.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: PCI hotplug question: drivers
Date: Wed, 20 Sep 2006 12:32:36 +0000	[thread overview]
Message-ID: <loom.20060920T113411-592@post.gmane.org> (raw)
In-Reply-To: <loom.20060915T082244-470@post.gmane.org>

Greg KH <greg <at> kroah.com> writes:

> 
> On Tue, Sep 19, 2006 at 05:22:47AM +0000, sumalatha wrote:
> > Hi  Greg,
> >         
> 
> Ick, no.  Please read Documentation/pci.txt, a very old document that
> tells you not to use this style for pci drivers.  Please us
> pci_register_driver() instead.
> 
> If you do that, your driver will work properly with any pci hotplug
> driver.
> 
   Exactly I did the same for linux driver,but when translating to RTLinux 
driver I was confused with the probe() to access my 4  pci cards of 2 different
types which have same vendorid and deviceid.(2 cards of same type are having
same subdeviceid and subvendorid) and implemented 2.4 card detection functions.

According to your suggestion I implemented probe() and checked hotswap.
After hotswap ,device is detected (from user space fd value returned is 3) plx
is working fine ,i mean i am able to read hotswap status from 0x48 address (from
pci cinfig registers).it came correctly,but local bus offsets are not
working.when ever i read i am getting 0xffff always.i think problem from local
bus side. 
what may be the mistake i did ? Also using my probe only one card driver is
registered.how to do for the other card.

here is my few lines of code.......

static struct pci_device_id dio_id_table[] __devinitdata = {
 {0xAAAA,0xBBBB,0xCCCC,0xDDDD, 0, 0, 0 }, //SAME TYPE OF CARDS
 {0xAAAA,0xBBBB,0xCCCC,0xDDDD, 0, 0, 0 },
 {0,},
};

static int __devinit mycard_init_one(struct pci_dev *pdev,const struct
pci_device_id *ids)
{
       static int i=0;
       unsigned char pci_bus, pci_device_fn;

       printk("\nprobe");
        pci_enable_device(pdev);

        pci_bus = pdev->bus->number;
        pci_device_fn = pdev->devfn;

        pio_start[i] = pci_resource_start(pdev, 2);

        printf("\nBusnumber = %x",pci_bus);
        printf("\nDevfn = %x",pci_device_fn);
        printf("\nBAR2 ADDR = %x",pio_start[i]);
     if(i = 0) {
        if ( rtl_register_dev( "/dev/dev_0", &dio_fops, 0 ) ) {
                printf("Unable to register /dev_0\n");
                rtl_unregister_dev("/dev/dev_0");
                //return -EIO;
        }
     }

     if(i = 1) {
       if ( rtl_register_dev( "/dev/dev_1", &dio_fops, 1 ) ) {
                printf("Unable to register /dev_1\n");
                rtl_unregister_dev("/dev/dev_1");
                //return -EIO;
       }
     }
       i++;
      return 0;
   }
     
static int __devexit mycard_remove_one(struct pci_dev *pdev)
{
        pci_set_drvdata(pdev,NULL);
        return 0;

}
module_init()
{
      ret = pci_module_init(&dio_pci_rtl_driver);
       printk("\nmain ret = %d ",ret);
        if (ret != 0)
                return (-1);
         return 0;
}
 cleanup_module()
{

        rtl_unregister_dev("/dev/dev_0");
        rtl_unregister_dev("/dev/dev_1");
        pci_unregister_driver(&pci_rtl_driver);

        return SUCCESS;


 thanks and regards,
  sumalatha.







 

> 
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
> 





-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2006-09-20 12:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-15  6:27 PCI hotplug question: drivers sumalatha
2006-09-15 10:35 ` Greg KH
2006-09-19  5:22 ` sumalatha
2006-09-19 14:05 ` Greg KH
2006-09-20 12:32 ` sumalatha [this message]
2006-09-20 15:39 ` Greg KH
2006-09-26  8:52 ` sumalatha
2006-09-28  6:08 ` Greg KH

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=loom.20060920T113411-592@post.gmane.org \
    --to=suma.aluru@gmail.com \
    --cc=linux-hotplug@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;
as well as URLs for NNTP newsgroup(s).