LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 11-28-2009, 09:04 AM   #1
kulturfenster
LQ Newbie
 
Registered: Nov 2009
Distribution: Ubuntu 9.10, 64Bit
Posts: 2

Rep: Reputation: 0
Question error: too few arguments to function ‘register_chrdev_region’


hi everybody,
i am doing a kernel module. I am trying to keep it simple. However, i keep on getting errors i don't understand.
The error
Code:
error: too few arguments to function ‘register_chrdev_region’
points to the following line:
Code:
result = register_chrdev_region(dev_number, 1, name);
furthermore, i get the following error:
Code:
error: expected ‘)’ before ‘;’ token
which points to the following line:
Code:
		result = alloc_chrdev_region(&dev_number, minor, 1, name);
These lines are in the following function:
Code:
static int mymodule_init(void)
{
	int result;			// to save the return value	
	
	if(major)			// static allocation
	{
		dev_number = MKDEV(major, minor);
		result = register_chrdev_region(dev_number, 1, name);
	}
	else				// dynamic allocation
	{
		result = alloc_chrdev_region(&dev_number, minor, 1, name);
		major= MAJOR(dev_number);
	} 
	
	// error handling
	if(result < 0)
	{
		printk(KERN_WARNING "Warning: can't get major %d\n", major);
		return result;
	}
	
	//printk(KERN_ALERT "My Major Number: %d\nMy Minor Number: %d\n", major, minor);

	//setup_cdev(&cdev);
	
	return 0;
}
does anybody see where i made the mistakes?? thanks in advance!
 
Old 11-29-2009, 07:48 AM   #2
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: Debian-woody->(testing) ->lenny->squeeze32/64-> wheezy(32/64)
Posts: 1,293

Rep: Reputation: 67
Hya,

Where is the definition of that "alloc_chrdev_region" function?

According to this site, and if this is the one you want to use, this function takes 4 arguments. You have only 3.

cheers

Happy Penguins!

Last edited by kaz2100; 11-29-2009 at 07:53 AM.
 
  


Reply

Tags
kernel, module


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
too few arguments to function 'register_sysctl_table' Richard.Yang Linux - Kernel 2 07-31-2009 08:31 AM
How to import arguments to system() function skie_knite007 Programming 5 03-25-2005 08:49 PM
Passing Arguments into the Thread Function George_gk Programming 2 01-31-2005 05:03 AM
C Function Arguments jpbarto Programming 6 04-23-2004 01:59 PM
Function accept() and its arguments. krajzega Programming 1 01-20-2004 01:26 AM


All times are GMT -5. The time now is 07:50 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration