Linux Device Drivers

Errata for Linux Device Drivers

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Printed
Page xvii
The UUCP address "uunet!oreilly!info" was removed from the text.

Anonymous    Feb 01, 2000
Printed
Page 3
para. -1, last two lines: "the simple malloc/free

pair" changed to "simple malloc/free equivalents" ("malloc/free" is still italicized.)

Anonymous    Aug 01, 1998
Printed
Page 14
Add the following text after the code at the top of the page

Depending on which distribution you are running, you may see an "undefined symbol printk" message at this point. This message implies that your kernel has module versioning enabled. We will get into versioning in <xref linkend=KerVer>; in the meantime, you can get around this problem by adding the line: # include <linux/modversions.h> at the top of your source file. You will need to make this change to the other sample drivers used in this book as well.

Anonymous   
Printed
Page 14
4th line of code

root# rmmod hello.o now reads: root# rmmod hello

Anonymous    Jun 01, 1999
Printed
Page 20
para. 3, line 2: "sys_create_module" is italicized.

line 6: "sys_init_module" is italicized.

Anonymous    Aug 01, 1998
Printed
Page 25
description of variable list term, "Exec domains"

in the last line of the paragraph change "the module defines the execution" to "the iBCS2 module defines the execution"

Anonymous    Jun 01, 1998
Printed
Page 25

The text used to read: "If any errors occur when you register utilities..." It now reads: "If any errors occur when you register facilities..."

Anonymous    Jun 01, 2000
Printed
Page 27
The line "Decrements the count." was changed to roman font.

Anonymous    Jun 01, 2000
Printed
Page 27

The text used to read: "This situation may very well to happen..." It now reads: "This situation may very well happen..."

Anonymous    Jun 01, 2000
Printed
Page 29
At the bottom of the page, replace

to avoid corrupting system operation by interacting with hardware whose module has yet to be loaded, and thus has not yet reserved its own I/O ports. with: to avoid the potential risk to damage operation of a running system, by misconfiguring hardware that may live in a location being probed.

Anonymous   
Printed
Page 30
In the second paragraph, the word "ioports" now reads "ioport"

(no "s").

Anonymous    Jun 01, 1999
Printed
Page 33

The code used to read: add += (size & ~2048) - 2048; /* skip it */ It now reads: add += ((size + 2047) & ~2047) -2048; /* skip it */

Anonymous    Jun 01, 2000
Printed
Page 35
I noticed a missing ')' on the 9th line.

It says '(described in Chapter 15.'

Anonymous   
Printed
Page 45

The code used to read: chgrp $group /dev/${device} chmod $mode /dev/${device} It now reads: chgrp $group /dev/${device}[0-3] chmod $mode /dev/${device}[0-3]

Anonymous    Jun 01, 2000
Printed
Page 46

The text before the code used to read: "scull.c" It now reads: "scull/main.c"

Anonymous    Jun 01, 2000
Printed
Page 48
para. -1, line 1: "Linux 2.1" changed to "Linux 1.2"

and line 2: "functions, thus why" changed to "functions. That's why"

Anonymous    Aug 01, 1998
Printed
Page 54

The section heading used to read: "Open and Close" It now reads: "Open and Release"

Anonymous    Jun 01, 2000
Printed
Page 56

The code used to read: return filp->f_op->open(inode, filp); It now reads: return filp->f_op->open(inode, filp); /* dispatch to specific open */

Anonymous    Jun 01, 2000
Printed
Page 57

The paragraph beginning with "A new struct file..." was changed to read: "A new "struct file" is created only by "open". The "close" system call executes the "release" method only when the counter for the structure drops to zero, which happens when the structure is destroyed. This relationship between the "release" method and the "close" system call guarantees that the usage count for modules is always consistent."

Anonymous    Jun 01, 2000
Printed
Page 65
line 1: changed from

count = quantum - q_pos; /* read only up to /* to count = quantum - q_pos; /* read only up to */

Anonymous    Jun 01, 1998
Printed
Page 66
line 24: changed

count = quantum -q_pos; /* write only up to /* to count = quantum -q_pos; /* write only up to */

Anonymous    Jun 01, 1998
Printed
Page 70
paragraph 4, line 5: changed

"MINIMUM_ CONSOLE_LOGLEVEL" to "MINIMUM_CONSOLE_LOGLEVEL" (removed space.)

Anonymous    Jun 01, 1998
Printed
Page 72
In the second line of first (partial) paragraph

Where it says: "issue the command cat /proc/kmesg" it should say: "issue the command cat /proc/kmsg"

Anonymous   
Printed
Page 78
para. 2, "let's read the scull device": "scull" is

italicized

Anonymous    Aug 01, 1998
Printed
Page 83
last paragraph: replaced the sentence beginning

"Another advantage of oops is ..." with Like the original ksyms, the program is able to decode oops messages generated on Intel platforms only. Porting to other platforms shouldn't be difficult. ("ksysm" is in italics.)

