LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-25-2012, 04:10 AM   #1
sindhu4sind
Member
 
Registered: Apr 2012
Posts: 38

Rep: Reputation: Disabled
Exclamation device_create - too many arguments


I am using 2 different versions of ubuntu the kernel versions for both are:
1. Ubuntu 8.04 - kernel version is 2.6.24-26-generic
2. Ubuntu 10.04 - kernel version is 2.6.32-40-generic

I don't know why! but when i use this function in Ubuntu 10.04 it works fine but while i use same function, even same program in Ubunut 8.04 it gives me a warning
Quote:
WARNING: too many arguments for format
I am using device_create function like this:
Code:
device_create(my_class, NULL, MKDEV(major, 0), NULL, "my_dev");
I guess some defination of this function might be changed!! can anyone please suggest me correct defination??

Thanks for always good response from you guys of newbie forum at LinuxQustions.org..
sindhu..

Last edited by sindhu4sind; 05-25-2012 at 04:24 AM.
 
Old 05-25-2012, 06:56 AM   #2
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,732
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
I gave you the link of "Linux Kernel API" in your previous thread.
http://gnugeneration.com/books/linux/2.6.20/kernel-api/

Last edited by Aquarius_Girl; 05-25-2012 at 06:59 AM.
 
Old 05-25-2012, 10:31 AM   #3
sindhu4sind
Member
 
Registered: Apr 2012
Posts: 38

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Anisha Kaul View Post
I gave you the link of "Linux Kernel API" in your previous thread.
http://gnugeneration.com/books/linux/2.6.20/kernel-api/
Thank you Anisha Kaul...

Yes, I also had a look at device.h file in 2.6.24:
I found syntax like:
Code:
extern struct device *device_create(struct class *cls, struct device * parent, dev_t devt, const char *fmt, ...)
I have changed the line of code according to format can u please check it:
Code:
device_create(my_class, NULL, MKDEV(major, 0), "my_dev");
now there's no warning, but its also not creating device or file "/dev/my_dev"

May be my syntax is not correct, can you please correct it if it has some mistake?
Thanks for your response
Sindhu
 
Old 05-25-2012, 12:41 PM   #4
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,732
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Have you cross checked the major and minor numbers used in MKDEV?
 
1 members found this post helpful.
Old 05-26-2012, 02:10 AM   #5
sindhu4sind
Member
 
Registered: Apr 2012
Posts: 38

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Anisha Kaul View Post
Have you cross checked the major and minor numbers used in MKDEV?
Thank you Anisha Kaul,

I got a solution.. Here I am sharing for helping others.. May be I am the only one who's facing such kind of issues because not very well known of C language and kernel programming.. but what ever, i love to share my solutions:

I have re-defined the device_create parameters if the kernel version is above than 2.6.15, like this:
Code:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
    #define my_device_create(a, b, c, d) device_create(a, b, c, NULL, d)
#else
    #define my_device_create(a, b, c, d) device_create(a, b, c, d)
#endif
It worked for me..

Thanks for response..

Sindhu
 
1 members found this post helpful.
  


Reply

Tags
create, dev, device, function, linux


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cdrecord and it arguments. stf92 Slackware 4 04-26-2012 02:11 AM
[SOLVED] How to use su with arguments? Red Squirrel Linux - Software 3 06-01-2011 09:12 PM
[SOLVED] [: too many arguments hd_pulse Programming 2 05-26-2011 01:35 PM
[SOLVED] arguments if statement brownie_cookie Linux - Newbie 4 05-03-2011 04:59 AM
C Function Arguments jpbarto Programming 6 04-23-2004 01:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration