Jonathan Cameron [Fri, 12 Aug 2011 15:55:30 +0000 (16:55 +0100)]
staging:iio:core simplify and fix a bug in iio_device_(un)register_event_set.
The unwinding index was j, not i and it is much simpler to do these as a single
loop unwinding those elements necessary in before jumping to the error handler.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Thomas Meyer [Sat, 6 Aug 2011 11:26:29 +0000 (13:26 +0200)]
staging: brcm80211: use kzalloc()
Use kzalloc rather than kmalloc followed by memset with 0
This considers some simple cases that are common and easy to validate
Note in particular that there are no ...s in the rule, so all of the
matched code has to be contiguous
The semantic patch that makes this output is available
in scripts/coccinelle/api/alloc/kzalloc-simple.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Thomas Meyer <thomas@m3y3r.de> Acked-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Arend van Spriel [Tue, 23 Aug 2011 12:14:00 +0000 (14:14 +0200)]
staging: brcm80211: fill in proper rx rate in mac80211 rx status
The brcmsmac driver supports different rates on 5GHz but this is not
taken into account when providing the rate index in the receive
status information passed to mac80211.
Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Henry Ptasinski <henryp@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Roland Vossen [Tue, 23 Aug 2011 12:13:59 +0000 (14:13 +0200)]
staging: brcm80211: bugfix for fifo problem on 64 bits platforms.
Message 'receive fifo overflow' appeared in the log. Root cause was an
invalid physical address being programmed into the DMA engine. This was
caused by an invalid pointer cast in the dma code. Issue was observed on
a Sparc (Sun Fire V120) machine but could theoretically also pop up
on other architectures.
Driver was tested to scan and ping on aforementioned machine.
Reviewed-by: Arend van Spriel <arend@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Roland Vossen [Tue, 23 Aug 2011 12:13:58 +0000 (14:13 +0200)]
staging: brcm80211: bugfix for exception on Sparc platforms
Problem would pop up during driver load on a Sun Fire V120 and manifested
itself as an exception. This was caused by int* pointers provided to memcpy()
that were not aligned on an int boundary. The pointer type provided to
memcpy() is used by the compiler for optimization purposes. Fix was to cast
the int* pointers to void* pointers.
Bernhard R. Link and David S. Miller provided valuable feedback, thanks gents.
Reviewed-by: Arend van Spriel <arend@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Arend van Spriel [Tue, 23 Aug 2011 12:13:57 +0000 (14:13 +0200)]
staging: brcm80211: fix rtnl_lock issue when bringing down brcmfmac
When bringing down the netdevice interface a deadlock occurred
sporadically due to the rtnl_lock being held by a task that was
waiting for another task trying to get the lock. This patch fixes
that issue.
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Arend van Spriel [Tue, 23 Aug 2011 12:13:55 +0000 (14:13 +0200)]
staging: brcm80211: make use of cordic library function
The cordic function which calculates cosine and sine values for given
angle is now provided in library module. The phy code now uses this
module function.
Reviewed-by: Henry Ptasinski <henryp@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Arend van Spriel [Tue, 23 Aug 2011 12:13:54 +0000 (14:13 +0200)]
staging: brcm80211: make use of crc8 library function
The crc8 function is now available as a library function provided
by kernel module crc8.ko. The function has been removed from brcmutil
module and srom.c now uses crc8 library function.
Reviewed-by: Henry Ptasinski <henryp@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Roland Vossen [Mon, 15 Aug 2011 13:34:27 +0000 (15:34 +0200)]
staging: brcm80211: removed unused MIPS specific SDRAM swap window
Certain Mips based, big endian Broadcom products contain a memory window
for endianness swap purposes. However, this is too system specific for
this driver as there are more big endian platforms to support. Thus, this
'window' functionality is not to be used and can be removed.
The swap window would be a performance improvement and could be provided
with a dedicated mapping function in the platform specific code.
Tested on BCM63281.
Reviewed-by: Henry Ptasinski <henryp@broadcom.com> Reviewed-by: Arend van Spriel <arend@broadcom.com> Tested-by: Jonas Gorski <jonas.gorski@gmail.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Arend van Spriel [Mon, 15 Aug 2011 13:34:26 +0000 (15:34 +0200)]
staging: brcm80211: restrict MIPS dma bug workaround to BCM47XX
The inline function dma_spin_for_len() was defined for MIPS platforms
but the problem only occurs with dma of the PCI core in bcm47xx chips.
This patch restricts the function further to BCM47XX platforms only.
Tested on BCM63281.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Henry Ptasinski <henryp@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Tested-by: Jonas Gorski <jonas.gorski@gmail.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Arend van Spriel [Mon, 15 Aug 2011 13:34:25 +0000 (15:34 +0200)]
staging: brcm80211: restrict register access method for bcm47xx
The driver contained conditional code for resolving issue with
dma transaction reordering. This code was conditionalized using
__mips__ macro, but it actually is specific to bcm47xx chips.
This patch replaces it for the more speficic CONFIG_BCM47XX macro.
Tested on BCM63281.
Reviewed-by: Henry Ptasinski <henryp@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Tested-by: Jonas Gorski <jonas.gorski@gmail.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Arend van Spriel [Mon, 15 Aug 2011 13:34:20 +0000 (15:34 +0200)]
staging: brcm80211: replace BUS_SWAP32 macro with cpu_to_le32()
The macro BUS_SWAP32(a) expanded to (a) which was fine for a little
endian system. For big endian platform this should do as the name
implies. As the driver is intended for PCI which is little-endian
the macro cpu_to_le32() can be used instead.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Henry Ptasinski <henryp@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Arend van Spriel [Mon, 15 Aug 2011 13:34:19 +0000 (15:34 +0200)]
staging: brcm80211: remove PHYSADDR macro from dma.c
Four macros with PHYSADDR name prefix are not doing a lot and
complicate code readability. These have been expanded in the source
code and consequently removed the definitions.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Henry Ptasinski <henryp@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Arend van Spriel [Mon, 15 Aug 2011 13:34:18 +0000 (15:34 +0200)]
staging: brcm80211: remove W_SM and R_SM macros from dma.c
The macros W_SM and R_SM are not doing much conversion of the macro
parameters and complicate code readability without good cause. It
is more clear to remove usage of the macros expanding it in the source
code.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Henry Ptasinski <henryp@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Arend van Spriel [Fri, 12 Aug 2011 13:34:48 +0000 (15:34 +0200)]
staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c
In wl_cfg80211.c two semaphores were used to trigger a task to process
an event. The wait queues are better suited for that purpose. This also
removes checkpatch warning on sema_init() calls in this source file.
Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
staging: brcm80211: remove target platform limitations for drivers
Several issue have been reported building the driver on big endian
systems. Following commits were done on driver Kconfig:
d462039 Staging: brcm80211: disable drivers except for X86 or MIPS platforms 15e5201 Staging: brcm80211: disable drivers for PPC platforms
These problems have been resolved so the added 'depends' lines in
the Kconfig have been removed.
Compile tested it for following architectures:
little endian
x86
x86_64
arm
mips
big endian
ppc64
sparc64
mips
Reported-by: David S. Miller <davem@davemloft.net> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Reported-by: Greg Kroah-Hartman <gregkh@suse.de> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Building for the ARM resulted in a compiler warning about usage of
a possibly uninitialized variable. The warning is valid and the
code has been fixed accordingly.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Henry Ptasinski <henryp@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Roland Vossen [Mon, 8 Aug 2011 13:58:58 +0000 (15:58 +0200)]
staging: brcm80211: removed unused bus code from softmac
Code cleanup. For the softmac, the 'bustype' in use is always PCI_BUS. Hence
code related to dealing with different bus types (eg: PCI_BUS, JTAG_BUS,
SI_BUS) could be removed.
Franky Lin [Mon, 8 Aug 2011 13:58:55 +0000 (15:58 +0200)]
staging: brcm80211: remove dead client interrupt code from brcmfmac
In fullmac, brcmf_sdcard_intr_enable/disable is a legacy layer and
doesn't really enable/disable any interrupt. This patch removes the
corresponding code.
Reviewed-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Roland Vossen [Mon, 8 Aug 2011 13:58:49 +0000 (15:58 +0200)]
staging: brcm80211: simplified register access macro's in softmac
Code cleanup. Removed MIPS specific 'sync' instruction since this is not
required for the chips that this driver supports. MIPS specific macro's
were now the same as non-MIPS register access macro's and thus have been
deleted. Also added comment that makes clearer what the benefit of these
macro's is. Unified big and little end register access macro's.
Roland Vossen [Mon, 8 Aug 2011 13:58:47 +0000 (15:58 +0200)]
staging: brcm80211: cleaned up softmac DMA layer
Code cleanup. Since this driver only needs to support 64 bit DMA hardware,
an unnecessary layer of abstraction could be removed. Also DMA functions that
were not called have been removed.
Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Franky Lin [Mon, 8 Aug 2011 13:58:46 +0000 (15:58 +0200)]
staging: brcm80211: revert removal of atomic initialization
The commit "staging: brcm80211: remove code for unsupported chip"
unintentionally got rid of initialization of the atomic variable
brcmf_mmc_suspend. The patch restore that particular piece of code.
Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
staging: brcm80211: use PCI_DEVICE() macro in device table
The macro PCI_DEVICE() fills in the entry in abbreviated manner. Using
this removes the "lines over 80 characters" checkpatch warning on these
entries.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Franky Lin [Mon, 8 Aug 2011 13:58:32 +0000 (15:58 +0200)]
staging: brcm80211: remove structure sdio_hc in brcmfmac
Most members in sdio_hc are no longer needed anymore. And fullmac
is keeping a global pointer of this structure. This patch deletes
the structure and places the useful member to a new structure
brcmf_sdio_dev. The pointer of brcmf_sdio_dev will be save in the
private driver data during sdio_probe. Therefore, we don't need to
keep the global pointer.
Reviewed-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Roland Vossen [Mon, 8 Aug 2011 13:58:25 +0000 (15:58 +0200)]
staging: brcm80211: removed global variable from sdio fullmac
Code cleanup. bus->card is assigned in brcmf_sdbrcm_probe (before
brcmf_sdbrcm_probe_attach()). Since w_sdreg32() and r_sdreg32() are called
only after that assignment, they can safely use bus->card. Thus there
is no instance left where brcmf_sdcard_reg_read() or brcmf_sdcard_reg_write()
is called with a NULL parameter, so the mechanism in bcmsdh.c that deals with
a NULL pointer could be deleted.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Roland Vossen [Mon, 8 Aug 2011 13:58:23 +0000 (15:58 +0200)]
staging: brcm80211: remove MIPS specific 'sync' instruction in fullmac
This instruction was required for the bcm4716/bcm4322, but since the
fullmac driver only supports bcm4329, it could be removed. After that,
the R_REG macro's were identical and thus were reduced to just 1 R_REG
macro.
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Roland Vossen [Mon, 8 Aug 2011 13:58:22 +0000 (15:58 +0200)]
staging: brcm80211: fixed build issue for big endian platforms
Driver now builds for big endian mips platform, possibly also for other
big endian platforms. A change was made to the R_REG and W_REG macro's.
These macro's perform an xor (^) operation for endianess swap purposes.
Gcc complained because an xor operation is not allowed on a pointer type.
Fixed this by casting the pointer to an unsigned long.
staging: brcm80211: remove volatile keyword used in struct rte_console
Two members vcons_in and vcons_out were declared using the volatile
keyword. However, there is no reason for doing so. The member is
used only to calculate the backplane address to access using offsetof.
This address is passed to subsequent read function. Use of volatile
is not warranted.
Signed-off-by: Arend van Spriel <arend@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
staging: brcm80211: replace semaphore by wait_queue for sysioc thread
The sysioc thread was triggered using a semaphore. Now it waits for
a wake_up() on its wait queue and the semaphore has been removed as
the semaphore serves another purpose. This removes a checkpatch
warning for dhd_linux.c.
Signed-off-by: Arend van Spriel <arend@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Reviewed-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>