Index: linux-2.6.22-rc/drivers/uio/uio.c =================================================================== --- linux-2.6.22-rc.orig/drivers/uio/uio.c 2007-05-02 08:32:19.000000000 +0200 +++ linux-2.6.22-rc/drivers/uio/uio.c 2007-05-03 08:21:39.000000000 +0200 @@ -234,7 +234,7 @@ /** * uio_event_notify - trigger an interrupt event - * @idev: UIO device where the event occured + * @info: UIO device capabilities */ void uio_event_notify(struct uio_info *info) { @@ -582,9 +582,9 @@ /** * uio_register_device - register a new userspace IO device - * + * @owner: module that creates the new device * @parent: parent device - * @idev: device capabilities + * @info: UIO device capabilities * * returns zero on success or a negative error code. */ @@ -660,9 +660,8 @@ /** * uio_unregister_device - unregister a industrial IO device - * @uiodev: UIO device driver identifier + * @info: UIO device capabilities * - * returns 0 on success */ void uio_unregister_device(struct uio_info *info) { Index: linux-2.6.22-rc/include/linux/uio_driver.h =================================================================== --- linux-2.6.22-rc.orig/include/linux/uio_driver.h 2007-05-02 08:24:38.000000000 +0200 +++ linux-2.6.22-rc/include/linux/uio_driver.h 2007-05-02 08:42:42.000000000 +0200 @@ -19,7 +19,7 @@ #include /** - * uio_mem - description of a UIO memory region + * struct uio_mem - description of a UIO memory region * @kobj: kobject for this mapping * @addr: address of the device's memory * @size: size of IO @@ -39,13 +39,13 @@ struct uio_device; /** - * uio_info - UIO device capabilities + * struct uio_info - UIO device capabilities * @uio_dev: the UIO device this info belongs to * @name: device name * @version: device driver version * @mem: list of mappable memory regions, size==0 for end of list * @irq: interrupt number or UIO_IRQ_CUSTOM - * @irq_flags flags for request_irq() + * @irq_flags: flags for request_irq() * @priv: optional private data * @handler: the device's irq handler * @mmap: mmap operation for this uio device @@ -56,7 +56,7 @@ struct uio_device *uio_dev; char *name; char *version; - struct uio_mem mem[ MAX_UIO_MAPS ]; + struct uio_mem mem[MAX_UIO_MAPS]; long irq; unsigned long irq_flags; void *priv; Index: linux-2.6.22-rc/Documentation/DocBook/Makefile =================================================================== --- linux-2.6.22-rc.orig/Documentation/DocBook/Makefile 2007-05-02 09:00:32.000000000 +0200 +++ linux-2.6.22-rc/Documentation/DocBook/Makefile 2007-05-02 09:43:06.000000000 +0200 @@ -11,7 +11,7 @@ procfs-guide.xml writing_usb_driver.xml \ kernel-api.xml filesystems.xml lsm.xml usb.xml \ gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ - genericirq.xml + genericirq.xml uio-howto.xml ### # The build process is as follows (targets): Index: linux-2.6.22-rc/Documentation/DocBook/uio-howto.tmpl =================================================================== --- linux-2.6.22-rc.orig/Documentation/DocBook/uio-howto.tmpl 2007-05-02 08:54:24.000000000 +0200 +++ linux-2.6.22-rc/Documentation/DocBook/uio-howto.tmpl 2007-05-02 10:24:18.000000000 +0200 @@ -1,9 +1,9 @@ - + -
- + + The Userspace I/O HOWTO @@ -48,13 +48,13 @@ First draft. - + - + About this document - + Copyright and License @@ -63,9 +63,9 @@ This documentation is Free Software licensed under the terms of the GPL version 2. - + - + Translations @@ -73,9 +73,9 @@ interested in translating it, please email me hjk@linutronix.de. - + - + Preface For many types of devices, creating a Linux kernel driver is @@ -94,25 +94,25 @@ user space. This simplifies development and reduces the risk of serious bugs within a kernel module. - + - + Acknowledgments I'd like to thank Thomas Gleixner and Benedikt Spranger of Linutronix, who have not only written most of the UIO code, but also helped greatly writing this HOWTO by giving me all kinds of background information. - + - + Feedback Find something wrong with this document? (Or perhaps something right?) I would love to hear from you. Please email me at hjk@linutronix.de. - + - + About UIO @@ -139,7 +139,7 @@ - + How UIO works Each UIO device is accessed through a device file and several @@ -188,7 +188,7 @@ files. A custom kernel driver module can add its own attributes to the device owned by the uio driver, but not added to the UIO device itself at this time. This might change in the - future if it would be found to be useful + future if it would be found to be useful. @@ -264,10 +264,10 @@ offset = N * getpagesize(); - + - + Using uio_dummy @@ -277,7 +277,7 @@ kernel module that you will have to write yourself. - + What uio_dummy does The kernel module uio_dummy.ko creates a @@ -316,10 +316,10 @@ Use cat count to see how the interrupt frequency changes. - + - + Writing your own kernel module @@ -328,7 +328,7 @@ sections of this file. - + struct uio_info This structure tells the framework the details of your driver, @@ -336,24 +336,24 @@ - + char *name: Required. The name of your driver as it will appear in sysfs. I recommend using the name of your module for this. - + - + char *version: Required. This string appears in /sys/class/uio/uioX/version. - + - + struct uio_mem mem[ MAX_UIO_MAPS ]: Required if you have memory that can be mapped with mmap(). For each mapping you need to fill one of the uio_mem structures. See the description below for details. - + - + long irq: Required. If your hardware generates an interrupt, it's your modules task to determine the irq number during initialization. If you don't have a hardware generated interrupt but @@ -363,35 +363,35 @@ routine. If you had no interrupt at all, you could set irq to UIO_IRQ_NONE, though this rarely makes sense. - + - + unsigned long irq_flags: Required if you've set irq to a hardware interrupt number. The flags given here will be used in the call to request_irq(). - + - + int (*mmap)(struct uio_info *info, struct vm_area_struct *vma): Optional. If you need a special mmap() function, you can set it here. If this pointer is not NULL, your mmap() will be called instead of the built-in one. - + - + int (*open)(struct uio_info *info, struct inode *inode) : Optional. You might want to have your own open(), e.g. to enable interrupts only when your device is actually used. - + - + int (*release)(struct uio_info *info, struct inode *inode) : Optional. If you define your own open(), you will probably also want a custom release() function. - + @@ -402,36 +402,36 @@ - + int memtype: Required if the mapping is used. Set this to UIO_MEM_PHYS if you you have physical memory on your card to be mapped. Use UIO_MEM_LOGICAL for logical memory (e.g. allocated with kmalloc()). There's also UIO_MEM_VIRTUAL for virtual memory. - + - + unsigned long addr: Required if the mapping is used. Fill in the address of your memory block. This address is the one that appears in sysfs. - + - + unsigned long size: Fill in the size of the memory block that addr points to. If size is zero, the mapping is considered unused. Note that you must initialize size with zero for all unused mappings. - + - + void *internal_addr: If you have to access this memory region from within your kernel module, you will want to map it internally by -using something like ioremap_nocache(). Addresses -returned by this function can not be mapped to user space, so you must not +using something like ioremap(). Addresses +returned by this function cannot be mapped to user space, so you must not store it in addr. Use internal_addr instead to remember such an address. - + @@ -439,9 +439,9 @@ struct uio_mem! It is used by the UIO framework to set up sysfs files for this mapping. Simply leave it alone. - + - + Adding an interrupt handler What you need to do in your interrupt handler depends on your @@ -453,7 +453,7 @@ hand, your hardware needs some action to be performed after each interrupt, then you must do it in your kernel module. Note - that you cannot rely on the userspace part of your driver.Your + that you cannot rely on the userspace part of your driver. Your userspace program can terminate at any time, possibly leaving your hardware in a state where proper interrupt handling is still required. @@ -486,11 +486,11 @@ frequently happens on the PC platform, you can save yourself a lot of trouble by supporting interrupt sharing. - - - + + + Writing a driver in userspace @@ -502,7 +502,7 @@ userspace application. - + Getting information about your UIO device Information about all UIO devices is available in sysfs. The @@ -534,9 +534,9 @@ The file uio_helper.c contains a lot of functions you could use in your userspace driver code. - + - + mmap() device memory After you made sure you've got the right device with the @@ -561,9 +561,9 @@ A drawback of this technique is that memory is always mapped beginning with its start address. - + - + Waiting for interrupts After you successfully mapped your devices memory, you @@ -590,10 +590,10 @@ You can also use select() on /dev/uioX. - - + + Further information @@ -608,4 +608,4 @@ -
+