Solved

linux device drivers

Posted on 2004-07-31
7
226 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

685 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