summaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/lan78xx.c
Commit message (Collapse)AuthorAgeFilesLines
* net: usb: set error code when usb_alloc_urb failsPan Bian2016-12-051-0/+1
| | | | | | | | | | | | | | In function lan78xx_probe(), variable ret takes the errno code on failures. However, when the call to usb_alloc_urb() fails, its value will keeps 0. 0 indicates success in the context, which is inconsistent with the execution result. This patch fixes the bug, assigning "-ENOMEM" to ret when usb_alloc_urb() returns a NULL pointer. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188771 Signed-off-by: Pan Bian <bianpan2016@163.com> Acked-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: mark symbols static where possibleBaoyou Xie2016-09-061-11/+13
| | | | | | | | | | | | | | | We get a few warnings when building kernel with W=1: drivers/net/usb/lan78xx.c:1182:6: warning: no previous prototype for 'lan78xx_defer_kevent' [-Wmissing-prototypes] drivers/net/usb/lan78xx.c:1409:5: warning: no previous prototype for 'lan78xx_nway_reset' [-Wmissing-prototypes] drivers/net/usb/lan78xx.c:2000:5: warning: no previous prototype for 'lan78xx_set_mac_addr' [-Wmissing-prototypes] .... In fact, these functions are only used in the file in which they are declared and don't need a declaration, but can be made static. so this patch marks these functions with 'static'. Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: usb: lan78xx: don't print error when allocating urb failsWolfram Sang2016-08-131-3/+1
| | | | | | | | kmalloc will print enough information in case of failure. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Acked-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* treewide: replace dev->trans_start update with helperFlorian Westphal2016-05-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* lan78xx: workaround of forced 100 Full/Half duplex mode errorWoojung Huh2016-04-281-1/+28
| | | | | | | | | At forced 100 Full & Half duplex mode, chip may fail to set mode correctly when cable is switched between long(~50+m) and short one. As workaround, set to 10 before setting to 100 at forced 100 F/H mode. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: fix statistics counter errorWoojung Huh2016-04-281-5/+10
| | | | | | | | | | Fix rx_bytes, tx_bytes and tx_frames error in netdev.stats. - rx_bytes counted bytes excluding size of struct ethhdr. - tx_packets didn't count multiple packets in a single urb - tx_bytes included 8 bytes of extra commands. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Revert "lan78xx: add ndo_get_stats64"David S. Miller2016-03-201-49/+0
| | | | | | | | | | | | | | | | | | | This reverts commit a59f8c5b048dc938fb958c91c282c865cd845705. There are several bugs in this new code, for example: 1) Uses sleeping locks in get_stats64, which is not allowed, as the operation can be invoked in an atomic context. 2) Uses PM fields without CONFIG_PM or similar guards. 3) Does not synchronize HW stats when the device runtime suspends. Therefore this is being reverted until a correct version is implemented. Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: add ndo_get_stats64Woojung Huh2016-03-181-0/+49
| | | | | | | | | | | | Add lan78xx_get_stats64 of ndo_get_stats64 to report all statistics counters including errors from HW statistics. Read from HW when auto suspend is disabled, use saved counter when auto suspend is enabled because periodic call to ndo_get_stats64 prevents USB auto suspend. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: handle statistics counter rolloverWoojung Huh2016-03-181-13/+239
| | | | | | | | | | | Update to handle statistics counter rollover. Check statistics counter periodically and compensate it when counter value rolls over at max (20 or 32bits). Simple mechanism adjusts monitoring timer to allow USB auto suspend. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: add ethtool set & get pause functionsWoojung.Huh@microchip.com2016-02-291-3/+77
| | | | | | | Add ethtool operations of set_pauseram and get_pauseparm. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: remove unnecessary codeWoojung.Huh@microchip.com2016-02-291-6/+1
| | | | | | | | It is not required after commit cd772de358d6 ("phy: keep pause flags in phy driver features") Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: replace devid to chipid & chiprevWoojung.Huh@microchip.com2016-02-291-9/+11
| | | | | | | Replace devid to chipid & chiprev for easy access. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: throttle TX path at slower than SuperSpeed USBWoojung.Huh@microchip.com2016-01-281-1/+3
| | | | | | | | Throttle TX path only at slower than SuperSpeed USB. SuperSpeed USB has enough bandwidth to maintain GigE. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: Add to handle mux control per chip idWoojung.Huh@microchip.com2016-01-281-27/+71
| | | | | | | | Depends on chip, some EEPROM pins are muxed with LED function. Disable & restore LED function to access EEPROM. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: change to use updated phy-ignore-interruptsWoojung.Huh@microchip.com2016-01-281-16/+14
| | | | | | | | Update lan78xx to use patch of commit 4f2aaf7dd95b ("Merge branch 'fix-phy-ignore-interrupts'"). Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2016-01-111-1/+54
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: drivers/net/bonding/bond_main.c drivers/net/ethernet/mellanox/mlxsw/spectrum.h drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c The bond_main.c and mellanox switch conflicts were cases of overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: lan78xx: Fix to write to OTP(One Time Programmable) per magic number.Woojung.Huh@microchip.com2016-01-071-1/+54
| | | | | | | | | | | | | | | | This patch fixes a bug writing to EEPROM in lan78xx_ethtool_set_eeprom() when asked to write to OTP. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | mdio: Move allocation of interrupts into coreAndrew Lunn2016-01-071-10/+1
|/ | | | | | | | | | Have mdio_alloc() create the array of interrupt numbers, and initialize it to POLLING. This is what most MDIO drivers want, so allowing code to be removed from the drivers. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: Return 0 when lan78xx_suspend() has no error.Woojung.Huh@microchip.com2015-09-281-1/+1
| | | | | | | | lan78xx_suspend() may return non-zero from lan78xx_write_reg() in some scenario. Fix to return 0 when lan78xx_suspend() has no error. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* usbnet: remove invalid checkAndrzej Hajda2015-09-221-5/+0
| | | | | | | | | | | | skb->len is always non-negative. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576 Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: Remove not defined MAC_CR_GMII_EN_ bit from MAC_CR.Woojung.Huh@microchip.com2015-09-171-3/+0
| | | | | | | Remove not defined MAC_CR_GMII_EN_ bit from MAC_CR. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: Create lan78xx_get_mdix_status() and lan78xx_set_mdix_status() for ↵Woojung.Huh@microchip.com2015-09-171-38/+52
| | | | | | | | | MDIX control. Create lan78xx_get_mdix_status() and lan78xx_set_mdix_status() for MDIX control. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: Remove phy defines in lan78xx.h and use defines in ↵Woojung.Huh@microchip.com2015-09-171-40/+40
| | | | | | | | | include/linux/microchipphy.h Remove phy defines in lan78xx.h and use defines in include/linux/microchipphy.h. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: Update to use phylib instead of mii_if_info.Woojung.Huh@microchip.com2015-09-171-362/+256
| | | | | | | Update to use phylib instead of mii_if_info. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: Check device ready bit (PMT_CTL_READY_) after reset the PHYWoojung.Huh@microchip.com2015-09-171-1/+1
| | | | | | | | Check device ready bit (PMT_CTL_READY_) after reset the PHY. Device may not be ready even if PHY_RST_ is cleared depends on configuration. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: Fix ladv/radv error handling in lan78xx_link_reset()Geert Uytterhoeven2015-09-061-6/+5
| | | | | | | | | | | | | | | | | net/usb/lan78xx.c: In function ‘lan78xx_link_reset’: net/usb/lan78xx.c:1107: warning: comparison is always false due to limited range of data type net/usb/lan78xx.c:1111: warning: comparison is always false due to limited range of data type Assigning return values that can be negative error codes to "u16" variables makes them positive, ignoring the errors. Hence use "int" instead. Drop the "unlikely"s (unlikely considered harmful) and propagate the actual error values instead of overriding them to -EIO while we're at it. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: Remove BUG_ON()Woojung.Huh@microchip.com2015-08-121-31/+0
| | | | | | | Removing BUG_ON() Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* lan78xx: Fix Smatch WarningsWoojung.Huh@microchip.com2015-08-121-11/+7
| | | | | | | | | | | lan78xx.c:2282 tx_complete() warn: variable dereferenced before check 'skb' (see line 2249) lan78xx.c:2885 lan78xx_bh() info: ignoring unreachable code. lan78xx.c:3159 lan78xx_probe() info: ignoring unreachable code. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driverWoojung.Huh@microchip.com2015-07-311-0/+3530
Repost patch of driver for LAN7800 family of USB 2.0 & USB 3.0 to Gigabit Ethernet. - remove module param which can be configurable by standard mechanism. - remove other module parms except msg_level per review comment. - update to handle byte swap for statistics structure correctly. Signed-off-by: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
OpenPOWER on IntegriCloud