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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-25-2012, 04:10 AM
|
#1
|
Member
Registered: Apr 2012
Posts: 38
Rep:
|
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.
|
|
|
05-25-2012, 10:31 AM
|
#3
|
Member
Registered: Apr 2012
Posts: 38
Original Poster
Rep:
|
Quote:
Originally Posted by Anisha Kaul
|
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
|
|
|
05-25-2012, 12:41 PM
|
#4
|
Senior Member
Registered: Dec 2008
Posts: 4,732
|
Have you cross checked the major and minor numbers used in MKDEV?
|
|
1 members found this post helpful.
|
05-26-2012, 02:10 AM
|
#5
|
Member
Registered: Apr 2012
Posts: 38
Original Poster
Rep:
|
Quote:
Originally Posted by Anisha Kaul
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.
|
All times are GMT -5. The time now is 02:17 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|