Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

__iomem cookie

__iomem is a kernel cookie used by Sparse, a semantic checker used by the kernel to find possible coding faults. To take advantage of the features offered by Sparse, it should be enabled at kernel compile time; if not, __iomem cookie will be ignored anyway.

The C=1 in the command line will enable Sparse for you, but Sparse should be installed first on your system:

sudo apt-get install sparse  

For example, when building a module, use:

make -C $KPATH M=$PWD C=1 modules

Alternatively, if the makefile is well-written, just type:

make C=1  

The following shows how __iomem is defined in the kernel:

#define __iomem    __attribute__((noderef, address_space(2))) 

It protects us from faulty drivers performing I/O memory access. Adding the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content