LINUX
DEVICE
DRIVERS
,TITLE.9502 Page i Thursday, January 27, 2005 12:06 PM
Other Linux resources from O’Reilly
Related titles
Understanding the Linux
Kernel
Linux in a Nutshell
Running Linux
Linux Network
Administrator’s Guide
Linux Pocket Guide
Building Embedded Linux
Systems
Designing Embedded
Hardware
Linux Books
Resource Center
linux.oreilly.com is a complete catalog of O’Reilly’s books on
Linux and Unix and related technologies, including sample
chapters and code examples.
ONLamp.com is the premier site for the open source web plat-
form: Linux, Apache, MySQL, and either Perl, Python, or PHP.
Conferences
O’Reilly brings diverse innovators together to nurture the ideas
that spark revolutionary industries. We specialize in document-
ing the latest tools and systems, translating the innovator’s
knowledge into useful skills for those in the trenches. Visit con-
ferences.oreilly.com for our upcoming events.
Safari Bookshelf (safari.oreilly.com) is the premier online refer-
ence library for programmers and IT professionals. Conduct
searches across more than 1,000 books. Subscribers can zero in
on answers to time-critical questions in a matter of seconds.
Read the books on your Bookshelf from cover to cover or sim-
ply flip to the page you need. Try it today with a free trial.
,TITLE.9502 Page ii Thursday, January 27, 2005 12:06 PM
LINUX
DEVICE
DRIVERS
THIRD EDITION
Jonathan Corbet, Alessandro
Rubini, and Greg Kroah-Hartman
Beijing
•
Cambridge
•
Farnham
•
Köln
•
Paris
•
Sebastopol
•
Taipei
•
Tokyo
,TITLE.9502 Page iii Thursday, January 27, 2005 12:06 PM
Linux Device Drivers, Third Edition
by Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman
Copyright © 2005, 2001, 1998 O’Reilly Media, Inc. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (safari.oreilly.com). For more information, contact our corporate/insti-
tutional sales department: (800) 998-9938 or corporate@oreilly.com.
Editor:
Andy Oram
Production Editor:
Matt Hutchinson
Production Services:
Octal Publishing, Inc.
Cover Designer:
Edie Freedman
Interior Designer:
Melanie Wang
Printing History:
February 1998: First Edition.
June 2001: Second Edition.
February 2005: Third Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. The Linux series designations, Linux Device Drivers, images of the American West,
and related trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors
assume no responsibility for errors or omissions, or for damages resulting from the use of the
information contained herein.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 2.0
License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/ or send a
letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
This book uses RepKover
™
, a durable and flexible lay-flat binding.
ISBN: 0-596-00590-3
[M]
,COPYRIGHT.10321 Page iv Thursday, January 27, 2005 12:09 PM
About the Authors
Jonathan Corbet got his first look at the BSD Unix source back in 1981, when an
instructor at the University of Colorado let him “fix” the paging algorithm. He has
been digging around inside every system he could get his hands on ever since,
working on drivers for VAX, Sun, Ardent, and x86 systems. He got his first Linux
system in 1993 and has never looked back. Jonathan is currently the cofounder and
executive editor of Linux Weekly News (http://www.LWN.net). He lives in Boulder,
Colorado with his wife and two children.
Alessandro Rubini installed Linux 0.99.14 soon after getting his degree as an elec-
tronic engineer. He then received a Ph.D. in computer science at the University of
Pavia despite his aversion toward modern technology. He left the University after
getting his Ph.D. because he didn’t want to write articles. He now works as a
freelancer, writing device drivers and articles. He used to be a young hacker before
his babies were born; now he’s an old advocate of free software who developed a bias
for non-PC computer platforms.
Greg Kroah-Hartman has been writing Linux kernel drivers since 1999 and is
currently the maintainer for the USB, PCI, I2C, driver core, and sysfs kernel
subsystems. He is also the maintainer of the udev and hotplug userspace programs,
as well as a Gentoo kernel maintainer, ensuring that his inbox is never empty. He is a
contributing editor to Linux Journal magazine.
Colophon
Our look is the result of reader comments, our own experimentation, and feedback
from distribution channels. Distinctive covers complement our distinctive approach
to technical topics, breathing personality and life into potentially dry subjects.
The image on the cover of Linux Device Drivers, Third Edition is a bucking bronco.
A colorful description of this animal appears in Marvels of the New West: A Vivid
Portrayal of the Stupendous Marvels in the Vast Wonderland West of the Missouri
River, by William Thayer (The Henry Bill Publishing Co., Norwich, CT, 1888).
Thayer quotes a stockman, who gives this description of a bucking horse: “When a
horse bucks he puts his head down between his legs, arches his back like an angry
cat, and springs into the air with all his legs at once, coming down again with a
frightful jar, and he sometimes keeps on repeating the performance until he is
completely worn out with the excursion. The rider is apt to feel rather worn out too
by that time, if he has kept his seat, which is not a very easy matter, especially if the
horse is a real scientific bucker, and puts a kind of side action into every jump. The
double girth commonly attached to these Mexican saddles is useful for keeping the
saddle in its place during one of those bouts, but there is no doubt that they
frequently make a horse buck who would not do so with a single girth. With some
animals you can never draw up the flank girth without setting them bucking.”
,AUTHOR.COLO.15565 Page 617 Thursday, January 27, 2005 12:32 PM