Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

linux device drivers

Posted on 2004-07-31
7
Medium Priority
?
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 100 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 100 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 learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

609 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