Re: Is there any way to add an attribute under sysfs at the “platform” level?

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

 



On Mon, Jun 19, 2017 at 06:09:28PM +0300, Roman Storozhenko wrote:
> On Mon, Jun 19, 2017 at 08:55:22AM +0800, Greg KH wrote:
> > On Sun, Jun 18, 2017 at 05:38:36PM +0300, Roman Storozhenko wrote:
> > > Hello everybody!
> > > 
> > > I am trying to modify "pcspkr" driver undere linux kernel source tree. I added a new line there:
> > > 
> > > sample_id_dir = kobject_create_and_add("devices/platform/pcspkr/sample", NULL);
> > 
> > Ick, really?  What are you trying to do with "raw" kobjects?
> 
> I am trying to add "read/write" attribute under
> "devices/platform/pcspkr". Just for educational purposes. Didn't find another way to do it.

Using a kobject is not how to do that at all, attributes need to be
added to the structure that owns the directory.  kobjects are a
directory themselves.

good luck!

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[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