Sophie

Sophie

distrib > CentOS > 6 > i386 > by-pkgid > 2c51d8eb79f8810ada971ee8c30ce1e5 > files > 3743

kernel-doc-2.6.32-71.14.1.el6.noarch.rpm

<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>Using uio_pdrv for platform devices</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="The Userspace I/O HOWTO" /><link rel="up" href="custom_kernel_module.html" title="Chapter&#160;3.&#160;Writing your own kernel module" /><link rel="prev" href="ch03s02.html" title="Adding an interrupt handler" /><link rel="next" href="ch03s04.html" title="Using uio_pdrv_genirq for platform devices" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Using uio_pdrv for platform devices</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;3.&#160;Writing your own kernel module</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch03s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="Using uio_pdrv for platform devices"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="using_uio_pdrv"></a>Using uio_pdrv for platform devices</h2></div></div></div><p>
	In many cases, UIO drivers for platform devices can be handled in a
	generic way. In the same place where you define your
	<code class="varname">struct platform_device</code>, you simply also implement
	your interrupt handler and fill your
	<code class="varname">struct uio_info</code>. A pointer to this
	<code class="varname">struct uio_info</code> is then used as
	<code class="varname">platform_data</code> for your platform device.
	</p><p>
	You also need to set up an array of <code class="varname">struct resource</code>
	containing addresses and sizes of your memory mappings. This
	information is passed to the driver using the
	<code class="varname">.resource</code> and <code class="varname">.num_resources</code>
	elements of <code class="varname">struct platform_device</code>.
	</p><p>
	You now have to set the <code class="varname">.name</code> element of
	<code class="varname">struct platform_device</code> to
	<code class="varname">"uio_pdrv"</code> to use the generic UIO platform device
	driver. This driver will fill the <code class="varname">mem[]</code> array
	according to the resources given, and register the device.
	</p><p>
	The advantage of this approach is that you only have to edit a file
	you need to edit anyway. You do not have to create an extra driver.
	</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="custom_kernel_module.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="ch03s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Adding an interrupt handler&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Using uio_pdrv_genirq for platform devices</td></tr></table></div></body></html>