LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 07-19-2013, 07:53 AM   #1
moo-cow
Member
 
Registered: Mar 2006
Distribution: Debian
Posts: 105

Rep: Reputation: 26
I/O error in code example from "Essential Linux Device Drivers"


Hi,

I'm trying to run a code example from the book "Essential Linux Device Drivers". It's a driver module that's supposed to access the CMOS memory banks (port 0x70). Inserting the module fails with -EIO, which is caused by the following section of the code:

Code:
/* Request I/O region */
sprintf(cmos_devp[i]->name, "cmos%d", i);
if (!(request_region(addrports[i], 2, cmos_devp[i]->name))) {
    printk("cmos: I/O port 0x%x is not free.\n", addrports[i]);
    return -EIO;
}
My guess is that this fails because the memory region has been reserved already by the RTC driver (?). How can I fix the code? I'm using kernel version 3.2.46, the book code was written for a 2.6 kernel. I had to make some minor changes to get the code compiled.

Many thanks!

Last edited by moo-cow; 07-26-2013 at 07:18 AM.
 
Old 07-20-2013, 02:43 AM   #2
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
if you do not need the RTC driver then remove it. The port should become free. Else you will have to change the memory region.
 
1 members found this post helpful.
Old 07-26-2013, 07:20 AM   #3
moo-cow
Member
 
Registered: Mar 2006
Distribution: Debian
Posts: 105

Original Poster
Rep: Reputation: 26
Thanks, that did the trick! I removed the RTC driver from the kernel config and did a recompile. The kernel has a legacy RTC driver that can be compiled as a module. I used that driver as a replacement for the new driver, which cannot be modularized.
 
  


Reply



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
[SOLVED] "missing kernel .config file" error while compiling linux source code for android preetb123 Linux - Mobile 3 03-19-2011 07:46 AM
Facing error while running "g++ 3.4.4" code in "g++ 4.3.3" Suranjit Ubuntu 2 10-08-2009 11:22 PM
Can't find the "Linux Device Drivers" online book! gentoolman Linux - Hardware 4 01-16-2007 12:36 PM
Gentoo Linux error: VFS can not open root device "302" Thaidog Linux - Distributions 0 12-10-2006 09:35 PM
Getting error: "ALSA device "default" is already in use by another program." brynjarh Debian 7 02-04-2005 11:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:47 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