Re: Problems while adding sysfs support to older device driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 07, 2009 at 10:54:36AM +0100, Bjoern Hinrichs wrote:
> Hi,
> 
> I'm running into some walls here while trying to add sysfs support to an older 
> device driver for a PCI framegrabber device.
> 
> I started by adding a
> 
> ---
> static struct pci_driver titan_driver = {
>   .name = DRV_NAME,
>   .id_table = titan_pci_tbl,
>   .probe = titan_probe,
>   .remove = titan_remove,
> };
> ---
> 
> and calls to pci_register_driver / pci_unregister_driver. As expected the 
> driver shows up under /sys/bus/pci/drivers and claims the right device:
> 
> ---
> $ ls -la /sys/bus/pci/drivers/titan/
> total 0
> drwxr-xr-x  2 root root    0 2009-11-30 09:14 .
> drwxr-xr-x 13 root root    0 2009-11-30 09:14 ..
> lrwxrwxrwx  1 root root    0 2009-11-30 09:14 0000:00:0b.0 -> 
> ../../../../devices/pci0000:00/0000:00:0b.0
> --w-------  1 root root 4096 2009-11-30 09:14 bind
> lrwxrwxrwx  1 root root    0 2009-11-30 09:14 module -> 
> ../../../../module/titan
> --w-------  1 root root 4096 2009-11-30 09:14 new_id
> --w-------  1 root root 4096 2009-11-30 09:14 remove_id
> --w-------  1 root root 4096 2009-11-30 09:14 uevent
> --w-------  1 root root 4096 2009-11-30 09:14 unbind
> ---
> 
> Now I want device files to be automatically generated, but it seems as if I'm 
> missing someting here. udevadm tells me I'm getting the following uevents:
> 
> ---
> KERNEL[1259568653.205951] add      /module/titan (module)
> UDEV_LOG=3                                               
> ACTION=add                                               
> DEVPATH=/module/titan                                    
> SUBSYSTEM=module                                         
> SEQNUM=682                                               
> 
> KERNEL[1259568653.206472] add      /bus/pci/drivers/titan (drivers)
> UDEV_LOG=3                                                         
> ACTION=add                                                         
> DEVPATH=/bus/pci/drivers/titan                                     
> SUBSYSTEM=drivers                                                  
> SEQNUM=683
> 
> UDEV  [1259568653.215901] add      /module/titan (module)
> UDEV_LOG=3
> ACTION=add
> DEVPATH=/module/titan
> SUBSYSTEM=module
> SEQNUM=682
> 
> UDEV  [1259568653.236102] add      /bus/pci/drivers/titan (drivers)
> UDEV_LOG=3
> ACTION=add
> DEVPATH=/bus/pci/drivers/titan
> SUBSYSTEM=drivers
> SEQNUM=683
> 
> 
> KERNEL[1259568653.205951] add      /module/titan (module)
> UDEV_LOG=3
> ACTION=add
> DEVPATH=/module/titan
> SUBSYSTEM=module
> SEQNUM=682
> ---
> 
> This looks to me as if I'm missing some uevents here. I guess there's 
> something I should be doing in .probe, but I'm neither sure whether that's 
> correct nor what it is.
> (Of course I can still add device files using mknod, but that'd be kinda .. 
> boring.)
> 
> Someone willing to give me a hint?

That all looks correct, what specifically is wrong here?  You don't get
a uevent for adding a sysfs file, only when you add a struct device (or
kobject) to sysfs.

What type of sysfs file are you adding to your driver?  What do you want
to export to userspace?  You do know the rules about sysfs files, right?

thanks,

greg k-h

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux