History log of /drivers/uio/uio_dmem_genirq.c
Revision Date Author Comments
ca3c61f358d8e5a4b2732d6aa81ac46f677e69f0 22-May-2014 Daeseok Youn <daeseok.youn@gmail.com> drivers: uio_dmem_genirq: Fix memory leak in uio_dmem_genirq_probe()

When platform_get_irq() is failed after "priv" allocated,
it need to free "priv". But the label of bad0 doesn't try
to free about "priv". So this patch changes that lable to "bad1".
But "bad1" has pm_runtime_disable() call, this function should
be called when uio_register_device() is failed. So it is moved
into handling error for uio_register_device().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Hans J. Koch <hjk@hansjkoch.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
31f5221327f2add1ea152ed9d12b7094ab59818f 30-Aug-2013 Jingoo Han <jg1.han@samsung.com> drivers: uio_dmem_genirq: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly. This is a cosmetic change
to make the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
077797117dfa209717e1f3f1416c1101c0e047f0 19-Jun-2013 Sachin Kamat <sachin.kamat@linaro.org> drivers: uio_dmem_genirq: Use of_match_ptr() macro

This eliminates having an #ifdef returning NULL for the case
when OF is disabled.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
d5185c4eb3a022f7e7a435238c2b0b885e6b4821 16-Nov-2012 Damian Hobson-Garcia <dhobsong@igel.co.jp> drivers: uio: Only allocate new private data when probing device tree node

The same condition should be used both when allocating and freeing the
driver private data. When dev.of_node is non NULL, allocate a new
private data structure, otherwise use the values from the platform data.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Cc: "Hans J. Koch" <hjk@hansjkoch.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
439926c81c01f31f9ffa7af7bf2d242b7f794f3c 16-Nov-2012 Damian Hobson-Garcia <dhobsong@igel.co.jp> drivers: uio_dmem_genirq: Allow partial success when opening device

The uio device should not fail on open just because one memory allocation
fails. The device might export several regions, the failure of some of
which may or may not be a problem for the user space driver. Failing
regions will remain unmapped, and successful regions will be mapped and
exported to user space. Also deals with the case where failing to map
a region after successfully allocating others would not unmap the
successfully allocated regions before dying.

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Cc: "Hans J. Koch" <hjk@hansjkoch.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
87c4d1a7dce956b86e34329ed1b11a751ba9a8ea 16-Nov-2012 Damian Hobson-Garcia <dhobsong@igel.co.jp> drivers: uio_dmem_genirq: Don't use DMA_ERROR_CODE to indicate unmapped regions

DMA_ERROR_CODE is not defined on all architectures and is architecture
specific. Instead, use the constant, ~0 to indicate unmapped regions.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Cc: "Hans J. Koch" <hjk@hansjkoch.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24fce61b0b7f1bc94970036db1f1d65b0770d168 16-Nov-2012 Damian Hobson-Garcia <dhobsong@igel.co.jp> drivers: uio_dmem_genirq: Don't mix address spaces for dynamic region vaddr

Assigning the virtual address returned from dma_alloc_coherent to the the
internal_addr element of uioinfo produces the following sparse errors since
internal_addr is a void __iomem * and dma_alloc_coherent returns void *.

+ drivers/uio/uio_dmem_genirq.c:65:39: sparse: incorrect type in assignment (different address spaces)
drivers/uio/uio_dmem_genirq.c:65:39: expected void [noderef] <asn:2>*internal_addr
drivers/uio/uio_dmem_genirq.c:65:39: got void *[assigned] addr
+ drivers/uio/uio_dmem_genirq.c:93:17: sparse: incorrect type in argument 3 (different address spaces)
drivers/uio/uio_dmem_genirq.c:93:17: expected void *vaddr
drivers/uio/uio_dmem_genirq.c:93:17: got void [noderef] <asn:2>*internal_addr

Store the void * in the driver's private data instead.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Cc: "Hans J. Koch" <hjk@hansjkoch.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
0a0c3b5a24bd802b1ebbf99e0b01296647b8199b 25-Sep-2012 Damian Hobson-Garcia <dhobsong@igel.co.jp> Add new uio device for dynamic memory allocation

This device extends the uio_pdrv_genirq driver to provide limited
dynamic memory allocation for UIO devices. This allows UIO devices
to use CMA and IOMMU allocated memory regions. This driver is based
on the uio_pdrv_genirq driver and provides the same generic interrupt
handling capabilities. Like uio_prdv_genirq,
a fixed number of memory regions, defined in the platform device's
.resources field are exported to userpace. This driver adds the ability
to export additional regions whose number and size are known at boot time,
but whose memory is not allocated until the uio device file is opened for
the first time. When the device file is closed, the allocated memory block
is freed. Physical (DMA) addresses for the dynamic regions are provided to
the userspace via /sys/class/uio/uioX/maps/mapY/addr in the same way as
static addresses are when the uio device file is open, when no processes
are holding the device file open, the address returned to userspace is
DMA_ERROR_CODE.

Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Signed-off-by: "Hans J. Koch" <hjk@hansjkoch.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>