2009-03-31 16:37:43

by Ayman KHAMOUMA

[permalink] [raw]
Subject: Sysfs with no struc device ?

Hi everybody,

I'm trying to write a module which is supposed to write the state of a pin in a sysfs file.
As it is neither a char device nor a block device, or anything else, I suposed taht I don't need any struct device...I mau be mistaking...
So my question is:
How can I create this file in sysfs without any struct device ?


Regards,
Ayman


2009-03-31 19:25:06

by Bodo Eggert

[permalink] [raw]
Subject: Re: Sysfs with no struc device ?

Ayman KHAMOUMA <[email protected]> wrote:

> I'm trying to write a module which is supposed to write the state of a pin in
> a sysfs file. As it is neither a char device nor a block device, or anything
> else, I suposed taht I don't need any struct device...I mau be mistaking... So
> my question is: How can I create this file in sysfs without any struct device
> ?

Why don't you create a char device: Reader will get one char per status change
(and one initial char, off cause), while mmap will map the flag? You'd get
the interface you want (except the path beginning with /sys), and more.

Or, if you wanted a more sophisticated way, you could use a one-button-zero-axis
joystick device, very similar to the parport joystick. But I doubt it would make
sense for your usecase?

2009-03-31 19:55:27

by Alan

[permalink] [raw]
Subject: Re: Sysfs with no struc device ?

On Tue, 31 Mar 2009 18:19:41 +0200
Ayman KHAMOUMA <[email protected]> wrote:

> Hi everybody,
>
> I'm trying to write a module which is supposed to write the state of a pin in a sysfs file.
> As it is neither a char device nor a block device, or anything else, I suposed taht I don't need any struct device...I mau be mistaking...
> So my question is:
> How can I create this file in sysfs without any struct device ?

Wrong question I think - if its a platform device then create a
platform_device for it ..