Solved

linux device drivers

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to command 8 98
yum remove leaves empty directories 1 93
Problem to telnet 23 165
Linux : Booting Error after restoring image from OLD PC 23 93
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

808 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