Solved

linux device drivers

Posted on 2004-07-31
7
220 Views
Last Modified: 2010-04-22
sir ,

 when i compile a device driver code ,
i cant initialize kkk , kkk is of type file_operations


 struct       file_operations   kkk ={NULL ,NULL}





it shows error :
             excess no of values  


       
             
0
Comment
Question by:karana
  • 2
  • 2
7 Comments
 
LVL 23

Expert Comment

by:brettmjohnson
ID: 11686357
struct file_operations is a sizeable structure (many more than two members).
Are you sure you are referencing the correct structure?  Do sizeof(struct file_operations).
Are you sure you didn't accidentally define a pointer to the structure?:

struct file_operations  * kkk ={NULL ,NULL};

0
 

Author Comment

by:karana
ID: 11712736
wat is the problem with  


struct file_operations  * kkk ={NULL ,NULL};



?????????????????
0
 
LVL 8

Expert Comment

by:Anthony2000
ID: 11899294
you are declaring a pointer to struct file_operations and then trying to initialize what the pointer points to without first allocating an instance of the struct file_operations.

I hope this helps
0
 
LVL 23

Accepted Solution

by:
brettmjohnson earned 25 total points
ID: 11899666
> what is the problem with  
> struct file_operations  * kkk ={NULL ,NULL};
> ???...

kkk is defined a single pointer to a structure, so it can only be initialized with a single pointer value.
{ NULL, NULL } is an array of two pointers.



0
 
LVL 8

Assisted Solution

by:Anthony2000
Anthony2000 earned 25 total points
ID: 11921778
I am curious, why are you trying to init *kkk to {NULL, NULL}?  

Most drivers I have seen usually have something like this:

struct file_operations kkk = {
    llseek,
    read,
    write,
    ioctl,
    open,
    release,
    poll
};

I used kkk as an example only.
each of the items are the names of the functions within the driver. (please note that I may not have them in the correct order) Also another way you will see these is :

struct file_operations kkk = {
    llseek:     my_llseek,
    read:       my_read,
    write:      my_write,
    ioctl:       my_ioctl,
    open:      my_open,
    release:   my_release,
    poll:        my_poll,
};

In this example you don't need to worry about ordering the functions in the {...}

I hope this helps

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now