LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-30-2009, 04:51 AM   #1
vinoth_f87
LQ Newbie
 
Registered: Apr 2009
Posts: 1

Rep: Reputation: 0
char driver on linux-kernel-2.4.21


Hi,I am new to driver. I am trying to build the char driver in kernel 2.4. When i compile the source i getting the following errors and warnings,

i.e, chardev.c:256: variable `Fops' has initializer but incomplete type and chardev.c:72:`EBUSY' undeclared (first use in this function)

chardev.c:63: warning: `struct file' declared inside parameter list
chardev.c:63: warning: its scope is only this definition or declaration, which is probably not what you want
chardev.c:63: warning: `struct inode' declared inside parameter list
chardev.c: In function `device_open':
chardev.c:72: `EBUSY' undeclared (first use in this function)
chardev.c:72: (Each undeclared identifier is reported only once
chardev.c:72: for each function it appears in.)
chardev.c: At top level:
chardev.c:97: warning: `struct file' declared inside parameter list
chardev.c:97: warning: `struct inode' declared inside parameter list
chardev.c:127: warning: `struct file' declared inside parameter list
chardev.c:127: warning: `struct inode' declared inside parameter list
chardev.c:168: warning: `struct file' declared inside parameter list
chardev.c:168: warning: `struct inode' declared inside parameter list
chardev.c:197: warning: `struct file' declared inside parameter list
chardev.c:197: warning: `struct inode' declared inside parameter list
chardev.c: In function `device_ioctl':
chardev.c:225: warning: passing arg 1 of `device_write' from incompatible pointer type
chardev.c:225: warning: passing arg 2 of `device_write' from incompatible pointer type
chardev.c:236: warning: passing arg 1 of `device_read' from incompatible pointer type
chardev.c:236: warning: passing arg 2 of `device_read' from incompatible pointer type
chardev.c: At top level:
chardev.c:256: variable `Fops' has initializer but incomplete type
chardev.c:257: warning: excess elements in struct initializer
chardev.c:257: warning: (near initialization for `Fops')
chardev.c:258: warning: excess elements in struct initializer
chardev.c:258: warning: (near initialization for `Fops')
chardev.c:259: warning: excess elements in struct initializer
chardev.c:259: warning: (near initialization for `Fops')
chardev.c:260: warning: excess elements in struct initializer
chardev.c:260: warning: (near initialization for `Fops')
chardev.c:261: warning: excess elements in struct initializer
chardev.c:261: warning: (near initialization for `Fops')
chardev.c:262: warning: excess elements in struct initializer
chardev.c:262: warning: (near initialization for `Fops')
chardev.c:263: warning: excess elements in struct initializer
chardev.c:263: warning: (near initialization for `Fops')
chardev.c:264: warning: excess elements in struct initializer
chardev.c:264: warning: (near initialization for `Fops')
chardev.c:269: warning: excess elements in struct initializer
chardev.c:269: warning: (near initialization for `Fops')
chardev.c:256: storage size of `Fops' isn't known

Here is my source code for the errors,

static int device_open(struct inode *inode,
struct file *file)
{
#ifdef DEBUG
printk ("device_open(%p)\n", file);
#endif


if (Device_Open)
return -EBUSY;


Device_Open++;

Message_Ptr = Message;

MOD_INC_USE_COUNT;

return SUCCESS;
}


struct file_operations Fops = {
NULL,
device_read,
device_write,
NULL,
NULL,
device_ioctl,
NULL,
device_open,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
NULL,
#endif
device_release
};

Thanks a lot in advance.

Last edited by vinoth_f87; 04-30-2009 at 05:25 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Problem in compiling a char device driver formerly for kernel 2.4 on kernel 2.6 payretep Linux - Newbie 6 09-24-2007 05:43 AM
Doubt in char device driver for linux 2.6 tomkaith13 Programming 6 11-27-2006 04:46 AM
Char driver: what's the best way to do... perlMonkey Linux - Software 0 07-05-2005 07:34 AM
char driver on linux-kernel-2.6.10 prashy Programming 2 05-09-2005 01:44 PM
user-mode Linux char device driver with "unresolved symbol __generic_copy_to_user" dlobron Linux - General 0 11-14-2004 09:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:24 AM.

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