Solved

linux device drivers

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help Linux centos 5.7 3 87
GUI development for Ubuntu 8 215
Debian Preseed: Installation process stuck at 18 %  at finishing-installation 9 212
linux / python expert needed 3 88
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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

12 Experts available now in Live!

Get 1:1 Help Now