summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8192u/r8192U_core.c
AgeCommit message (Collapse)Author
2016-10-13net: deprecate eth_change_mtu, remove usageJarod Wilson
With centralized MTU checking, there's nothing productive done by eth_change_mtu that isn't already done in dev_set_mtu, so mark it as deprecated and remove all usage of it in the kernel. All callers have been audited for calls to alloc_etherdev* or ether_setup directly, which means they all have a valid dev->min_mtu and dev->max_mtu. Now eth_change_mtu prints out a netdev_warn about being deprecated, for the benefit of out-of-tree drivers that might be utilizing it. Of note, dvb_net.c actually had dev->mtu = 4096, while using eth_change_mtu, meaning that if you ever tried changing it's mtu, you couldn't set it above 1500 anymore. It's now getting dev->max_mtu also set to 4096 to remedy that. v2: fix up lantiq_etop, missed breakage due to drive not compiling on x86 CC: netdev@vger.kernel.org Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-09-23staging: rtl8192u: remove unused functions in r8192U_core.cBaoyou Xie
We get 2 warnings when building kernel with W=1: drivers/staging/rtl8192u/r8192U_core.c:925:12: warning: no previous declaration for 'ieeerate2rtlrate' [-Wmissing-declarations] drivers/staging/rtl8192u/r8192U_core.c:958:12: warning: no previous declaration for 'rtl8192_rate2rate' [-Wmissing-declarations] drivers/staging/rtl8192u/r8192U_core.c:1322:11: warning: no previous declaration for 'rtl8192_IsWirelessBMode' [-Wmissing-declarations] In fact, these functions are unused in r8192U_core.c, but should be removed. So this patch removes the unused functions. Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20Staging: rtl8192u: Remove useless type conversionBhumika Goyal
Some type conversions like casting a pointer to a pointer of same type, casting to the original type using addressof(&) operator etc. are not needed. Therefore, remove them. Done using coccinelle: @@ type t; t *p; t a; @@ ( - (t)(a) + a | - (t *)(p) + p | - (t *)(&a) + &a ) Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20staging: rtl8192u: r8192U_core: fix checkpatch permission warningsXavier Roumegue
Fix the following warnings: Symbolic permissions are not preferred. Consider using octal permissions. Signed-off-by: Xavier Roumegue <xroumegue@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21staging/rtl8192u: use s8 instead of charArnd Bergmann
Compiling the rtlwifi drivers for ARM with gcc -Wextra warns about lots of incorrect code that results from 'char' being unsigned here, e.g. staging/rtl8192u/r8192U_core.c:4150:16: error: comparison is always false due to limited range of data type [-Werror=type-limits] staging/rtl8192u/r8192U_dm.c:646:50: error: comparison is always false due to limited range of data type [-Werror=type-limits] This patch changes all uses of 'char' in this driver that refer to 8-bit integers to use 's8' instead, which is signed on all architectures. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-15staging: rtl8192u: r8192U_core: don't print error when allocating urb failsWolfram Sang
kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-18rtl8192u: Remove unused semaphore rf_semBinoy Jayan
The semaphore 'rf_sem' in rtl8192u has no users, hence removing it. Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-18rtl8192u: ieee80211_device: Replace semaphore wx_sem with mutexBinoy Jayan
The semaphore 'wx_sem' in ieee80211_device is a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-18rtl8192u: r8192_priv: Replace semaphore wx_sem with mutexBinoy Jayan
The semaphore 'wx_sem' in r8192_priv is a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-18staging: rtl8192u: propagate errors in write_nic_dwordSalah Triki
Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_dword from void to int. Signed-off-by: Salah Triki <salah.triki@acm.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-18staging: rtl8192u: propagate errors in write_nic_wordSalah Triki
Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_word from void to int. Signed-off-by: Salah Triki <salah.triki@acm.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-18staging: rtl8192u: propagate errors in write_nic_byte_ESalah Triki
Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_byte_E from void to int. Signed-off-by: Salah Triki <salah.triki@acm.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-18staging: rtl8192u: propagate errors in write_nic_byteSalah Triki
Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_byte from void to int. Signed-off-by: Salah Triki <salah.triki@acm.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-18staging: rtl8192u: check return value of rtl8192_read_eeprom_infoSalah Triki
The call of rtl8192_read_eeprom_info may fail, therefore its return value must be checked and propagated in the case of error Signed-off-by: Salah Triki <salah.triki@acm.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-18staging: rtl8192u: propagate errors in rtl8192_read_eeprom_infoSalah Triki
Propagate error from eprom_read and change the return type of rtl8192_read_eeprom_info from void to int. Signed-off-by: Salah Triki <salah.triki@acm.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-18staging: rtl8192u: check return value eprom_readSalah Triki
The call of eprom_read may fail, therefore its return value must be checked Signed-off-by: Salah Triki <salah.triki@acm.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-20Merge tag 'staging-4.7-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging and IIO driver updates from Greg KH: "Here's the big staging and iio driver update for 4.7-rc1. I think we almost broke even with this release, only adding a few more lines than we removed, which isn't bad overall given that there's a bunch of new iio drivers added. The Lustre developers seem to have woken up from their sleep and have been doing a great job in cleaning up the code and pruning unused or old cruft, the filesystem is almost readable :) Other than that, just a lot of basic coding style cleanups in the churn. All have been in linux-next for a while with no reported issues" * tag 'staging-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (938 commits) Staging: emxx_udc: emxx_udc: fixed coding style issue staging/gdm724x: fix "alignment should match open parenthesis" issues staging/gdm724x: Fix avoid CamelCase staging: unisys: rename misleading var ii with frag staging: unisys: visorhba: switch success handling to error handling staging: unisys: visorhba: main path needs to flow down the left margin staging: unisys: visorinput: handle_locking_key() simplifications staging: unisys: visorhba: fail gracefully for thread creation failures staging: unisys: visornic: comment restructuring and removing bad diction staging: unisys: fix format string %Lx to %llx for u64 staging: unisys: remove unused struct members staging: unisys: visorchannel: correct variable misspelling staging: unisys: visorhba: replace functionlike macro with function staging: dgnc: Need to check for NULL of ch staging: dgnc: remove redundant condition check staging: dgnc: fix 'line over 80 characters' staging: dgnc: clean up the dgnc_get_modem_info() staging: lustre: lnet: enable configuration per NI interface staging: lustre: o2iblnd: properly set ibr_why staging: lustre: o2iblnd: remove last of kiblnd_tunables_fini ...
2016-05-04treewide: replace dev->trans_start update with helperFlorian Westphal
Replace all trans_start updates with netif_trans_update helper. change was done via spatch: struct net_device *d; @@ - d->trans_start = jiffies + netif_trans_update(d) Compile tested only. Cc: user-mode-linux-devel@lists.sourceforge.net Cc: linux-xtensa@linux-xtensa.org Cc: linux1394-devel@lists.sourceforge.net Cc: linux-rdma@vger.kernel.org Cc: netdev@vger.kernel.org Cc: MPT-FusionLinux.pdl@broadcom.com Cc: linux-scsi@vger.kernel.org Cc: linux-can@vger.kernel.org Cc: linux-parisc@vger.kernel.org Cc: linux-omap@vger.kernel.org Cc: linux-hams@vger.kernel.org Cc: linux-usb@vger.kernel.org Cc: linux-wireless@vger.kernel.org Cc: linux-s390@vger.kernel.org Cc: devel@driverdev.osuosl.org Cc: b.a.t.m.a.n@lists.open-mesh.org Cc: linux-bluetooth@vger.kernel.org Signed-off-by: Florian Westphal <fw@strlen.de> Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com> Acked-by: Mugunthan V N <mugunthanvnm@ti.com> Acked-by: Antonio Quartulli <a@unstable.cc> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-04-29staging: rtl8192u: Fix crash due to pointers being "confusing"Ben Hutchings
There's no net_device stashed in skb->cb, there's a net_device * there. To make it *really* clear, also change the write of the dev pointer into skb->cb from a memcpy() to an assignment. Fixes: 3fe563249374 ("staging: rtl8192u: r8192U_core.c: Cleaning up ...") Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29staging: rtl8192u: rewrite NULL comparison for pointersNicholas Sim
When testing pointers, it is not necessary to explicitly compare to NULL. Rewrite if condition as (!ptr) or (ptr) as suggested in Documentation/CodingStyle Signed-off-by: Nicholas Sim <nicholassimws@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29staging: rtl8192u: add blank line after declarationsNicholas Sim
Add a blank line after function/struct/union/enum declarations for readability, as suggested in Documentation/CodingStyle Signed-off-by: Nicholas Sim <nicholassimws@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29staging: rtl8192u: remove blank lines after braces (opening)Nicholas Sim
Remove unneeded blank lines appearing after opening braces as suggested by checkpatch.pl Signed-off-by: Nicholas Sim <nicholassimws@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29staging: rtl8192u: remove blank lines before braces (closing)Nicholas Sim
Remove unneeded blank lines occuring before closing braces Signed-off-by: Nicholas Sim <nicholassimws@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11Staging: rtl8192u: Clean up tests if NULL returned on failureBhumika Goyal
Some functions return Null as their return value on failure. !x is generally preferred over x==NULL or NULL==x. So make use of !x if the value returned on failure is NULL. Done using coccinelle: @@ expression e; statement S; @@ e = \(kmalloc\|devm_kzalloc\|kmalloc_array \|devm_ioremap\|usb_alloc_urb\|alloc_netdev\)(...); - if(e==NULL) + if(!e) S Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20staging: rtl8192u: Remove create_workqueue()Bhaktipriya Shridhar
With cmwq, use of dedicated workqueues can be replaced by system_wq. Removed the dedicated workqueue and used system_wq instead. Since the work items in the workqueues do not need to be ordered, increase of concurrency by switching to system_wq should not break anything. All work items are sync canceled so it is guaranteed that no work is running when driver is detached. Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: r8192U: Fix check pointer after usage problemLarry Finger
In routine rtl8192_tx_isr(), pointer skb is dereferenced before it is checked for NULL. This patch has only been compile-tested, as I do not have the hardware. This problem was reported at https://bugzilla.kernel.org/show_bug.cgi?id=109951. Fixes: bugzilla.kernel.org: #109951 Reported-by: Yong Shi <brave_shi@163.com> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Cc: Yong Shi <brave_shi@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging/rtl8192u: fixed typosYannik Schmidt
Fixed all checkpatch-warnings concerning typos in r8192U_core.c. Signed-off-by: Yannik Schmidt <yannik.schmidt@thermoscan.de> Signed-off-by: Lukas Lehnert <lukas.lehnert@web.de> CC: linux-kernel@i4.cs.fau.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: rtl8192u: use to_delayed_workGeliang Tang
Use to_delayed_work() instead of open-coding it. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-15Staging: rtl8192u: Remove unused functionKsenija Stanojevic
Function rtl8192_try_wake_queue is defined but not used, so remove it. Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24Staging: rtl8192u: Eliminate use of MSECS macroShraddha Barke
Use msecs_to_jiffies instead of driver specific macro MSECS. This is done using Coccinelle and semantic patch used for this is as follows: @@expression t;@@ - MSECS(t) + msecs_to_jiffies(t) Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-13rtl8192u: BIT() macro cleanupAnish Bhatt
Use the BIT(x) macro directly instead using multiple BITX defines. Signed-off-by: Anish Bhatt <anish@gatech.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12staging: rtl8192u: r8192U_core: fix negative noise valueLuis de Bethencourt
ieee80211_rx_stats.noise is of type uint8, so it shouldn't be assigned a negative number. Assigning it 0x100 - 98, which is the equivalent to -98 dBm when IW_QUAL_DBM is set. Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12Staging: rtl8192u: Do not DMA on the stackKsenija Stanojevic
Fix error "doing DMA on the stack" by using kzalloc for buffer allocation. Issue found by smatch. Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-20staging: rtl8192u: r8192U_core: add line breaks to keep lines under 80 ↵Raphaël Beamonte
characters Add line breaks in multiple lines to keep them under 80 characters, as to follow the kernel code style. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-16staging: rtl8192u: r8192U_core: fix comments lines over 80 charactersRaphaël Beamonte
Move, replace and reorganize comments to stay under 80 characters per line, as to follow the kernel code style. Some unuseful comments have been removed. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-15staging/rtl8192u: remove unused functionNicolas Joseph
Remove unused function N_DBPSOfRate. This function was only used by function ComputeTxTime that was removed in the previous commit 742728f97a99 ("staging: rtl8192u: remove unused function.") Signed-off-by: Nicolas Joseph <nicolas.joseph@homecomputing.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: fix use ether_addr_copy() over memcpy() code ↵Raphaël Beamonte
style issue Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) The values used are stored as dev_addr in net_device (declared in include/linux/netdevice.h) and sa_data in sockaddr (declared in include/linux/socket.h). Both these elements are u16 aligned as shown by using pahole (position must be a multiple of sizeof(u16)): unsigned char * dev_addr; /* 888 8 */ char sa_data[14]; /* 2 14 */ It is thus safe to use ether_addr_copy() instead of memcpy() for that call, as it is already done in multiple files in the Linux kernel sources: drivers/net/ethernet/broadcom/genet/bcmgenet.c drivers/net/ethernet/brocade/bna/bnad.c drivers/net/ethernet/emulex/benet/be_main.c drivers/net/ethernet/ezchip/nps_enet.c drivers/net/ethernet/ibm/ibmveth.c drivers/net/ethernet/intel/fm10k/fm10k_netdev.c drivers/net/ethernet/intel/i40e/i40e_main.c drivers/net/ethernet/mellanox/mlx5/core/en_main.c drivers/net/usb/lan78xx.c net/8021q/vlan_dev.c net/batman-adv/soft-interface.c net/dsa/slave.c Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: fix quoted string split across lines code ↵Raphaël Beamonte
style issue Quoted strings should not be split to help text grep in the source. All quoted strings that were split have thus been merged to one unique quoted string each to follow the code style. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: fix missing blank line after declarations ↵Raphaël Beamonte
code style issue Adds whitespaces to separate the variables declarations and the function content. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: fix unnecessary whitespace code style issueRaphaël Beamonte
Whitespaces are not necessary before a quoted newline. Remove those. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: fix unnecessary else after return code style ↵Raphaël Beamonte
issue An else statement is not useful after a return. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: fix unnecessary parentheses code style issueRaphaël Beamonte
Two sets of parentheses were used to contain the same statement. In those cases, one of them has been removed, as unnecessary. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: fix unnecessary check before kfree code ↵Raphaël Beamonte
style issue kfree(NULL) is safe and the checks were not required. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: remove forward declarations in .c fileRaphaël Beamonte
Checkpatch was giving a "externs should be avoided in .c files" because of these forward declarations. As these were not useful in this case, they have been removed. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: fix unecessary braces code style issueRaphaël Beamonte
braces {} are not necessary for any arm of a statement containing one statement on each side. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: remove return statement of void functionRaphaël Beamonte
void function return statement was not useful in this case. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: include linux/uaccess.h instead of asm/uaccess.hRaphaël Beamonte
Use #include <linux/uaccess.h> instead of <asm/uaccess.h> Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: clean C99 // commentsRaphaël Beamonte
Replace C99 // comments by /* comments */ to follow the kernel code style. Remove some unuseful comments. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: whitespace neatening to fix consistent ↵Raphaël Beamonte
spacing code style errors Clean-up the file by using a cleaner spacing around symbols and words. Mostly use the automatic checkpatch whitespacing fixes. This takes care of the consistent spacing errors reported by checkpatch. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12staging: rtl8192u: r8192U_core: fix missing struct leading to consistent ↵Raphaël Beamonte
spacing code style error A missing struct keyword in variable declaration triggered a need consistent spacing around '*' code style error. The struct keyword thus has been added everywhere for the rtl8192_rx_info struct, and therefore its typedef removed as not needed anymore. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>