* Using ioctl from with the kernel ???
@ 2002-11-12 14:48 Steven Scholz
2002-11-12 15:07 ` Stephan Linke
0 siblings, 1 reply; 6+ messages in thread
From: Steven Scholz @ 2002-11-12 14:48 UTC (permalink / raw)
To: LinuxPPC
Hi there,
I use a device driver (/dev/status_led from DENX) to manipulate some frontpanel
LEDs from user space via some ioctls.
Now I'd like to access them from the kernel space. How can I do that? AFAIK I
can't use fopen and ioctl...
Thanks,
Steven
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Using ioctl from with the kernel ???
2002-11-12 14:48 Using ioctl from with the kernel ??? Steven Scholz
@ 2002-11-12 15:07 ` Stephan Linke
2002-11-12 15:11 ` Steven Scholz
0 siblings, 1 reply; 6+ messages in thread
From: Stephan Linke @ 2002-11-12 15:07 UTC (permalink / raw)
To: Steven Scholz; +Cc: Linuxppc-Embedded
Hello Steven,
Your right IOCTL is not applicable for this. You can simply call the driver
functions directly. If these functions are called different from different
context(s) (like your driver and the IOCTL function) you have to add some
protection mechanism. (The code is not reentrant right?) You may try
spin_lock() for this job (linux/spinlock.h). If you are calling the
functions from interrupt contect too some extra protection is required...
Regards, Stephan
> -----Original Message-----
> From: owner-linuxppc-embedded@lists.linuxppc.org
> [mailto:owner-linuxppc-embedded@lists.linuxppc.org]On Behalf Of Steven
> Scholz
> Sent: Dienstag, 12. November 2002 15:48
> To: LinuxPPC
> Subject: Using ioctl from with the kernel ???
>
>
>
> Hi there,
>
> I use a device driver (/dev/status_led from DENX) to manipulate
> some frontpanel
> LEDs from user space via some ioctls.
>
> Now I'd like to access them from the kernel space. How can I do
> that? AFAIK I
> can't use fopen and ioctl...
>
> Thanks,
>
> Steven
>
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using ioctl from with the kernel ???
2002-11-12 15:07 ` Stephan Linke
@ 2002-11-12 15:11 ` Steven Scholz
2002-11-12 15:36 ` R: " Stefano Coluccini
2002-11-12 15:57 ` Stephan Linke
0 siblings, 2 replies; 6+ messages in thread
From: Steven Scholz @ 2002-11-12 15:11 UTC (permalink / raw)
To: Stephan Linke; +Cc: Linuxppc-Embedded
Hi Stephan,
> Your right IOCTL is not applicable for this. You can simply call the driver
> functions directly. If these functions are called different from different
> context(s) (like your driver and the IOCTL function) you have to add some
> protection mechanism. (The code is not reentrant right?) You may try
> spin_lock() for this job (linux/spinlock.h). If you are calling the
> functions from interrupt contect too some extra protection is required...
Thanks for your reply.
But how could I call the ioctl handler of the driver?
I would need some (dummy) inode...
Steven
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* R: Using ioctl from with the kernel ???
2002-11-12 15:11 ` Steven Scholz
@ 2002-11-12 15:36 ` Stefano Coluccini
2002-11-12 15:57 ` Stephan Linke
1 sibling, 0 replies; 6+ messages in thread
From: Stefano Coluccini @ 2002-11-12 15:36 UTC (permalink / raw)
To: Steven Scholz, Stephan Linke; +Cc: Linuxppc-Embedded
Hi,
the driver is linked to the kernel, so global (not static) functions
declared in a driver can be called from the kernel and in particular from
another driver, so you can bound the code of your ioctl in a function and
call it from the ioctl handler and from the other driver ... using the
protection mechanism suggested by Stephan.
Bye.
Stefano.
> -----Messaggio originale-----
> Da: owner-linuxppc-embedded@lists.linuxppc.org
> [mailto:owner-linuxppc-embedded@lists.linuxppc.org]Per conto di Steven
> Scholz
> Inviato: martedi 12 novembre 2002 16.11
> A: Stephan Linke
> Cc: Linuxppc-Embedded
> Oggetto: Re: Using ioctl from with the kernel ???
>
>
>
> Hi Stephan,
>
> > Your right IOCTL is not applicable for this. You can simply
> call the driver
> > functions directly. If these functions are called different
> from different
> > context(s) (like your driver and the IOCTL function) you have
> to add some
> > protection mechanism. (The code is not reentrant right?) You may try
> > spin_lock() for this job (linux/spinlock.h). If you are calling the
> > functions from interrupt contect too some extra protection is
> required...
>
> Thanks for your reply.
>
> But how could I call the ioctl handler of the driver?
> I would need some (dummy) inode...
>
> Steven
>
>
>
>
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Using ioctl from with the kernel ???
2002-11-12 15:11 ` Steven Scholz
2002-11-12 15:36 ` R: " Stefano Coluccini
@ 2002-11-12 15:57 ` Stephan Linke
2002-11-12 16:05 ` Steven Scholz
1 sibling, 1 reply; 6+ messages in thread
From: Stephan Linke @ 2002-11-12 15:57 UTC (permalink / raw)
To: Steven Scholz; +Cc: Linuxppc-Embedded, s.coluccini
Hi Steve,
If you realy like to do so you can call the LEDDRIVER_ioctl() function
directly with some dummy parameter (the one of you LED driver, not the one
from user space wich is to be called using an file descriptor). But I would
prefer to move the functionality into some extra function and call these
function from LEDDRIVER_ioctl() and from OTHERDRIVER_change_led() (like
Stefano suggested).
Regards, Stephveano :)
>
>
> Hi,
> the driver is linked to the kernel, so global (not static) functions
> declared in a driver can be called from the kernel and in particular from
> another driver, so you can bound the code of your ioctl in a function and
> call it from the ioctl handler and from the other driver ... using the
> protection mechanism suggested by Stephan.
>
> Bye.
>
> Stefano.
>
> > -----Messaggio originale-----
> > Da: owner-linuxppc-embedded@lists.linuxppc.org
> > [mailto:owner-linuxppc-embedded@lists.linuxppc.org]Per conto di Steven
> > Scholz
> > Inviato: martedi 12 novembre 2002 16.11
> > A: Stephan Linke
> > Cc: Linuxppc-Embedded
> > Oggetto: Re: Using ioctl from with the kernel ???
> >
> >
> >
> > Hi Stephan,
> >
> > > Your right IOCTL is not applicable for this. You can simply
> > call the driver
> > > functions directly. If these functions are called different
> > from different
> > > context(s) (like your driver and the IOCTL function) you have
> > to add some
> > > protection mechanism. (The code is not reentrant right?) You may try
> > > spin_lock() for this job (linux/spinlock.h). If you are calling the
> > > functions from interrupt contect too some extra protection is
> > required...
> >
> > Thanks for your reply.
> >
> > But how could I call the ioctl handler of the driver?
> > I would need some (dummy) inode...
> >
> > Steven
> >
> >
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using ioctl from with the kernel ???
2002-11-12 15:57 ` Stephan Linke
@ 2002-11-12 16:05 ` Steven Scholz
0 siblings, 0 replies; 6+ messages in thread
From: Steven Scholz @ 2002-11-12 16:05 UTC (permalink / raw)
To: Stephan Linke; +Cc: Linuxppc-Embedded, s.coluccini
Stephan Linke wrote:
>
> Hi Steve,
>
> If you realy like to do so you can call the LEDDRIVER_ioctl() function
> directly with some dummy parameter (the one of you LED driver, not the one
> from user space wich is to be called using an file descriptor). But I would
> prefer to move the functionality into some extra function and call these
> function from LEDDRIVER_ioctl() and from OTHERDRIVER_change_led() (like
> Stefano suggested).
Many thanks to you both.
I'll try that!
Good luck,
Steven
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-11-12 16:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-12 14:48 Using ioctl from with the kernel ??? Steven Scholz
2002-11-12 15:07 ` Stephan Linke
2002-11-12 15:11 ` Steven Scholz
2002-11-12 15:36 ` R: " Stefano Coluccini
2002-11-12 15:57 ` Stephan Linke
2002-11-12 16:05 ` Steven Scholz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).