Skip to content

Commit 40d7ee5

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (60 commits) uio: make uio_info's name and version const UIO: Documentation for UIO ioport info handling UIO: Pass information about ioports to userspace (V2) UIO: uio_pdrv_genirq: allow custom irq_flags UIO: use pci_ioremap_bar() in drivers/uio arm: struct device - replace bus_id with dev_name(), dev_set_name() libata: struct device - replace bus_id with dev_name(), dev_set_name() avr: struct device - replace bus_id with dev_name(), dev_set_name() block: struct device - replace bus_id with dev_name(), dev_set_name() chris: struct device - replace bus_id with dev_name(), dev_set_name() dmi: struct device - replace bus_id with dev_name(), dev_set_name() gadget: struct device - replace bus_id with dev_name(), dev_set_name() gpio: struct device - replace bus_id with dev_name(), dev_set_name() gpu: struct device - replace bus_id with dev_name(), dev_set_name() hwmon: struct device - replace bus_id with dev_name(), dev_set_name() i2o: struct device - replace bus_id with dev_name(), dev_set_name() IA64: struct device - replace bus_id with dev_name(), dev_set_name() i7300_idle: struct device - replace bus_id with dev_name(), dev_set_name() infiniband: struct device - replace bus_id with dev_name(), dev_set_name() ISDN: struct device - replace bus_id with dev_name(), dev_set_name() ...
2 parents 5fec8bd + b8ac9fc commit 40d7ee5

129 files changed

Lines changed: 1063 additions & 701 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/DocBook/uio-howto.tmpl‎

Lines changed: 99 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ GPL version 2.
4141
</abstract>
4242

4343
<revhistory>
44+
<revision>
45+
<revnumber>0.6</revnumber>
46+
<date>2008-12-05</date>
47+
<authorinitials>hjk</authorinitials>
48+
<revremark>Added description of portio sysfs attributes.</revremark>
49+
</revision>
4450
<revision>
4551
<revnumber>0.5</revnumber>
4652
<date>2008-05-22</date>
@@ -318,6 +324,54 @@ interested in translating it, please email me
318324
offset = N * getpagesize();
319325
</programlisting>
320326

327+
<para>
328+
Sometimes there is hardware with memory-like regions that can not be
329+
mapped with the technique described here, but there are still ways to
330+
access them from userspace. The most common example are x86 ioports.
331+
On x86 systems, userspace can access these ioports using
332+
<function>ioperm()</function>, <function>iopl()</function>,
333+
<function>inb()</function>, <function>outb()</function>, and similar
334+
functions.
335+
</para>
336+
<para>
337+
Since these ioport regions can not be mapped, they will not appear under
338+
<filename>/sys/class/uio/uioX/maps/</filename> like the normal memory
339+
described above. Without information about the port regions a hardware
340+
has to offer, it becomes difficult for the userspace part of the
341+
driver to find out which ports belong to which UIO device.
342+
</para>
343+
<para>
344+
To address this situation, the new directory
345+
<filename>/sys/class/uio/uioX/portio/</filename> was added. It only
346+
exists if the driver wants to pass information about one or more port
347+
regions to userspace. If that is the case, subdirectories named
348+
<filename>port0</filename>, <filename>port1</filename>, and so on,
349+
will appear underneath
350+
<filename>/sys/class/uio/uioX/portio/</filename>.
351+
</para>
352+
<para>
353+
Each <filename>portX/</filename> directory contains three read-only
354+
files that show start, size, and type of the port region:
355+
</para>
356+
<itemizedlist>
357+
<listitem>
358+
<para>
359+
<filename>start</filename>: The first port of this region.
360+
</para>
361+
</listitem>
362+
<listitem>
363+
<para>
364+
<filename>size</filename>: The number of ports in this region.
365+
</para>
366+
</listitem>
367+
<listitem>
368+
<para>
369+
<filename>porttype</filename>: A string describing the type of port.
370+
</para>
371+
</listitem>
372+
</itemizedlist>
373+
374+
321375
</sect1>
322376
</chapter>
323377

@@ -339,12 +393,12 @@ offset = N * getpagesize();
339393

340394
<itemizedlist>
341395
<listitem><para>
342-
<varname>char *name</varname>: Required. The name of your driver as
396+
<varname>const char *name</varname>: Required. The name of your driver as
343397
it will appear in sysfs. I recommend using the name of your module for this.
344398
</para></listitem>
345399

346400
<listitem><para>
347-
<varname>char *version</varname>: Required. This string appears in
401+
<varname>const char *version</varname>: Required. This string appears in
348402
<filename>/sys/class/uio/uioX/version</filename>.
349403
</para></listitem>
350404

@@ -355,6 +409,13 @@ mapping you need to fill one of the <varname>uio_mem</varname> structures.
355409
See the description below for details.
356410
</para></listitem>
357411

412+
<listitem><para>
413+
<varname>struct uio_port port[ MAX_UIO_PORTS_REGIONS ]</varname>: Required
414+
if you want to pass information about ioports to userspace. For each port
415+
region you need to fill one of the <varname>uio_port</varname> structures.
416+
See the description below for details.
417+
</para></listitem>
418+
358419
<listitem><para>
359420
<varname>long irq</varname>: Required. If your hardware generates an
360421
interrupt, it's your modules task to determine the irq number during
@@ -448,6 +509,42 @@ Please do not touch the <varname>kobj</varname> element of
448509
<varname>struct uio_mem</varname>! It is used by the UIO framework
449510
to set up sysfs files for this mapping. Simply leave it alone.
450511
</para>
512+
513+
<para>
514+
Sometimes, your device can have one or more port regions which can not be
515+
mapped to userspace. But if there are other possibilities for userspace to
516+
access these ports, it makes sense to make information about the ports
517+
available in sysfs. For each region, you have to set up a
518+
<varname>struct uio_port</varname> in the <varname>port[]</varname> array.
519+
Here's a description of the fields of <varname>struct uio_port</varname>:
520+
</para>
521+
522+
<itemizedlist>
523+
<listitem><para>
524+
<varname>char *porttype</varname>: Required. Set this to one of the predefined
525+
constants. Use <varname>UIO_PORT_X86</varname> for the ioports found in x86
526+
architectures.
527+
</para></listitem>
528+
529+
<listitem><para>
530+
<varname>unsigned long start</varname>: Required if the port region is used.
531+
Fill in the number of the first port of this region.
532+
</para></listitem>
533+
534+
<listitem><para>
535+
<varname>unsigned long size</varname>: Fill in the number of ports in this
536+
region. If <varname>size</varname> is zero, the region is considered unused.
537+
Note that you <emphasis>must</emphasis> initialize <varname>size</varname>
538+
with zero for all unused regions.
539+
</para></listitem>
540+
</itemizedlist>
541+
542+
<para>
543+
Please do not touch the <varname>portio</varname> element of
544+
<varname>struct uio_port</varname>! It is used internally by the UIO
545+
framework to set up sysfs files for this region. Simply leave it alone.
546+
</para>
547+
451548
</sect1>
452549

453550
<sect1 id="adding_irq_handler">

‎Documentation/kobject.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ the name of the kobject, call kobject_rename():
118118

119119
int kobject_rename(struct kobject *kobj, const char *new_name);
120120

121-
Note kobject_rename does perform any locking or have a solid notion of
122-
what names are valid so the provide must provide their own sanity checking
121+
kobject_rename does not perform any locking or have a solid notion of
122+
what names are valid so the caller must provide their own sanity checking
123123
and serialization.
124124

125125
There is a function called kobject_set_name() but that is legacy cruft and

‎arch/arm/kernel/ecard.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ static struct expansion_card *__init ecard_alloc_card(int type, int slot)
817817
ec->dma = NO_DMA;
818818
ec->ops = &ecard_default_ops;
819819

820-
snprintf(ec->dev.bus_id, sizeof(ec->dev.bus_id), "ecard%d", slot);
820+
dev_set_name(&ec->dev, "ecard%d", slot);
821821
ec->dev.parent = NULL;
822822
ec->dev.bus = &ecard_bus_type;
823823
ec->dev.dma_mask = &ec->dma_mask;

‎arch/arm/mach-aaec2000/core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static struct clcd_board clcd_plat_data = {
212212

213213
static struct amba_device clcd_device = {
214214
.dev = {
215-
.bus_id = "mb:16",
215+
.init_name = "mb:16",
216216
.coherent_dma_mask = ~0,
217217
.platform_data = &clcd_plat_data,
218218
},

‎arch/arm/mach-ep93xx/core.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ static struct amba_pl010_data ep93xx_uart_data = {
409409

410410
static struct amba_device uart1_device = {
411411
.dev = {
412-
.bus_id = "apb:uart1",
412+
.init_name = "apb:uart1",
413413
.platform_data = &ep93xx_uart_data,
414414
},
415415
.res = {
@@ -423,7 +423,7 @@ static struct amba_device uart1_device = {
423423

424424
static struct amba_device uart2_device = {
425425
.dev = {
426-
.bus_id = "apb:uart2",
426+
.init_name = "apb:uart2",
427427
.platform_data = &ep93xx_uart_data,
428428
},
429429
.res = {
@@ -437,7 +437,7 @@ static struct amba_device uart2_device = {
437437

438438
static struct amba_device uart3_device = {
439439
.dev = {
440-
.bus_id = "apb:uart3",
440+
.init_name = "apb:uart3",
441441
.platform_data = &ep93xx_uart_data,
442442
},
443443
.res = {

‎arch/arm/mach-integrator/core.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static struct amba_pl010_data integrator_uart_data;
3737

3838
static struct amba_device rtc_device = {
3939
.dev = {
40-
.bus_id = "mb:15",
40+
.init_name = "mb:15",
4141
},
4242
.res = {
4343
.start = INTEGRATOR_RTC_BASE,
@@ -50,7 +50,7 @@ static struct amba_device rtc_device = {
5050

5151
static struct amba_device uart0_device = {
5252
.dev = {
53-
.bus_id = "mb:16",
53+
.init_name = "mb:16",
5454
.platform_data = &integrator_uart_data,
5555
},
5656
.res = {
@@ -64,7 +64,7 @@ static struct amba_device uart0_device = {
6464

6565
static struct amba_device uart1_device = {
6666
.dev = {
67-
.bus_id = "mb:17",
67+
.init_name = "mb:17",
6868
.platform_data = &integrator_uart_data,
6969
},
7070
.res = {
@@ -78,7 +78,7 @@ static struct amba_device uart1_device = {
7878

7979
static struct amba_device kmi0_device = {
8080
.dev = {
81-
.bus_id = "mb:18",
81+
.init_name = "mb:18",
8282
},
8383
.res = {
8484
.start = KMI0_BASE,
@@ -91,7 +91,7 @@ static struct amba_device kmi0_device = {
9191

9292
static struct amba_device kmi1_device = {
9393
.dev = {
94-
.bus_id = "mb:19",
94+
.init_name = "mb:19",
9595
},
9696
.res = {
9797
.start = KMI1_BASE,

‎arch/arm/mach-integrator/integrator_cp.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ static struct mmc_platform_data mmc_data = {
407407

408408
static struct amba_device mmc_device = {
409409
.dev = {
410-
.bus_id = "mb:1c",
410+
.init_name = "mb:1c",
411411
.platform_data = &mmc_data,
412412
},
413413
.res = {
@@ -421,7 +421,7 @@ static struct amba_device mmc_device = {
421421

422422
static struct amba_device aaci_device = {
423423
.dev = {
424-
.bus_id = "mb:1d",
424+
.init_name = "mb:1d",
425425
},
426426
.res = {
427427
.start = INTCP_PA_AACI_BASE,
@@ -532,7 +532,7 @@ static struct clcd_board clcd_data = {
532532

533533
static struct amba_device clcd_device = {
534534
.dev = {
535-
.bus_id = "mb:c0",
535+
.init_name = "mb:c0",
536536
.coherent_dma_mask = ~0,
537537
.platform_data = &clcd_data,
538538
},

‎arch/arm/mach-lh7a40x/clcd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static struct clcd_board clcd_platform_data = {
207207
static struct amba_device name##_device = { \
208208
.dev = { \
209209
.coherent_dma_mask = ~0, \
210-
.bus_id = busid, \
210+
.init_name = busid, \
211211
.platform_data = plat, \
212212
}, \
213213
.res = { \

‎arch/arm/mach-netx/fb.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void clk_put(struct clk *clk)
9191

9292
static struct amba_device fb_device = {
9393
.dev = {
94-
.bus_id = "fb",
94+
.init_name = "fb",
9595
.coherent_dma_mask = ~0,
9696
},
9797
.res = {

‎arch/arm/mach-realview/core.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
static struct amba_device name##_device = { \
3232
.dev = { \
3333
.coherent_dma_mask = ~0, \
34-
.bus_id = busid, \
34+
.init_name = busid, \
3535
.platform_data = plat, \
3636
}, \
3737
.res = { \

0 commit comments

Comments
 (0)