public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* How to add a device file to sysfs?
@ 2006-10-31  5:30 Aubrey
  2006-11-03  4:52 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Aubrey @ 2006-10-31  5:30 UTC (permalink / raw)
  To: linux-kernel

Hi all,

When a misc device file is registered, there are two files under my
own class directory:

/sys --> class --> misc --> myprog --> dev
                                                   --> uevent
                                                   --> myprog_show (to be added)

Now, my question is, is it possbile to add the third file
"myprog_show" under "myprog" directory without modify any common code?

I've read the doc under linux-2.6.x/Documentation, I can add it to
some other directory, but not found a way to add it to my own
directory.

Thanks for any help.
-Aubrey

^ permalink raw reply	[flat|nested] 5+ messages in thread

* How to add a device file to sysfs?
@ 2006-11-01  7:51 Aubrey
  0 siblings, 0 replies; 5+ messages in thread
From: Aubrey @ 2006-11-01  7:51 UTC (permalink / raw)
  To: linux-kernel

Hi all,

When a misc device file is registered, there are two files under my
own class directory:

/sys --> class --> misc --> myprog --> dev
                                                  --> uevent
                                                  --> myprog_show (to be added)

Now, my question is, is it possbile to add the third file
"myprog_show" under "myprog" directory without modify any common code?

I've read the doc under linux-2.6.x/Documentation, I can add it to
some other directory under /sys, but not found a way to add it to my own
directory.

Thanks for any help.
-Aubrey

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to add a device file to sysfs?
  2006-10-31  5:30 How to add a device file to sysfs? Aubrey
@ 2006-11-03  4:52 ` Greg KH
  2006-11-13 10:45   ` Brice Goglin
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2006-11-03  4:52 UTC (permalink / raw)
  To: Aubrey; +Cc: linux-kernel

On Tue, Oct 31, 2006 at 01:30:36PM +0800, Aubrey wrote:
> Hi all,
> 
> When a misc device file is registered, there are two files under my
> own class directory:
> 
> /sys --> class --> misc --> myprog --> dev
>                                                   --> uevent
>                                                   --> myprog_show (to be 
>                                                   added)
> 
> Now, my question is, is it possbile to add the third file
> "myprog_show" under "myprog" directory without modify any common code?

Yes.

> I've read the doc under linux-2.6.x/Documentation, I can add it to
> some other directory, but not found a way to add it to my own
> directory.

After misc_register() has been successfully called, the variable "class"
will be set in the miscdevice structure.  Use that pointer to call
class_device_create_file() to create your new file in this directory.

Hope this helps,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to add a device file to sysfs?
  2006-11-03  4:52 ` Greg KH
@ 2006-11-13 10:45   ` Brice Goglin
  2006-11-13 17:07     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Brice Goglin @ 2006-11-13 10:45 UTC (permalink / raw)
  To: Greg KH; +Cc: Aubrey, linux-kernel

Greg KH wrote:
> On Tue, Oct 31, 2006 at 01:30:36PM +0800, Aubrey wrote:
>   
>> I've read the doc under linux-2.6.x/Documentation, I can add it to
>> some other directory, but not found a way to add it to my own
>> directory.
>>     
>
> After misc_register() has been successfully called, the variable "class"
> will be set in the miscdevice structure.  Use that pointer to call
> class_device_create_file() to create your new file in this directory.
>   

How does it work in -mm where miscdevice does not contain a "class"
anymore, but only pointers to some "device"?

Thanks,
Brice


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to add a device file to sysfs?
  2006-11-13 10:45   ` Brice Goglin
@ 2006-11-13 17:07     ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2006-11-13 17:07 UTC (permalink / raw)
  To: Brice Goglin; +Cc: Aubrey, linux-kernel

On Mon, Nov 13, 2006 at 11:45:54AM +0100, Brice Goglin wrote:
> Greg KH wrote:
> > On Tue, Oct 31, 2006 at 01:30:36PM +0800, Aubrey wrote:
> >   
> >> I've read the doc under linux-2.6.x/Documentation, I can add it to
> >> some other directory, but not found a way to add it to my own
> >> directory.
> >>     
> >
> > After misc_register() has been successfully called, the variable "class"
> > will be set in the miscdevice structure.  Use that pointer to call
> > class_device_create_file() to create your new file in this directory.
> >   
> 
> How does it work in -mm where miscdevice does not contain a "class"
> anymore, but only pointers to some "device"?

Then use device_create_file() instead :)

Good luck,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-11-13 17:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-31  5:30 How to add a device file to sysfs? Aubrey
2006-11-03  4:52 ` Greg KH
2006-11-13 10:45   ` Brice Goglin
2006-11-13 17:07     ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2006-11-01  7:51 Aubrey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox