Ian Abbott [Tue, 20 Nov 2012 11:08:56 +0000 (11:08 +0000)]
staging: comedi: me_daq: remove broken workaround for PLX bug
The PLX PCI 9050 interface chip has a bug where its local configuration
registers accessible through PCI BAR 0 and/or PCI BAR 1 (depending on
settings loaded from a serial EEPROM or local bus processor) are
unreadable (always read 0 instead of the true register values) if the
base address starts on an odd multiple of 0x80 (i.e. has bit 7 set to
1).
The "me_daq" driver attempts to work around this by writing to the PCI
config space to swap the addresses assigned to PCI BAR 0 and PCI BAR 5
(which has been initially configured by serial EEPROM load as a spare
region of the same length as the PCI BAR 0 region). (If the PCI BAR 5
region is absent, it attempts to reduce the PCI BAR 0 address by 0x80,
which is likely to cause havoc for some other device, but that case
shouldn't be reachable in practice.)
The workaround in the driver is ineffective because it has already
ioremapped the memory from `pci_resource_start(pcidev, 0)` *before* it
does the workaround, so after swapping PCI BAR 0 and PCI BAR 5, this
memory will end up accessing whatever onboard registers PCI BAR 5 was
linked to instead of the local configuration registers. It also leaves
the addresses in the physical PCI BAR registers set differently to the
resource start addresses recorded in the `struct pci_dev`.
The workaround could be fixed by ioremapping `pci_resource_start(pcidev,
5)` if the PCI BAR addresses were physically swapped (and the fallback
workaround of subtracting 0x80 from the base address should really be
removed altogether). However, it's not really worth it. This sort of
thing should be worked around in "drivers/pci/quirks.c" by ensuring that
PCI BAR 0 and/or PCI BAR 1 do not end up on an odd multiple of 0x80
bytes.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
MAACHE Mehdi [Wed, 21 Nov 2012 14:18:29 +0000 (15:18 +0100)]
Staging: rtl8187se: remove check for IW_ENCODE_DISABLED
The original code had a no-op stub where it checked if
IW_ENCODE_DISABLED and did nothing. Then in a cleanup patch we
accidentally turned the check on. That was: de171bd6ff "Staging:
rtl8187se: r8180_wx: fixed a lot of checkpatch.pl issues".
The check should just be removed.
Signed-off-by: Mehdi MAACHE <mehdi.maache@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
YAMANE Toshiaki [Tue, 20 Nov 2012 20:17:13 +0000 (05:17 +0900)]
staging/rtl8187se: Fix spacing coding style in r8185b_init.c
The following errors and warnings fixed.
- ERROR: space prohibited after that open parenthesis '('
- ERROR: space prohibited before that close parenthesis ')'
- ERROR: space required before the open parenthesis '('
- WARNING: braces {} are not necessary for any arm of this statement
YAMANE Toshiaki [Tue, 20 Nov 2012 20:16:37 +0000 (05:16 +0900)]
staging/rtl8187se: Use netdev_ printks in r8185b_init.c
The following warnings fixed.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
- WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ...
YAMANE Toshiaki [Tue, 20 Nov 2012 12:13:05 +0000 (21:13 +0900)]
staging/rtl8187se: Fix spacing coding style in ieee80211/ieee80211_crypt_ccmp.c
The following error and warning fixed.
- ERROR: code indent should use tabs where possible
- WARNING: braces {} are not necessary for single statement blocks
YAMANE Toshiaki [Tue, 20 Nov 2012 12:12:11 +0000 (21:12 +0900)]
staging/rtl8187se: Fix spacing coding style in ieee80211/ieee80211_module.c
The following errors and warnings fixed.
- ERROR: space required after that ',' (ctx:VxV)
- ERROR: code indent should use tabs where possible
- WARNING: please, no space before tabs
- WARNING: please, no spaces at the start of a line
- WARNING: suspect code indent for conditional statements (8, 10)
YAMANE Toshiaki [Tue, 20 Nov 2012 12:10:42 +0000 (21:10 +0900)]
staging/rtl8187se: Fix include file issue in ieee80211/ieee80211_crypt.c
The following warnings fixed.
- WARNING: Use #include <linux/string.h> instead of <asm/string.h>
- WARNING: Use #include <linux/errno.h> instead of <asm/errno.h>
Mark Einon [Fri, 16 Nov 2012 10:47:38 +0000 (10:47 +0000)]
staging: et131x: Remove alignment offset padding on DMA buffer allocation/free
This padding was used to align buffers to a 4k boundary when returned
from dma_alloc_coherent(). As the buffers are already 4k aligned, and
the alignment no longer performed, the padding is not needed.
Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Merge tag 'iio-for-3.8e' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
From Jonathan:
"Fifth round of new IIO drivers, cleanups and fixes for the 3.8 cycle.
Here we have a number of minor fixes.
* a quirk for the hid sensor driver should be a boolean option.
* return an error for a failed memdup in the hid sensor driver.
* Fix a return value in adt7410.
* A double free in the IIO event infrastructure.
* Disabling interrupts in tsl2563 was wrong (never been correct!)
* Incorrect signature for the iio_buffer_register stub
* Incorrect return for isl29018 write_raw callback.
* A number of minor fixes as part of the various rework series.
New drivers and major rework.
* Introduce and use extensively an adis library for numerous spi
Analog Devices mems sensors. This then moves out of staging.
* Lots of new stuff then added to this library to support newer
sensors.
* New drivers for ADIS16136 and ADIS16480 and similar.
* Core support for barometric pressure sensors.
* ad7298 cleanup and move out of staging.
The bulk of this is from Lars-Peter Clausen. He's been rather
busy!"
iio: Factor out fixed point number parsing into its own function
Factor out the code for parsing fixed point numbers into its own function and
make this function globally available. This allows us to reuse the code to parse
fixed point numbers in individual IIO drivers.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Some of the newer generation devices from the ADIS16XXX series have more
registers than what can be supported with the current register addressing
scheme. These devices implement register paging to support a larger register
range. Each page is 128 registers large and the currently active page can be
selected via register 0x00 in each page. This patch implements transparent
paging inside the common adis library. The register read/write interface stays
the same and when a register is accessed the library automatically switches to
the correct page if it is not already selected. The page number is encoded in
the upper bits of the register number, e.g. register 0x5 of page 1 is 0x85.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Some of the newer generation devices from the ADIS16XXX family have 32bit wide
register which spans two 16bit wide registers. This patch adds support for
reading and writing a 32bit wide register.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Provide a IIO debugfs register access function for the ADIS library. This
function can be used by individual drivers to allow raw register access via
debugfs.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio: Move the ad7298 driver out of staging
The driver does not expose any custom API to userspace and none of the standard
static code checker tools report any issues, so move it out of staging.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio:ad7298: Squash everything into one file
The recent cleanups have decimated the drivers code size by quite a bit. It is
only a few hundred lines in total now. Putting everything into one file also
allows to reduce the code size a bit more by removing a few lines of boilerplate
code. The only functional change made by this patch is that we now always
include buffer support, instead of making it optional. This is more consistent
with what we do for other drivers.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio:ad7298: Fix temperature scale and offset
The temperature scale and offset depend on the reference voltage, the current
formula used in the driver assumes a 2.5V reference. This patch modifies the
code to report the unprocessed value for the temperature channel "raw" property
and to provide proper "scale" and "offset" properties which depend on the
selected reference voltage.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Rework the regulator handling of the driver to match more closely what we do in
other drivers. Make the regulator non-optional if a external reference is used.
Also dispose the option of specifying the reference voltage via platform data.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio:ad7298: Do not perform endianness conversion in buffered mode
For buffered mode we do not want to perform endianness conversion in the kernel,
but rather offload it to user space, since it is not always required to do a
conversion at all. It also greatly simplifies the kernel code since no
post-processing has to be done and may allow future optimizations like streaming
data directly to a storage device or over the network via DMA.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Currently the driver reads out all sample registers of the device and throws
away those which it does not need. Furthermore the SPI message is constructed
each time the trigger handler is run, although it will be the same each time.
This patch preallocates and pre-constructs the SPI message in the
"update_scan_mode" callback. Only those register which are actually selected for
sampling are included in the message. The patch also gets rid of the conversion
of the sample data from big endian to the native endianness and instead marks
the channel as big endian in its scan type. This allows to directly push the
SPI transfer buffer to the IIO buffer without the need to post-process it.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
staging:iio:adis_lib: Use triggered buffer setup helper function
Use the triggered buffer helper functions to setup and tear down the buffer for
the adis library instead of doing this manually. This also means that we switch
away from the deprecated sw_ring buffer and use the kfifo buffer now instead.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Use the new adis library for the adis16260 driver. This allows us to completely
scrap the adis16260 buffer and trigger code and about half of the core driver
code.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Use the new adis library for the adis16240 driver. This allows us to completely
scrap the adis16240 buffer and trigger code and more than half of the core
driver code.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Use the new adis library for the adis16220 driver. The adis16220 driver is a bit
special and so we can only make use of the generic register access and control
functions for now.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Use the new adis library for the adis16209 driver. This allows us to completely
scrap the adis16209 buffer and trigger code and more than half of the core
driver code.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Use the new adis library for the adis16204 driver. This allows us to completely
scrap the adis16204 buffer and trigger code and more than half of the core
driver code.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Use the new adis library for the adis16203 driver. This allows us to completely
scrap the adis16203 buffer and trigger code and more than half of the core
driver code.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Use the new adis library for the adis16201 driver. This allows us to completely
scrap the adis16201 buffer and trigger code and more than half of the core
driver code.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
A lot of the devices from the ADIS family use the same methods for accessing
registers, sampling data and trigger handling. They also have similar register
layout for the control registers.
This patch adds a common library for these devices. The library implements
functions for reading and writing registers as buffer and trigger management. It
also provides a set functions for accessing the control registers and for
running the devices internal self-test. Having this common library code will
allow us to remove a lot of duplicated code.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Match the iio_buffer_register stub signature up to the real function and make
the second parameter const. This fixes a the following warnings if
CONFIG_IIO_BUFFER is disabled:
drivers/staging/iio/accel/adis16201_core.c: In function ‘adis16201_probe’:
drivers/staging/iio/accel/adis16201_core.c:536: warning: passing argument 2 of ‘iio_buffer_register’ discards qualifiers from pointer target type
drivers/staging/iio/accel/adis16203_core.c: In function ‘adis16203_probe’:
drivers/staging/iio/accel/adis16203_core.c:468: warning: passing argument 2 of ‘iio_buffer_register’ discards qualifiers from pointer target type
drivers/staging/iio/accel/adis16204_core.c: In function ‘adis16204_probe’:
drivers/staging/iio/accel/adis16204_core.c:527: warning: passing argument 2 of ‘iio_buffer_register’ discards qualifiers from pointer target type
drivers/staging/iio/accel/adis16209_core.c: In function ‘adis16209_probe’:
drivers/staging/iio/accel/adis16209_core.c:542: warning: passing argument 2 of ‘iio_buffer_register’ discards qualifiers from pointer target type
drivers/staging/iio/accel/adis16240_core.c: In function ‘adis16240_probe’:
drivers/staging/iio/accel/adis16240_core.c:588: warning: passing argument 2 of ‘iio_buffer_register’ discards qualifiers from pointer target type
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Derek Basehore [Thu, 4 Oct 2012 23:54:00 +0000 (00:54 +0100)]
tsl2563: fixed bug with disabling interrupts
In tsl_2563_write_interrupt_config and tsl2562_remove, interrupts are not
disabled where they should be. This seems to be from a mistake of using |=
instead of &= in 2 lines of code.
Signed-off-by: Derek Basehore <dbasehore@chromium.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Julia Lawall [Sun, 21 Oct 2012 10:52:00 +0000 (11:52 +0100)]
drivers/iio/industrialio-event.c: eliminate possible double free
The function __iio_add_event_config_attrs is only called once, by the
function iio_device_register_eventset. If the call fails,
iio_device_register_eventset calls __iio_remove_event_config_attrs. There
is thus no need for __iio_add_event_config_attrs to also call
__iio_remove_event_config_attrs on failure.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
staging:iio:adt7410: Fix adt7410_set_mode return value
The function is expected to return the number of bytes consumed and as long as
not all bytes have been consumed the function will be called again. Currently
the function returns 'ret', which will always be 0 in this case, so we end up in
a endless loop since the caller will assume that no bytes have been consumed. So
instead return len as it is supposed to.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Linus Torvalds [Fri, 16 Nov 2012 23:26:38 +0000 (15:26 -0800)]
Merge branch 'akpm' (Fixes from Andrew)
Merge misc fixes from Andrew Morton.
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (12 patches)
revert "mm: fix-up zone present pages"
tmpfs: change final i_blocks BUG to WARNING
tmpfs: fix shmem_getpage_gfp() VM_BUG_ON
mm: highmem: don't treat PKMAP_ADDR(LAST_PKMAP) as a highmem address
mm: revert "mm: vmscan: scale number of pages reclaimed by reclaim/compaction based on failures"
rapidio: fix kernel-doc warnings
swapfile: fix name leak in swapoff
memcg: fix hotplugged memory zone oops
mips, arc: fix build failure
memcg: oom: fix totalpages calculation for memory.swappiness==0
mm: fix build warning for uninitialized value
mm: add anon_vma_lock to validate_mm()
Andrew Morton [Fri, 16 Nov 2012 22:15:06 +0000 (14:15 -0800)]
revert "mm: fix-up zone present pages"
Revert commit 7f1290f2f2a4 ("mm: fix-up zone present pages")
That patch tried to fix a issue when calculating zone->present_pages,
but it caused a regression on 32bit systems with HIGHMEM. With that
change, reset_zone_present_pages() resets all zone->present_pages to
zero, and fixup_zone_present_pages() is called to recalculate
zone->present_pages when the boot allocator frees core memory pages into
buddy allocator. Because highmem pages are not freed by bootmem
allocator, all highmem zones' present_pages becomes zero.
Various options for improving the situation are being discussed but for
now, let's return to the 3.6 code.
Cc: Jianguo Wu <wujianguo@huawei.com> Cc: Jiang Liu <jiang.liu@huawei.com> Cc: Petr Tesarik <ptesarik@suse.cz> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Yinghai Lu <yinghai@kernel.org> Cc: Minchan Kim <minchan.kim@gmail.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Acked-by: David Rientjes <rientjes@google.com> Tested-by: Chris Clayton <chris2553@googlemail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Hugh Dickins [Fri, 16 Nov 2012 22:15:04 +0000 (14:15 -0800)]
tmpfs: change final i_blocks BUG to WARNING
Under a particular load on one machine, I have hit shmem_evict_inode()'s
BUG_ON(inode->i_blocks), enough times to narrow it down to a particular
race between swapout and eviction.
It comes from the "if (freed > 0)" asymmetry in shmem_recalc_inode(),
and the lack of coherent locking between mapping's nrpages and shmem's
swapped count. There's a window in shmem_writepage(), between lowering
nrpages in shmem_delete_from_page_cache() and then raising swapped
count, when the freed count appears to be +1 when it should be 0, and
then the asymmetry stops it from being corrected with -1 before hitting
the BUG.
One answer is coherent locking: using tree_lock throughout, without
info->lock; reasonable, but the raw_spin_lock in percpu_counter_add() on
used_blocks makes that messier than expected. Another answer may be a
further effort to eliminate the weird shmem_recalc_inode() altogether,
but previous attempts at that failed.
So far undecided, but for now change the BUG_ON to WARN_ON: in usual
circumstances it remains a useful consistency check.
Thanks to Johannes for pointing to truncation: free_swap_and_cache()
only does a trylock on the page, so the page lock we've held since
before confirming swap is not enough to protect against truncation.
What cleanup is needed in this case? Just delete_from_swap_cache(),
which takes care of the memcg uncharge.
Signed-off-by: Hugh Dickins <hughd@google.com> Reported-by: Dave Jones <davej@redhat.com> Cc: Johannes Weiner <hannes@cmpxchg.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>