[ltp] (no subject)

Alex Deucher linux-thinkpad@linux-thinkpad.org
Thu, 7 Oct 2004 09:16:14 -0400


you might have more luck on linux-kernel...

Alex

On Thu, 07 Oct 2004 08:32:20 +0000, sensors <sensors@burntmail.com> wrote:
> Hi All
> 
> I have written a piece of code to detect a pci device, but it is causing  segmentation fault. What might have gone wrong in the code..........
> Can any body please help me out with this.....................
> 
> #include<linux/pci.h>
>  .................................
>  ...............................
>  .................................
> 
> int pci_init( void )
> {
>         struct pci_dev *pci_device = NULL;
>         printk("\n Inside pci_init\n");
> 
>         if( !pci_present() )
>         {
>                 printk("\nPCI not supported\n");
>                 return 0;
>         }
> 
>         if(( pci_find_slot(1, PCI_DEVFN( 9, 0))) == NULL)
>         {
>                 printk("\n Device not foumd\n");
>                 return 0;
>       }
> 
>                 printk("\nVendor ID\t%x",pci_device->vendor);
>                 printk("\nDevice ID\t%x",pci_device->device);
>                 printk("\nVendor ID\t%s",pci_device->name);
> 
>                 return 0;
> }
> 
> Thanks in advance...........
> 
> --
> The linux-thinkpad mailing list home page is at:
> http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad
>