Steven Luo [Wed, 11 Dec 2013 20:51:56 +0000 (22:51 +0200)]
Staging: TIDSPBRIDGE: Fix mmap to map the correct region of physical memory
Commit 559c71fe5dc3 ("Staging: TIDSPBRIDGE: Use vm_iomap_memory for
mmap-ing instead of remap_pfn_range") had the effect of inadvertently
shifting the start of the physical memory area mapped by
pdata->phys_mempool_base. Correct this by subtracting that shift before
calling vm_iomap_memory() and adding it back afterwards.
staging: comedi: s626: tidy up comedi_lrange table
The comedi_lrange tables are fixed length based on the 'length' value
before the array of comedi_krange 'range' values. For aesthetics, remove
the trailing comma from last 'range' value.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmmio: return '0' after successful attach
The comedi core expects the (*attach) functions to return < 0 to indicate
an error or >= 0 for success. Change the return to '0' as that is more
typical.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix the types of some of the private data members. The 'enabled_mask' and
'stop_count' should be unsigned int values. The 'active' and 'continuous'
members are flags, change them to unsigned int bit fields.
Remove the 'sprivs' pointer. This should have been removed when the subdevice
private data was removed.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmmio: tidy up pcmmio_start_intr()
Refactor the function to remove some indent levels.
Use pcmmio_dio_write() to write the polarity and enable paged registers
instead of using the for () loop to write each register in the pages.
The for () loop actually has a bug. It switches the page to the 'enab'
registers for the first port then switches to the 'pol' registers for
all remaining writes. It also was not using the pagelock spinlock to
protect the writes to the page registers. Using the pcmmio_dio_write()
helper ensures that the writes to the paged registers complete correctly.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmmio: setup irq routing during (*attach)
To use interrupts the IRQ routing must be configured and interrupts
enabled. Currently both steps are being handled in pcmmio_start_intr().
Move the code that sets the IRQ routing into the attach of the board.
At this point interrupts are still disabled. The enable and polarity
bits just need to be set in pcmmio_start_intr() to enable them.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmmio: use pcmmio_dio_{read, write}() in interrupt_pcmmio()
Use the helper functions to read/write the PCMMIO_PAGE_INT_ID registers. This
allows removing the need to lock/unlock the spinlock 'pagelock' and removes the
need for the for () loop that did the read/write of the 3 paged registers.
Also, remove the need for the 'got1' local variable by just returning 'IRQ_NONE'
if there are not interrupts pending.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmmio: remove subdevice private data
Only subdevice[2], the dio interrupt subdevice, uses the subdevice private data.
Move the members from struct pcmmio_subdev_private to struct pcmmio_private and
remove the subdevice private data. This also allows removing the allocation and
freeing of devpriv->sprivs.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmmio: remove 'num_asic_chans' from subdevice private data
The 'num_asic_chans' that support interrupts in the interrupt subdevice is
always initialized to '24'. Remove this unneeded information from the subdevice
private data.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmmio: remove 'asic_chan' from subdevice private data
The first 'asic_chan' that supports interrupts in the interrupt subdevice is
always initialized to '0'. Remove this unneeded information from the subdevice
private data.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmmio: remove 'first_chan' from subdevice private data
The 'first_chan' that supports interrupts in the interrupt subdevice is always
initialized to '0'. Remove this unneeded information from the subdevice private
data.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmmio: remove 'asic' member from subdevice private data
This member of the subdevice private data is always initialized to '0' by
the only subdevice that uses it. Since we only have one asic on the board
it's really not needed. Just remove it.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmmio: unwind the digital i/o subdevice init
The board supported by this driver only has one asic that provides the
two digital i/o subdevices. The first dio subdevice has 24 channels that
support interrupts. The second dio subdevice also has 24 channels but no
interrupt support.
To make the code clearer and easier to maintain, remove the for () loop
that initialized these subdevices.
Also, correctly initialize the interrupt subdevice. The current code does
not set the SDF_CMD_READ subdev_flag and does not set the dev->read_subdev
pointer in the comedi_device.
Use the dev->read_subdev pointer in the interrupt handler to get the
interrupt subdevice and private data pointer instead of searching for
them. To keep this patch reviewable, the extra indents in interrupt_pcmmio()
will be removed later.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This function is only called by the interrupt subdevice so the sanity
check of the 'asic' is not necessary. Remove it.
The 'nports' is always 3 and the 'firstport' is always 0. Remove the
for () loop that clears the registers to disable the interrupts and
just use the pcmmio_dio_write() helper to write to the three page
registers.
This also fixes a bug where the write to the page registers is not
protected with the spinlock.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Currently this function uses the subdevice private data to get the
iobase address needed to update the dio output channel state and
read the current state of the input channels. This subdevice private
data is in the process of being removed.
Use the subdevice 'index' to determine the base 'port' needed to
access the correct digital i/o registers. The pcmmio_dio_write()
function can then be used to update the outputs.
Introduce a new helper function, pcmmio_dio_read(), to read the
current state of the input channels.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Currently this function uses the subdevice private data to get the
iobase address needed to update the channel configuration. This
subdevice private data is in the process of being removed.
Use the subdevice 'index' to determine the base 'port' needed to
access the correct digital i/o registers. The pcmmio_dio_write()
function can then be used to update the configuration.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmmio: cleanup the digital i/o register defines
Redefine the registers used to access the digital i/o so that they
are based on the dev->iobase of the board instead of the 'asic_iobase'
that is stored in the private data.
Remove the then unused 'asic_iobase'.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rename this function so it has namespace associated with the driver.
The board supported by this driver only has one WinSystems WS16C48 asic
on it that handles the digital i/o. Remove the unnecessary for () loop
that would reset multiple asics.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The for () loop that does the request_irq() in this driver is a bit of
an overkill. The code appears to have been copied from the pcmuio driver
which supports boards with 1 or 2 ASIC devices. The board supported by
this driver only has 1 ASIC.
Simplify the code and store the irq number in the comedi_device. This
allows the core to automatically do the free_irq() when the driver is
detached.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rename this function so it has namespace associated with the driver.
Move the 'chan' local variable out of the for () loop. The 'chan' is
constant for the comedi_insn and only needs to be fetched once from
the insn->chanspec.
Also, remove the sanity check of the chan. The comedi core will ensure
that the chan is valid for the subdevice before calling this function.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rename this function to have namespace associated with the driver.
Refactor the function to remove the extra write to the command register
to set the range before writing the DAC value. Since the range is constant
for the entire comedi_insn it only needs to be set once. All writes to the
DAC after that will use the same range.
Define the register map for the analog output registers.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmmio: move ao shadow data to device private data
There is only one ai subdevice in this driver so there is no reason
to hold the last sample written to each channel in the subdevice
private data. Move the data into the device private data,
This gets some of the data out of the subdevice private data union
and removes some of the uses of the ugly 'subpriv' macro.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmmio: tidy up the ai subdevice init
Add some whitespace to the ai subdevice init and reorder it a bit
to follow the "norm" in comedi drivers.
Remove the init of s->len_chanlist. This member is only used with
subdevices that support async commands. The core will default the
value correctly..
The ai subdevice only uses the s->private member to pass the iobase
to the analog input registers. It's just a copy of the dev->iobase,
use that instead.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rename this function to have namespace associated with the driver.
Refactor the function to remove the extra write to the command register
between each ADC conversion. We only need to do one dummy conversion in
order to flush the serial ADC. After that each command will return the
result of the previous conversion.
Define the register map for the analog input registers.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
All the I/O ports are left unlocked in the driver so the 'pagelock'
in the private data is not necessary. The paranoia sanity checks
are also unnecessary, Remove them.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John Stultz [Tue, 17 Dec 2013 05:07:51 +0000 (21:07 -0800)]
staging: ion: Add HAVE_MEMBLOCK config dependency
The kbuild test robot reported a build issue w/ ION on m68k:
drivers/staging/android/ion/ion.c: In function 'ion_reserve':
drivers/staging/android/ion/ion.c:1526:4: error: implicit declaration of function 'memblock_alloc_base' [-Werror=implicit-function-declaration]
drivers/staging/android/ion/ion.c:1528:11: error: 'MEMBLOCK_ALLOC_ANYWHERE' undeclared (first use in this function)
drivers/staging/android/ion/ion.c:1528:11: note: each undeclared identifier is reported only once for each function it appears in
drivers/staging/android/ion/ion.c:1537:4: error: implicit declaration of function 'memblock_reserve' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
This is caused by ION using memblock functionality which m68k doesn't support.
This patch adds a HAVE_MEMBLOCK dependency to the ION config.
Acked-by: Colin Cross <ccross@android.com> Cc: Android Kernel Team <kernel-team@android.com> Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wei Yongjun [Tue, 17 Dec 2013 03:20:22 +0000 (11:20 +0800)]
gpu: ion: fix sparse non static symbol warnings
Fixes the following sparse warnings:
drivers/staging/android/ion/tegra/tegra_ion.c:23:19: warning:
symbol 'idev' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:24:19: warning:
symbol 'tegra_user_mapper' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:25:5: warning:
symbol 'num_heaps' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:26:17: warning:
symbol 'heaps' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:28:5: warning:
symbol 'tegra_ion_probe' was not declared. Should it be static?
drivers/staging/android/ion/tegra/tegra_ion.c:66:5: warning:
symbol 'tegra_ion_remove' was not declared. Should it be static?
Colin Cross [Tue, 17 Dec 2013 00:48:17 +0000 (16:48 -0800)]
ion: remove ion_user_handle_t from ion_test.h
ion_test.h should not define ion_user_handle_t, and defining it
causes a warning:
In file included from drivers/staging/android/ion/ion_test.c:31:
drivers/staging/android/ion/../uapi/ion_test.h:23: error: redefinition of typedef 'ion_user_handle_t'
drivers/staging/android/ion/../uapi/ion.h:23: note: previous declaration of 'ion_user_handle_t' was here
Reported-by: Andrew Morton <akpm@linux-foundation.org> Cc: John Stultz <john.stultz@linaro.org> Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>