LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-21-2011, 03:29 AM   #1
ramonfried
LQ Newbie
 
Registered: Aug 2011
Posts: 5

Rep: Reputation: Disabled
how to access dev structure from within a tasklet ?


I'm writing a char device module in Linux, the char device can be mounted several times. How can I know from within a tasklet, which device caused the interrupt ? The tasklet only recieves a constant data as a parameter.

If you look at the code below, I want a way for the task to reach dev_id.
--------------------
Code:
void wiegand_do_tasklet(unsigned long arg) {...}
DECLARE_TASKLET(wiegand_tasklet_zero, wiegand_do_tasklet,WIEGAND_ZERO);
DECLARE_TASKLET(wiegand_tasklet_one, wiegand_do_tasklet,WIEGAND_ONE);
static irqreturn_t wiegand_interrupt(int irq, void *dev_id)
{
if (atomic_read(&first_time) == 0) // Ignore first interrupt.
    {
        atomic_inc(&first_time);
        return IRQ_NONE;
    }
else
{
    if (!test_and_change_bit(1,(void *)&irq_mode))
    {
        if (irq == irq1)
            tasklet_schedule(&wiegand_tasklet_zero);
            else
                tasklet_schedule(&wiegand_tasklet_one);
    }
}
return IRQ_HANDLED;
}
 
Old 08-22-2011, 02:33 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,860

Rep: Reputation: 161Reputation: 161
How do you register interrupter? Each interrupter can be relative to particular device.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to access Kernel objectys structure ankur0921 Programming 11 02-02-2011 04:32 AM
how to access Inode structure of file Pratik dhamdhere Linux - Kernel 3 11-18-2010 11:50 PM
[SOLVED] Why only one tasklet execute even for multiple interrupts nitinarora Linux - Kernel 4 06-29-2010 09:15 AM
Race conditions in 2.4 between tasklet and sys.call yyanovsk Linux - Kernel 4 10-05-2006 11:33 AM
I cannot access EITHER CD drive! And there's no /dev/hdc or /dev/hdd or /dev/cdrom! Dmalic Linux - Hardware 13 11-18-2005 07:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 10:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration