* How to correctly create device attributes in a platform driver?
@ 2015-05-22 9:04 Josef Holzmayr
2015-05-23 19:01 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Josef Holzmayr @ 2015-05-22 9:04 UTC (permalink / raw
To: driverdev-devel
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()?
Thanks,
J. Holzmayr
--
_____________________________________________________________
R-S-I Elektrotechnik GmbH & Co. KG
Woelkestrasse 11
D-85301 Schweitenkirchen
Fon: +49 8444 9204-0
Fax: +49 8444 9204-50
www.rsi-elektrotechnik.de
_____________________________________________________________
Amtsgericht Ingolstadt - GmbH: HRB 191328 - KG: HRA 170363
Geschäftsführer: Dr.-Ing. Michael Sorg, Dipl.-Ing. Franz Sorg
USt-IdNr.: DE 128592548
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to correctly create device attributes in a platform driver?
2015-05-22 9:04 How to correctly create device attributes in a platform driver? Josef Holzmayr
@ 2015-05-23 19:01 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2015-05-23 19:01 UTC (permalink / raw
To: Josef Holzmayr; +Cc: driverdev-devel
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@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-23 19:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-22 9:04 How to correctly create device attributes in a platform driver? Josef Holzmayr
2015-05-23 19:01 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.