Anonymous    Jun 01, 1998
Printed
Page 83

(83) para.4 line -1 removed (there is no bibliography in the book)

Anonymous    Dec 01, 1998
Printed
Page 87
para. 4, line -1: "disks" changed to "filesystems"

Anonymous    Aug 01, 1998
Printed
Page 91
para. 4, line 2: changed "kgdb" from constant-width

font to italics.

Anonymous    Aug 01, 1998
Printed
Page 93
list item 2, line 3: changed "kgdb" from constant-width

font to italics.

Anonymous    Aug 01, 1998
Printed
Page 106
para. 7, line 4: removed footnote after "preferred"

Anonymous    Aug 01, 1998
Printed
Page 108
paragraph 3, line 3: changed

"(the next queue in the list)" to "(the next item in the list)"

Anonymous    Jun 01, 1998
Printed
Page 125
para. 6, line 2: "open" is italicized.

Anonymous    Aug 01, 1998
Printed
Page 131
last paragraph, line 2: changed

"since the computer was turned on" to "since the operating system was booted"

Anonymous    Jun 01, 1998
Printed
Page 169
In the last Paragraph,

Mr Rubini introduced the "Digital Resistor" to us. If resistors could store data!? Please replace "1KB" resistor with {LaTeX} "1k/ohmega resistor"

Anonymous   
Printed
Page 180
description of fourth item in the list: changed

"the self object" to "the this object" ("this" is in constant-width font)

Anonymous    Jun 01, 1998
Printed
Page 208

The line used to read: "The return value is 0 only if the variable *v is 0 after being decremented." It now reads: "The return value is 1 only if the variable *v is 0 after being decremented, 0 otherwise."

Anonymous    Jun 01, 2000
Printed
Page 209
In chapter 9 ("Interrupt Handling"), in the section called

"Going to Sleep Without Races", the code had a subtle bug. The correct implementation of the trick looks like the following: add_wait_queue(&short_queue, &wait); do { current->state = TASK_INTERRUPTIBLE; schedule(); } while ((short_head == short_tail) && !(current->signal & ~current->blocked) ); remove_wait_queue(&short_queue, &wait); if (current->signal & ~current->blocked) /* a signal arrived */ return -ERESTARTSYS; This is different from the version shown in the printed text as signal decoding must be performed *after* calling remove_wait_queue().

Anonymous    Jun 01, 1999
Printed
Page 230
paragraph 5, line 1: changed "master.ver" to "export.ver"

("export.ver" is italics)

Anonymous    Jun 01, 1998
Printed
Page 245
para. 1, line 2: "follwing" changed to "following"

Anonymous    Aug 01, 1998
Printed
Page 245

The line used to read: "....request function in the sbull device is show below." It now reads: "....request function in the sbull device is shown below."

Anonymous    Jun 01, 2000
Printed
Page 246
paragraph 1, line 4: changed "end_request(1)" to

"end_request(0)" (in constant-width font)

Anonymous    Jun 01, 1998
Printed
Page 274
the description of int (*swapout) has been replaced with the

following: int (*swapout)(struct vm_area_struct *vma, unsigned long offset, pte_t *page_table); This method is called when a page is selected for swap-out. The [cw]offset[/] argument is the file offset: [cw]virt_address - vma->vm_start + vma->vm_offset[/]. A return value of 0 signals success; any other value signals an error. In case of error, the process owning the page is sent a [cw]SIGBUS[/]. In version 1.2, the function returned [cw]void[/] because it was never expected to fail. The method usually writes useful information to [cw]*page_table[/], so it can be retrieved at swap-in. Such information can be, for example, the offset in the swap device. pte_t (*swapin)(struct vm_area_struct *, unsigned long offset, unsigned long entry); This method is used to retrieve a page from swap space. The [cw]offset[/] argument is relative to the area (as above for <F>swapout</>), while [cw]entry[/] is the current [cw]pte[/] for the page -- if <F>swapout</> saved some information in the entry, that information can now be used to retrieve the page. ("[cw]" and "[/]" indicate that text that should appear in constant width. "<F>" and "</>" indicate that text that should appear in italic.)

Anonymous    Jun 01, 1999
Printed
Page 276
paragraph 3, line 2: changed

"the X server transfers a lot of data to and from video memory." to "the X server transfers a lot of data from video memory."

Anonymous    Jun 01, 1998
Printed
Page 290

The last sentence on the page now reads: "If you use kmalloc you must specify GFP_DMA priority, ...."

Anonymous    Jun 01, 1999
Printed
Page 291-292
Removed all the paragraphs from "Actually, there is

another way to allocate" to the end of the section. In their place, added the following paragraph: My own implementation of allocating DMA buffers is available as an allocator.c module (with an accompanying header). You can find a version in the sample files within src/misc-modules; and the latest version is always available from my own ftp site, ftp://ftp.systemy.it/pub/develop. You could also look for the bigphysarea kernel patch, which is meant to accomplish the same goal as my allocator. ("allocator.c," "src/misc-modules," "ftp://ftp.systemy.it/pub/ develop" and "big physarea" are all in italics.)

