Re: How to correctly create device attributes in a platform driver?

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

 



On Fri, May 22, 2015 at 11:04:30AM +0200, Josef Holzmayr wrote:
> Howdy!
> 
> I’m currently working on a platform_driver, where I want an
> attribute_group to be in effect for every platforn_device that went
> through the corresponding .probe() call. Now
> http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
> suggests to set this in the struct device, but as far as I understand
> it, this struct is already passed to me. So where can I feed it
> earlier in the instantiation? Or do I have to resort to
> sighs_create_group()?

The "correct" way is to set the platform_driver's driver->groups field
to your attribute groups.  That way it will be created before the device
is bound to the driver.

It would be nicer if platform_driver had a groups field, so that you
don't have to "dive" into the driver sub-field, but given that you
almost always have to do this anyway, it shouldn't be a big deal.

Hope this helps,

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel





[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux