01 Nov, 2011

2 commits

  • The pretty much brings in the kitchen sink along
    with it, so it should be avoided wherever reasonably possible in
    terms of being included from other commonly used
    files, as it results in a measureable increase on compile times.

    The worst culprit was probably device.h since it is used everywhere.
    This file also had an implicit dependency/usage of mutex.h which was
    masked by module.h, and is also fixed here at the same time.

    There are over a dozen other headers that simply declare the
    struct instead of pulling in the whole file, so follow their lead
    and simply make it a few more.

    Most of the implicit dependencies on module.h being present by
    these headers pulling it in have been now weeded out, so we can
    finally make this change with hopefully minimal breakage.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     
  • The original implementations reference THIS_MODULE in an inline.
    We could include , but it is better to avoid chaining.

    Fortunately someone else already thought of this, and made a similar
    inline into a #define in for device_schedule_callback(),
    [see commit 523ded71de0] so follow that precedent here.

    Also bubble up any __must_check that were used on the prev. wrapper inline
    functions up one to the real __register functions, to preserve any prev.
    sanity checks that were used in those instances.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

19 Oct, 2011

1 commit

  • To support >32-bit physical addresses for UIO_MEM_PHYS type we need to
    extend the width of 'addr' in struct uio_mem. Numerous platforms like
    embedded PPC, ARM, and X86 have support for systems with larger physical
    address than logical.

    Since 'addr' may contain a physical, logical, or virtual address the
    easiest solution is to just change the type to 'phys_addr_t' which
    should always be greater than or equal to the sizeof(void *) such that
    it can properly hold any of the address types.

    For physical address we can support up to a 44-bit physical address on a
    typical 32-bit system as we utilize remap_pfn_range() for the mapping of
    the memory region and pfn's are represnted by shifting the address by
    the page size (typically 4k).

    Signed-off-by: Kai Jiang
    Signed-off-by: Minghuan Lian
    Signed-off-by: Kumar Gala
    Signed-off-by: Hans J. Koch
    Signed-off-by: Greg Kroah-Hartman

    Kai Jiang
     

11 Nov, 2010

1 commit


23 Oct, 2010

1 commit

  • Change the value of UIO_IRQ_NONE -2 to 0. 0 is well defined in the rest
    of the kernel as the value to indicate an irq has not been assigned.

    Update the calls to request_irq and free_irq to only ignore UIO_IRQ_NONE
    and UIO_IRQ_CUSTOM allowing the rest of the kernel's possible irq
    numbers to be used.

    Signed-off-by: Eric W. Biederman
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Hans J. Koch
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     

25 Mar, 2009

1 commit

  • If a UIO device has several memory mappings, it can be difficult for userspace
    to find the right one. The situation becomes even worse if the UIO driver can
    handle different versions of a card that have different numbers of mappings.
    Benedikt Spranger has such cards and pointed this out to me. Thanks, Bene!

    To address this problem, this patch adds "name" sysfs attributes for each
    mapping. Userspace can use these to clearly identify each mapping. The name
    string is optional. If a driver doesn't set it, an empty string will be
    returned, so this patch won't break existing drivers.

    The same problem exists for port region information, so a "name" attribute is
    added there, too.

    Signed-off-by: Hans J. Koch
    Signed-off-by: Greg Kroah-Hartman

    Hans J. Koch
     

07 Jan, 2009

2 commits

  • These are only ever assigned constant strings and never modified.

    This was noticed because Wolfram Sang needed to cast the result of
    of_get_property() in order to assign it to the name field of a struct
    uio_info.

    Signed-off-by: Stephen Rothwell
    Signed-off-by: Hans J. Koch
    Signed-off-by: Greg Kroah-Hartman

    Stephen Rothwell
     
  • Devices sometimes have memory where all or parts of it can not be mapped to
    userspace. But it might still be possible to access this memory from
    userspace by other means. An example are PCI cards that advertise not only
    mappable memory but also ioport ranges. On x86 architectures, these can be
    accessed with ioperm, iopl, inb, outb, and friends. Mike Frysinger (CCed)
    reported a similar problem on Blackfin arch where it doesn't seem to be easy
    to mmap non-cached memory but it can still be accessed from userspace.

    This patch allows kernel drivers to pass information about such ports to
    userspace. Similar to the existing mem[] array, it adds a port[] array to
    struct uio_info. Each port range is described by start, size, and porttype.

    If a driver fills in at least one such port range, the UIO core will simply
    pass this information to userspace by creating a new directory "portio"
    underneath /sys/class/uio/uioN/. Similar to the "mem" directory, it will
    contain a subdirectory (portX) for each port range given.

    Note that UIO simply passes this information to userspace, it performs no
    action whatsoever with this data. It's userspace's responsibility to obtain
    access to these ports and to solve arch dependent issues. The "porttype"
    attribute tells userspace what kind of port it is dealing with.

    This mechanism could also be used to give userspace information about GPIOs
    related to a device. You frequently find such hardware in embedded devices,
    so I added a UIO_PORT_GPIO definition. I'm not really sure if this is a good
    idea since there are other solutions to this problem, but it won't hurt much
    anyway.

    Signed-off-by: Hans J. Koch
    Signed-off-by: Greg Kroah-Hartman

    Hans J. Koch
     

22 Jul, 2008

2 commits

  • Signed-off-by: Uwe Kleine-König
    Signed-off-by: Hans J. Koch

    Uwe Kleine-König
     
  • Sometimes it is necessary to enable/disable the interrupt of a UIO device
    from the userspace part of the driver. With this patch, the UIO kernel driver
    can implement an "irqcontrol()" function that does this. Userspace can write
    an s32 value to /dev/uioX (usually 0 or 1 to turn the irq off or on). The
    UIO core will then call the driver's irqcontrol function.

    Signed-off-by: Hans J. Koch
    Acked-by: Uwe Kleine-König
    Acked-by: Magnus Damm
    Signed-off-by: Greg Kroah-Hartman

    Hans J. Koch
     

25 Jan, 2008

1 commit

  • The uio kobject code is "wierd". This patch should hopefully fix it up
    to be sane and not leak memory anymore.

    Cc: Kay Sievers
    Cc: Thomas Gleixner
    Cc: Benedikt Spranger
    Signed-off-by: Hans J. Koch
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

19 Jul, 2007

1 commit

  • This interface allows the ability to write the majority of a driver in
    userspace with only a very small shell of a driver in the kernel itself.
    It uses a char device and sysfs to interact with a userspace process to
    process interrupts and control memory accesses.

    See the docbook documentation for more details on how to use this
    interface.

    From: Hans J. Koch
    Cc: Thomas Gleixner
    Cc: Benedikt Spranger
    Signed-off-by: Greg Kroah-Hartman

    Hans J. Koch