Sponsored Content
Top Forums Programming request_irq always returns EINVAL Post 302469734 by dragonpoint on Monday 8th of November 2010 10:54:35 PM
Old 11-08-2010
request_irq always returns EINVAL

request_irq always returns EINVAL
What am I doing wrong here ?

Code:
int mydrvr_open(struct inode *inode, struct file *filp)
{
     int ret;
    printk("<1> \nModule Opened!"); 
    //disable_irq(4);
	//free_irq(4, NULL);
    ret = request_irq(4, &imr_interrupt_handler,IRQF_SHARED, "mediadeviceintr", NULL);
    printk("<1>irqReturn=%d\n",ret);
	if(ret>0)  enable_irq(4);
    return 0;
}

Moderator's Comments:
Mod Comment please use "code" tags!


---------- Post updated at 10:54 PM ---------- Previous update was at 03:27 AM ----------

Ok, I figured it out... since this was a shared interrupt, I could not pass a NULL device ID, just one of reasons why it would return EINVAL or -22.

Last edited by dragonpoint; 11-08-2010 at 04:28 AM.. Reason: typo
 

9 More Discussions You Might Find Interesting

1. Programming

request_irq func. header file?

I try to compile program which use request_irq function declarated in linux/sched.h but it bring a lot of errors relating to include directives in sched.h. I try on Mandrake7.2 and RedHat7.2 but result same. A lot of thanks for your answers. (2 Replies)
Discussion started by: ppphah
2 Replies

2. Programming

longjmp never returns

Hi I am using setjmp and longjmp in a deeply nested functions BUT longjmp is not returning(hanging in longjmp) How can I debug this issue. I could not cut and paste the code due to its size and it is chained with other programs. Is there any way to trace where the... (2 Replies)
Discussion started by: axes
2 Replies

3. UNIX for Dummies Questions & Answers

Grep without returns...

Is there a command where I can pipe my grep into it and it will output it with spaces rather than returns? Example I want to turn prompt$ grep blah file blah blah into this prompt$ grep blah file | someCommand blah blah (1 Reply)
Discussion started by: mrwatkin
1 Replies

4. UNIX for Advanced & Expert Users

Problem shmat in HP-UX. EINVAL Error

I have a process that need two active connections to the same zone of shared memory. But when i do the second call to shmat it give me error 22 (EINVAL). Only works ok the second call to shmat if i disconnect the first connection (shmdt) In Sun,AIX and Digital, i donīt have this problem. ... (7 Replies)
Discussion started by: dairby
7 Replies

5. Programming

Problem shmat in HP-UX Titanium ia64. EINVAL Error

I have a process that needs two active connections to the same zone of shared memory simultaneously. The firs conection works ok, but when i do the second call to shmat it give me error 22 (EINVAL). Only works ok the second call to shmat if i disconnect the first connection (shmdt) Steps:... (3 Replies)
Discussion started by: dairby
3 Replies

6. Shell Programming and Scripting

Grep returns nothing

Hi all, I am trying to grep a .txt file for a word. When I hit enter, it returns back to $ The file is 4155402 in size and is named in this way: *_eveningtimes_done_log.txt I use this command, being in the same directory as the file: grep -i "invalid" *_eveningtimes_done_log.txt ... (16 Replies)
Discussion started by: DallasT
16 Replies

7. UNIX for Dummies Questions & Answers

Help with Functions and Value returns

mon_yy=${1} date_found=`find_end_day $mon_yy` export_dealer_changes ${date_found} Hello I am trying to pull a formatted date back from the function find_end_day and pass it into the function export_dealer_changes. When I try the above the variable date_found is empty. I have tried various... (3 Replies)
Discussion started by: treemyf
3 Replies

8. Shell Programming and Scripting

Help in function returns value

Hi, I need to return a value from the function. the value will be the output from cat command which uses random fucntion. #!/bin/ksh hello() { var1=$(`cat /dev/urandom| tr -dc 'a-zA-Z0-9-!%&()*+,-/:;<=>?_'|fold -w 10 | head -n 1`) echo "value is" var1 return var1 } hello var=$?... (2 Replies)
Discussion started by: Nandy
2 Replies

9. Shell Programming and Scripting

Function Returns

I'm having a little trouble returning a value from a function or calling it, I'm not quite sure. I'm calling the function here function region_lookup_with_details { results = $(set_region) echo $results } This is the function I'm calling function set_region { ... (8 Replies)
Discussion started by: akechnie
8 Replies
copyb(9F)						   Kernel Functions for Drivers 						 copyb(9F)

NAME
copyb - copy a message block SYNOPSIS
#include <sys/stream.h> mblk_t *copyb(mblk_t *bp); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
bp Pointer to the message block from which data is copied. DESCRIPTION
copyb() allocates a new message block, and copies into it the data from the block that bp denotes. The new block will be at least as large as the block being copied. copyb() uses the b_rptr and b_wptr members of bp to determine how many bytes to copy. RETURN VALUES
If successful, copyb() returns a pointer to the newly allocated message block containing the copied data. Otherwise, it returns a NULL pointer. CONTEXT
copyb() can be called from user or interrupt context. EXAMPLES
Example 1: : Using copyb For each message in the list, test to see if the downstream queue is full with the canputnext(9F) function (line 21). If it is not full, use copyb to copy a header message block, and dupmsg(9F) to duplicate the data to be retransmitted. If either operation fails, reschedule a timeout at the next valid interval. Update the new header block with the correct destination address (line 34), link the message to it (line 35), and send it downstream (line 36). At the end of the list, reschedule this routine. 1 struct retrans { 2 mblk_t *r_mp; 3 int r_address; 4 queue_t *r_outq; 5 struct retrans *r_next; 6 }; 7 8 struct protoheader { ... 9 int h_address; ... 10 }; 11 12 mblk_t *header; 13 14 void 15 retransmit(struct retrans *ret) 16 { 17 mblk_t *bp, *mp; 18 struct protoheader *php; 19 20 while (ret) { 21 if (!canputnext(ret->r_outq)) { /* no room */ 22 ret = ret->r_next; 23 continue; 24 } 25 bp = copyb(header); /* copy header msg. block */ 26 if (bp == NULL) 27 break; 28 mp = dupmsg(ret->r_mp); /* duplicate data */ 29 if (mp == NULL) { /* if unsuccessful */ 30 freeb(bp); /* free the block */ 31 break; 32 } 33 php = (struct protoheader *)bp->b_rptr; 34 php->h_address = ret->r_address; /* new header */ 35 bp->bp_cont = mp; /* link the message */ 36 putnext(ret->r_outq, bp); /* send downstream */ 37 ret = ret->r_next; 38 } 39 /* reschedule */ 40 (void) timeout(retransmit, (caddr_t)ret, RETRANS_TIME); 41 } SEE ALSO
allocb(9F), canputnext(9F), dupmsg(9F) Writing Device Drivers STREAMS Programming Guide SunOS 5.10 07 Nov 1996 copyb(9F)
All times are GMT -4. The time now is 11:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy