read_nic_*() functions are defined in r8192U_core.c.
They call internally usb_control_msg() to read the
nic registers and return the value read.
Following a remark made by Dan Carpenter, if usb_control_msg()
fails, the value returned will be invalid.
To accommodate for this, this patch changes the functions
to take a pointer as argument to set the value read and
return 0 on success and the error status on failure, so
that callers of read_nic_*() can check the return status.
Some other fixes introduced in read_nic_*() functions are:
The expressions (1<<EPROM_*_SHIFT) used to address and set
the individual bits of the eeprom register were replaced
with EPROM_*_BIT bitmasks to make the code more intuitive.
EPROM_*_BIT bitmasks were defined in r8192U_hw.h and
EPROM_*_SHIFT were removed.
In netdev_err(), which is called in case of failure,
the hardcoded function name in the error log message was
replaced with __func__ to reduce line size.
Also, from the error log message, it was omitted the word
"Timeout" and it is just reported the error code since the
failure can not only be due to timeout expiration but also
due to a memory allocation failure. In case of timeout
expiration, usb_start_wait_urb() prints an appropriate log
message when debug is enabled.
Finally, some minor fixes to the coding style were applied in
lines affected by the above changes, including the removal
of ifdef DEBUG_RX (the debugging of reads and writes of the
nic registers shall be done with explicit check on their
return status which will be added in a follow on patch).
Dan Carpenter [Thu, 6 Jun 2013 07:30:49 +0000 (10:30 +0300)]
Staging: rtl8192u: fix a reversed test
Sean MacLennan fixed this in the rtl8192e driver and we should fix
it here as well.
It's pretty harmless. This information comes from the firmware, if
we were to hit this bug we would read beyond the end of the array
once or twice before returning and update our statistics with bogus
data.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Lawniczak [Thu, 6 Jun 2013 16:10:47 +0000 (18:10 +0200)]
keucr: migrate printk to dev_dbg/info/warn/err
as per suggestion of checkpatch.pl; this resolves warnings like "Prefer
netdev_info .. then dev_info .. to printk".
Changed signature of function usb_stor_print_cmd in init.c to enable
usage of dev_err
Signed-off-by: Laura Lawniczak <laura.lawniczak@googlemail.com> Signed-off-by: Johannes Schilling <of82ecuq@cip.cs.fau.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peng Tao [Thu, 6 Jun 2013 14:59:13 +0000 (22:59 +0800)]
staging/lustre/libcfs: cleanup linux-crypto
We don't need to implement crc32 and crc32pclmul on our own.
The crc32-pclmul support was merged into the 3.8 kernel in commit 78c37d1, no need to keep a local copy in Lustre anymore.
The crc32 implementation is identical to crypto-crc32. So drop
Lustre's private implementation and select kernel crypto in Kconfig.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8192u: replace macro rx_hal_is_cck_rate() in r8192U_core.c
This patch replaces macro rx_hal_is_cck_rate() with
the static inline function rx_hal_is_cck_rate().
This replacement was suggested by Dan Carpenter and
has the following benefits:
- improves code readability
- guarantees type safety
- improves code efficiency by enforcing the evaluation of
the simple boolean expression (!pdrvinfo->RxHT) to be
done before the evaluation of the more complex one
(pdrvinfo->RxRate == DESC90_RATE1M ||
pdrvinfo->RxRate == DESC90_RATE2M ||
pdrvinfo->RxRate == DESC90_RATE5_5M ||
pdrvinfo->RxRate == DESC90_RATE11M)
staging: rtl8192u: add spaces around ?:&&|| in r8192U_core.c
This patch fixes the following checkpatch errors:
ERROR: spaces required around that '?'
ERROR: spaces required around that ':'
ERROR: spaces required around that '&&'
ERROR: spaces required around that '||'
staging: comedi: pcmda12: rename the analog output (*insn_{read, write}) functions
For aesthetic reasons. rename these functions so they have namespace
associated with the driver. Also remove the unnecessary '&' when setting
the callbacks.
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>
'BITS' is a pretty generic name for a define. It's only used in
the board attach to set the subdevice 'maxdata' so instead of
renaming the define just open code the value and remove the define.
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>
Refactor this function into two new functions in order to reduce the indent
levels and clean up the ugly line breaks that, unsuccessfully, try to keep
the lines < 80 chars.
The first function handles the irq for a specific asic.
The second function handles the irq for a specific subdevice that is
associated with the asic.
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>
Ben Chan [Tue, 4 Jun 2013 05:55:38 +0000 (22:55 -0700)]
staging: gdm72xx: WIMAX_GDM72XX should depend on either USB or MMC
The gdm72xx driver needs to have either the USB or SDIO implementation
enabled to provide useful functionalities, so the driver should depend
on either USB or MMC. This patch makes WIMAX_GDM72XX depend on either
USB or MMC.
Also, WIMAX_GDM72XX needs to be built as a module if its dependent
interface, either USB or MMC, is built as a module. This patch enforces
that in the WIMAX_GDM72XX_USB and WIMAX_GDM72XX_SDIO dependency.
Reported-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Ben Chan <benchan@chromium.org> Cc: Sage Ahn <syahn@gctsemi.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John L. Hammond [Wed, 5 Jun 2013 13:13:40 +0000 (21:13 +0800)]
staging/lustre/lprocfs: interpret result of dt_statfs() correctly
I accidentally reversed the sense of the error check after the call to
dt_statfs() in lprocfs_dt_rd_{blksize,{files,kbytes}{free,avail}.
Unreverse the error checking.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3300
Lustre-change: http://review.whamcloud.com/6385 Signed-off-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: Robert Read <robert.read@intel.com> Reviewed-by: Emoly Liu <emoly.liu@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Aaro Koskinen [Sat, 1 Jun 2013 18:42:58 +0000 (21:42 +0300)]
staging: MIPS: add Octeon USB HCD support
Add support for Octeon USB HCD. Tested on EdgeRouter Lite with USB
mass storage.
The driver has been extracted from GPL sources of EdgeRouter Lite firmware
(based on Linux 2.6.32.13). Some minor fixes and cleanups have been done
to make it work with 3.10-rc3.
$ uname -a
Linux (none) 3.10.0-rc3-edge-00005-g86cb5bc #41 SMP PREEMPT Sat Jun 1 20:41:46 EEST 2013 mips64 GNU/Linux
$ modprobe octeon-usb
[ 37.971683] octeon_usb: module is from the staging directory, the quality is unknown, you have been warned.
[ 37.983649] OcteonUSB: Detected 1 ports
[ 37.999360] OcteonUSB OcteonUSB.0: Octeon Host Controller
[ 38.004847] OcteonUSB OcteonUSB.0: new USB bus registered, assigned bus number 1
[ 38.012332] OcteonUSB OcteonUSB.0: irq 122, io mem 0x00000000
[ 38.019970] hub 1-0:1.0: USB hub found
[ 38.023851] hub 1-0:1.0: 1 port detected
[ 38.028101] OcteonUSB: Registered HCD for port 0 on irq 122
[ 38.391443] usb 1-1: new high-speed USB device number 2 using OcteonUSB
[ 38.586922] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 38.597375] scsi0 : usb-storage 1-1:1.0
[ 39.604111] scsi 0:0:0:0: Direct-Access USB DISK 2.0 PMAP PQ: 0 ANSI: 4
[ 39.619113] sd 0:0:0:0: [sda] 7579008 512-byte logical blocks: (3.88 GB/3.61 GiB)
[ 39.630696] sd 0:0:0:0: [sda] Write Protect is off
[ 39.635945] sd 0:0:0:0: [sda] No Caching mode page present
[ 39.641464] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 39.651341] sd 0:0:0:0: [sda] No Caching mode page present
[ 39.656917] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 39.664296] sda: sda1 sda2
[ 39.675574] sd 0:0:0:0: [sda] No Caching mode page present
[ 39.681093] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 39.687223] sd 0:0:0:0: [sda] Attached SCSI removable disk
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Cc: David Daney <ddaney.cavm@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Harsh Kumar [Fri, 31 May 2013 15:30:42 +0000 (21:00 +0530)]
Staging: winbond: Check for unsuccessful allocation immediately
Check to see if allocation by kzalloc() or usb_alloc_urb() was unsuccessful
immediately after the allocation. Exit from the function can be right at that
point in case of allocation failure.
This avoids unnecessary use of usb_alloc_urb() & usb_free_urb() if kzalloc()
returns NULL.
Also, makes the code better structured & easier to understand.
Dan Carpenter [Thu, 30 May 2013 08:00:34 +0000 (11:00 +0300)]
Staging: crystalhd: remove an unneeded NULL check
We already established earlier in the function that "temp" is
non-NULL. We also don't need to set to NULL because it's a stack
variable an we return immediately.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rts5139: Use correct USB transfer interval to fix syslog spamming
Using correct transfer interval as specified by the USB endpoint
when doing the interrupt transfer fixes the warning printed by
xhci USB core on every transfer that resulted in spamming
"xhci_queue_intr_tx: 74 callbacks suppressed" to syslog
every 5 seconds.
Signed-off-by: Marcus Overhagen <marcus.overhagen@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rts5139: Fix SD card detection on Samsung NP730U3E Ultrabook
The timeout detection implemented in this driver isn't very
robust. Although the USB interrupt transfer was successful,
the polling thread often reported timeouts because the 50ms
had expired before it got scheduled, and the SD card wasn't
detected. Increasing it to 100ms, as used in other places of
this driver, makes it work.
Signed-off-by: Marcus Overhagen <marcus.overhagen@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wei Yongjun [Mon, 3 Jun 2013 02:08:13 +0000 (10:08 +0800)]
staging/lustre: fix return value check in libcfs_sock_ioctl()
In case of error, the function sock_alloc_file() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().
Peng Tao [Mon, 3 Jun 2013 13:58:18 +0000 (21:58 +0800)]
staging/lustre: silence gcc build warning
got bellow build warning that is indeed a false alarm.
CC [M] drivers/staging/lustre/lustre/llite/llite_nfs.o
drivers/staging/lustre/lustre/libcfs/nidstrings.c: In function ‘
libcfs_str2net_internal’:
drivers/staging/lustre/lustre/libcfs/nidstrings.c:432:17: warning: ‘nf’ may be
used uninitialized in this function [-Wuninitializ
ed]
Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Hongchao Zhang [Mon, 3 Jun 2013 13:41:00 +0000 (21:41 +0800)]
staging/lustre/osc: check ostid if no OBD_CONNECT_FID
in lustre_set_wire_obdo, if "ocd->ocd_connect_flags" doesn't contain
OBD_CONNECT_FID, use "ost_id" to check the type of the object
instead of using ost_id.oi_fid only.
Jian Yu [Mon, 3 Jun 2013 13:40:59 +0000 (21:40 +0800)]
staging/lustre/tests: check nr_local in ofd_preprw()
This patch checks the number of bulk I/O RPC pages with
PTLRPC_MAX_BRW_PAGES in ofd_preprw() to avoid
LASSERT(iobuf->dr_npages < iobuf->dr_max_pages) occurring
while larger I/O size is specified.
The patch also fixes echo_client_prep_commit() to reuse
the env context so as to avoid LASSERT(info->fti_exp == NULL)
occurring while the bulk I/O size is larger than
PTLRPC_MAX_BRW_SIZE.
The patch also improves obdfilter-survey to handle the
case while interoprating with old server.
[picked echo client part for upstream kernel submission]
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2598
Lustre-change: http://review.whamcloud.com/6394 Signed-off-by: Jian Yu <jian.yu@intel.com> Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Always build 64bit ino internally except the client is mounted
with "32bitapi" option, so client will always use 64bit ino
internally. It will build 32bit ino, only if application requires
32 bit ino.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3318
Lustre-change: http://review.whamcloud.com/6371 Signed-off-by: wang di <di.wang@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Ned Bass <bass6@llnl.gov> Reviewed-by: Fan Yong <fan.yong@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Emoly Liu [Mon, 3 Jun 2013 13:40:55 +0000 (21:40 +0800)]
staging/lustre/mdt: set ATTR_xTIME_SET to make atime update properly
To make atime update properly between 1.8 client and 2.x server,
this patch includes the following fixes:
- if MDS_ATTR_xTIME is set without MDS_ATTR_xTIME_SET and the client
does not have OBD_CONNECT_FULL20, convert it to LA_xTIME in
mdt_setattr_unpack().
- set both MDS_ATTR_xTIME | MDS_ATTR_xTIME_SET for timestamps in
ll_prepare_close(). This allows us to fix the server-side timestamp
setting in the future.
- remove attr_unpack() and convert the flags from MDS_ATTR_ to LA_*
directly in mdt_attr_valid_xlate() instead.
- improve sanityn.sh test_23().
[picked llite part for upstream kernel submission]
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3036
Lustre-change: http://review.whamcloud.com/6327 Signed-off-by: Liu Ying <emoly.liu@intel.com> Reviewed-by: Fan Yong <fan.yong@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix the CL_LAYOUT comment, since it is possible that layout swap
could be used in cases where the file content is changed. I don't
think there are any real world use cases for this, but that depends
on what tools are being used on the filesystem.
Also change the "LAYOUT" string for this ChangeLog record type to
be "LYOUT" to match the convention of other strings to only be
5 characters long.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3279
Lustre-change: http://review.whamcloud.com/6338 Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging/lustre/ost: Ensure dirty flushed on fiemap ioctl
Data corruption is possible if cp(coreutils) uses FIEMAP to obtain
data holes in shared file, since there could be dirty cache on
other clients which hasn't been flushed back.
To ensure all the dirty on remote clients being flushed back on
fiemap ioctl, we'd acquire ldlm lock on server side for fiemap,
unless the local client (which invoke fiemap) has cached lock.
[picked osc part for upstream kernel submission]
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3219
Xyratex-bug-id: MRP-1001
Lustre-change: http://review.whamcloud.com/6127 Signed-off-by: Artem Blagodarenko <artem_blagodarenko@xyratex.com> Signed-off-by: Niu Yawei <yawei.niu@intel.com> Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com> Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andreas Dilger [Mon, 3 Jun 2013 13:40:52 +0000 (21:40 +0800)]
staging/lustre/changelog: fix CL_LAYOUT, accept all types
In order to avoid compatibility issues with older ChangeLog consumers,
change the new CL_LAYOUT record to use the value previously assigned
to CL_IOCTL. The CL_IOCTL type was never used anywhere, and it didn't
really make any sense as a ChangeLog record, since it could really
mean anything at all.
The changelog_show_cb() function is renamed to changelog_kkuc_cb(),
since it is really about consuming the ChangeLog and passing it up to
the kernel-user-coms interface. At some point we should consider to
implement a DBUS-based ChangeLog interface as well.
The changelog_kkuc_cb() "sanity check" on cr_type was removed, since
there is no reason the client kernel needs to know every record type
that is being passed to userspace. It is up to the client tool to
determine what records that it can process.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3279
Lustre-change: http://review.whamcloud.com/6308 Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Bobi Jam <bobijam@gmail.com> Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com> Reviewed-by: Mike Pershin <mike.pershin@intel.com> Reviewed-by: Aurelien Degremont <aurelien.degremont@cea.fr> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
John L. Hammond [Mon, 3 Jun 2013 13:40:51 +0000 (21:40 +0800)]
staging/lustre/lprocfs: use stats counter index for *pos
In lprocfs_stats_seq_{start,next,show,stop}() encode the counter index
(rather than the counter address) into *pos. Doing so simplifies these
functions and fixes a bug in the case of per-CPU stats where no stats
would be displayed at all if no events had yet occurred on CPU 0.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2979
Lustre-change: http://review.whamcloud.com/6328 Signed-off-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: wangdi <di.wang@intel.com> Reviewed-by: Bobi Jam <bobijam@gmail.com> Reviewed-by: Emoly Liu <emoly.liu@intel.com> Reviewed-by: Keith Mannthey <keith.mannthey@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
wang di [Mon, 3 Jun 2013 13:40:50 +0000 (21:40 +0800)]
staging/lustre/ost: check pre 2.4 echo client in obdo validation
Because old echo client still uses o_id/o_seq for objid,
but new echo client will uses FID for the objid. Add
OBD_CONNECT_FID for 2.4 echo client, so 2.4 OST will
convert o_id/o_seq to FID if the request from old echo
client.
Add local flag OBD_FL_OSTID for o_flags to indicate
OST does not support FID yet, then echo client will
still send o_id/o_seq to OST.
cleanup ost_validate_obdo
[picked client part for upstream kernel submission]
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3187
Lustre-change: http://review.whamcloud.com/6287 Signed-off-by: wang di <di.wang@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Mike Pershin <mike.pershin@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
wang di [Mon, 3 Jun 2013 13:40:49 +0000 (21:40 +0800)]
staging/lustre/llog: Do not use ostid swab for llogid
Since logid still use id/seq format in the request,
it will be swabbed by its own swab func, instead of
using ostid swab, which might see logid as FID incorrectly.
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3302
Lustre-change: http://review.whamcloud.com/6305 Signed-off-by: wang di <di.wang@intel.com> Reviewed-by: John Hammond <johnlockwoodhammond@gmail.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>