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: Tue, 26 Sep 2006 08:52:14 +0000	[thread overview]
Message-ID: <loom.20060926T104211-71@post.gmane.org> (raw)
In-Reply-To: <loom.20060915T082244-470@post.gmane.org>

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

> 

> If you have rtlinux issues, I suggest you ask on a rtlinux specific
> mailing list, as I do not know anything about it.
> 

 Hello Greg,
         I am facing the same problem with linux driver too.Forget about
RTLinux.Regarding linux where may be the mistake in my code below. why local bus
offsets are giving 0xffff always after hot swap?


static struct pci_device_id my_id_table[] __devinitdata = {
  {0xAAAA,0xBBBB,0xCCCC,0xDDDD, 0, 0, 0 },
  {0xAAAA,0xBBBB,0xCCCC,0xDDDD, 0, 0, 0 },
  {0,},
 };

 MODULE_DEVICE_TABLE(pci, my_id_table);

 static int __devinit 	my_init_one (struct pci_dev *, const struct pci_device_id *);
 static int __devexit 	my_remove_one (struct pci_dev *);

 static struct pci_driver my_pci_driver = {
	name:		DRV_NAME,
	id_table:	my_id_table,
	probe:		my_init_one,
	remove:		__devexit_p(my_remove_one) 
 };



 static int __devinit my_init_one(struct pci_dev *pdev,const struct
pci_device_id *my_id_table)
 {
    unsigned char pci_bus, pci_device_fn;
    int flag = -1,result = 0,ret = 0;

    printf("my_init_one invoked!\n");
    
    /* initialize device structures */
    for(pciCnt = 0; pciCnt < MAX_DEV; pciCnt++)
           devCtrl[pciCnt]=0;

    /* Initialize PCI controller*/ 
     devCtrl[i] = pdev;
     if(pci_enable_device(devCtrl[i]) < 0) {
            printf("\nnot enabled");
            ret = -EBUSY;
      }
     pci_bus = devCtrl[i]->bus->number;
     pci_device_fn = devCtrl[i]->devfn;
     pio_start[i] = pci_resource_start(devCtrl[i], 2);
     len[i] = pci_resource_len(devCtrl[i], 2);
     printf("\nBusnumber = %x",pci_bus);
     printf("\nDevfn = %x",pci_device_fn);
     printf("\nBAR2 ADDR = %x",pio_start[i]);
     
     if((pci_request_regions(pdev,DRV_NAME))) {
               ret = -ENOMEM;
       //        goto mem_err_out;
     }
     if(i = 0) {

         if(register_chrdev(---, "mydev_0", &my_fops)) {
                ret = -EIO;
     //           goto register_err_out;
       
         }
                    
      }
     if(i = 1 ) {
         if ( register_chrdev(----, "mydev_1", &my_fops)) {
                 ret = -EIO;
    //             goto register_err_out;
         }
     }

     i++;
  return ret;
  }

 static int __devexit my_remove_one(struct pci_dev *pdev)
 {
    int j=0,k;
    printf ("my_remove_one invoked!\n");

    pci_release_regions(pdev);
    pci_disable_device(pdev);

    return 0;
 }



init_module()
 {
      int ret;

      printk("\nmy_init\n");

      ret = pci_module_init(&my_pci_driver);
      printk("\nmain ret = %d ",ret);
      if (ret != 0)
            return -EFAULT;

cleanup_module()
{
      pci_unregister_driver(&my_pci_driver);
      unregister_chrdev("mydev_0");
      unregister_chrdev("mydev_1");
}


-------------------------------------------------------------------------
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-26  8:52 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
2006-09-20 15:39 ` Greg KH
2006-09-26  8:52 ` sumalatha [this message]
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.20060926T104211-71@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).