Anonymous    Jun 01, 1998
Printed
Page 292
(This change is optional; it was meant to make the page

look better after we removed three paragraphs from the preceding section.) Added the following paragraph and code sample after the paragraphh ending, "...when address information is received from hardware connected to the bus." If you look at code that relies on the allocator engine described earlier, you'll find a sample use of these functions. The code relies also on vremap because of the context: ("allocator" and "vremap" are in italics.) /* the allocator returns a physical address */ dev->dmabuffer = allocator_allocate_dma(kilobytes, GFP_KERNEL); /* map it in the virtual address space */ dev->dmavbuffer = vremap(dev-&gt;dmabuffer, kilobytes*1024); /* ... */ /* pass the address to the device */ writel(virt_to_bus(dev->dmavbuffer, dev->registers + DEV_DMA_ADDRESS);

Anonymous    Jun 01, 1998
Printed
Page 302
para. 6, lines 1-2: "shouldn't be bound to real hardware"

changed to "should remain independent of real hardware" and "just like all" changed to "just like most of"

Anonymous    Aug 01, 1998
Printed
Page 315
paragraph before "The device methods" section, line 5

changed "IFF_PROMISCUOUS" to "IFF_PROMISC"

Anonymous    Jun 01, 1998
Printed
Page 321

The code used to read: if (dev->tbusy) { /* shouldn't happen */ retval = -EBUSY; goto tx_done; } It now reads: if (dev->tbusy) { /* shouldn't happen */ return -EBUSY; }

Anonymous    Jun 01, 2000
Printed
Page 321

The code used to read: tx_done: dev_kfree_skb(skb, FREE_WRITE); /* release it */ It now reads: tx_done: skb->free=1; dev_kfree_skb(skb, FREE_WRITE); /* release it */

Anonymous    Jun 01, 2000
Printed
Page 326
The following text was added to the variable list

"volatile char free; The flag must be set before the skb structure is freed."

Anonymous    Jun 01, 2000
Printed
Page 353
The following text was removed from the page

"The specification also states that the address regions are allocated in order, from PCI_BASE_ADDRESS_0 to PCI_BASE_ADDRESS_5; as soon as one base address is unused (i.e. set to 0), you know that any subsequent address is also unused."

Anonymous    Jun 01, 2000
Printed
Page 389
In the sample code for scull_p_poll

The code for scull_p_poll contains if (left) mask |= POLLOUT | POLLWRNORM; /* writable */ but I think it should be if (left > 1) mask |= POLLOUT | POLLWRNORM; /* writable */ because if left==1 then we *cannot* write without blocking. Also, the comment /* how many bytes left there to be read? */ int left = (dev->rp + dev->buffersize - dev->wp) % dev->buffersize; is wrong; it's how many bytes are left *in the buffer*.

Anonymous   
Printed
Page 392
Under the category "unsigned long copy_from_user",

"memcpy_tofs" was changed to: "copy_to_user".

Anonymous    Feb 01, 2000
Printed
Page 392

The text in the middle of the page used to read: "memcpy_tofs" It now reads: "memcpy_fromfs"

Anonymous    Jun 01, 2000
Printed
Page 394
In the code sample

if (_IOC_DIR(cmd) & _IOC_READ) { if (!access_ok(VERIFY_WRITE, (void *)arg, size)) retturn -EFAULT; "retturn" should be "return"

Anonymous   
Printed
Page 394
In chapter 17, in the section called "Using the New

Interface", the ioctl() implementation shown included a mistake: "retval" is not initialized. A correct implementation is: int another_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); { int retval = -EINVAL, size = _IOC_SIZE(cmd); if (_IOC_DIR(cmd) & _IOC_READ) { if (!access_ok(VERIFY_WRITE, (void *)arg, size)) retturn -EFAULT; } else if (_IOC_DIR(cmd) & _IOC_WRITE) { if (!access_ok(VERIFY_READ, (void *)arg, size)) return -EFAULT switch(cmd) { case NEW_GETVALUE: retval = __put_user(another_value,arg); break; case NEW_SETVALUE: retval = __get_user(another_value,arg); break; } return retval; }

Anonymous    Jun 01, 1999
Printed
Page 397
paragraph 4, line 5: changed

"16-byte little-endian" to "16-bit little-endian"

Anonymous    Jun 01, 1998
Printed
Page 399
description of ".fixup" list item: changed

"The second pointer of the table" to "The second pointer of each pair in the table"

Anonymous    Jun 01, 1998
Printed
Page 408
changed index entry "firmware, PIC-aware" to

"firmware, PCI-aware"

Anonymous    Jun 01, 1998
Printed
Page 409
changed index entry "infline functions" to

"inline functions"

Anonymous    Jun 01, 1998