History log of /drivers/net/usb/hso.c
Revision Date Author Comments
2f16669d322e05171c9e1cfd94f402f7399bd2a3 05-Mar-2012 Jiri Slaby <jslaby@suse.cz> TTY: remove re-assignments to tty_driver members

All num, magic and owner are set by alloc_tty_driver. No need to
re-set them on each allocation site.

pti driver sets something different to what it passes to
alloc_tty_driver. It is not a bug, since we don't use the lines
parameter in any way. Anyway this is fixed, and now we do the right
thing.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22ad7499bc9297e47c8779bf5523694f28338499 21-Feb-2012 Dan Carpenter <dan.carpenter@oracle.com> hso: memsetting wrong data in hso_get_count()

The intent was to clear out the icount struct here, but we accidentally
clear stack memory instead. It probably will lead to a NULL dereference
right away.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5e2cd0825a43824827b233d95bc47c0c970e5bef 08-Jul-2011 Greg KH <greg@kroah.com> hso: fix a use after free condition

This needs to go to netdev:

From: Octavian Purdila <octavian.purdila@intel.com>

In hso_free_net_device hso_net pointer is freed and then used to
cleanup urb pools. Catched with SLAB_DEBUG during S3 resume:

[ 95.824442] Pid: 389, comm: khubd Tainted: G C 2.6.36greenridge-01400-g423cf13-dirty #154 Type2 - Board Product Name1/OakTrail
[ 95.824442] EIP: 0060:[<c1151551>] EFLAGS: 00010202 CPU: 0
[ 95.824442] EIP is at kref_put+0x29/0x42
[ 95.824442] EAX: 6b6b6b6b EBX: 6b6b6b6b ECX: c2806b40 EDX: 00000037
[ 95.824442] ESI: c1258d56 EDI: edd3d128 EBP: ee8cde0c ESP: ee8cde04
[ 95.824442] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
[ 95.824442] Process khubd (pid: 389, ti=ee8cc000 task=ee95ed10 task.ti=ee8cc000)
[ 95.824442] Stack:
[ 95.824442] edd07020 00000000 ee8cde14 c1258b77 ee8cde38 ef933a44 ef93572b ef935dec
[ 95.824442] <0> 0000099a 6b6b6b6b 00000000 ee2da748 edd3e0c0 ee8cde54 ef933b9f ee3b53f8
[ 95.824442] <0> 00000002 ee2da748 ee2da764 ef936658 ee8cde60 ef933d0c ee2da748 ee8cde84
[ 95.824442] Call Trace:
[ 95.824442] [<c1258b77>] ? usb_free_urb+0x11/0x13
[ 95.824442] [<ef933a44>] ? hso_free_net_device+0x81/0xd8 [hso]
[ 95.824442] [<ef933b9f>] ? hso_free_interface+0x104/0x111 [hso]
[ 95.824442] [<ef933d0c>] ? hso_disconnect+0xb/0x18 [hso]
[ 95.824442] [<c125b7f1>] ? usb_unbind_interface+0x44/0x14a
[ 95.824442] [<c11e56e8>] ? __device_release_driver+0x6f/0xb1
[ 95.824442] [<c11e57c7>] ? device_release_driver+0x18/0x23
[ 95.824442] [<c11e4e92>] ? bus_remove_device+0x8a/0xa1
[ 95.824442] [<c11e3970>] ? device_del+0x129/0x163
[ 95.824442] [<c11e2dc0>] ? put_device+0xf/0x11
[ 95.824442] [<c11e39bc>] ? device_unregister+0x12/0x15
[ 95.824442] [<c125915f>] ? usb_disable_device+0x90/0xf0
[ 95.824442] [<c125544f>] ? usb_disconnect+0x6d/0xf8
[ 95.824442] [<c1255f91>] ? hub_thread+0x3fc/0xc57
[ 95.824442] [<c1048526>] ? autoremove_wake_function+0x0/0x2f
[ 95.824442] [<c102529d>] ? complete+0x34/0x3e
[ 95.824442] [<c1255b95>] ? hub_thread+0x0/0xc57
[ 95.824442] [<c10481fc>] ? kthread+0x63/0x68
[ 95.824442] [<c1048199>] ? kthread+0x0/0x68
[ 95.824442] [<c1002d76>] ? kernel_thread_helper+0x6/0x10

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6caa76b7786891b42b66a0e61e2c2fff2c884620 14-Feb-2011 Alan Cox <alan@linux.intel.com> tty: now phase out the ioctl file pointer for good

Only oddities here are a couple of drivers that bogusly called the ldisc
helpers instead of returning -ENOIOCTLCMD. Fix the bug and the rest goes
away.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
20b9d17715017ae4dd4ec87fabc36d33b9de708e 14-Feb-2011 Alan Cox <alan@linux.intel.com> tiocmset: kill the file pointer argument

Doing tiocmget was such fun we should do tiocmset as well for the same
reasons

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
60b33c133ca0b7c0b6072c87234b63fee6e80558 14-Feb-2011 Alan Cox <alan@linux.intel.com> tiocmget: kill off the passing of the struct file

We don't actually need this and it causes problems for internal use of
this functionality. Currently there is a single use of the FILE * pointer.
That is the serial core which uses it to check tty_hung_up_p. However if
that is true then IO_ERROR is also already set so the check may be removed.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5b89db0e84bef81f6aa324f8f22a9258ff873de3 13-Feb-2011 Jesper Juhl <jj@chaosbits.net> Net, USB, Option, hso: Do not dereference NULL pointer

In drivers/net/usb/hso.c::hso_create_bulk_serial_device() we have this
code:
...
serial = kzalloc(sizeof(*serial), GFP_KERNEL);
if (!serial)
goto exit;
...
exit:
hso_free_tiomget(serial);
...
hso_free_tiomget() directly dereferences its argument, which in the
example above is a NULL pointer, ouch.
I could just add a 'if (serial)' test at the 'exit' label, but since most
freeing functions in the kernel accept NULL pointers (and it seems like
this was also assumed here) I opted to instead change 'hso_free_tiomget()'
so that it is safe to call it with a NULL argument. I also modified the
function to get rid of a pointles conditional before the call to
'usb_free_urb()' since that function already tests for NULL itself -
besides fixing the NULL deref this change also buys us a few bytes in
size.
Before:
$ size drivers/net/usb/hso.o
text data bss dec hex filename
32200 592 9960 42752 a700 drivers/net/usb/hso.o
After:
$ size drivers/net/usb/hso.o
text data bss dec hex filename
32196 592 9960 42748 a6fc drivers/net/usb/hso.o

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
5591c75dc345d93d353d2ab2962824648a73efe4 21-Dec-2010 Joe Perches <joe@perches.com> usb: Use static const, consolidate code

Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.

Consolidate duplicated code into new fix_crc_bug function
and declare data in that function static const.

Signed-off-by: Joe Perches <joe@perches.com>
6934d33556b366d22392a415ca09d720fed6a442 07-Dec-2010 Thomas Bogendoerfer <tsbogend@alpha.franken.de> hso: IP checksuming doesn't work on GE0301 option cards

There is definitly a problem, that some option cards send up broken
IP pakets leading to corrupted IP packets. These corruptions aren't
detected, because the driver claims that the packets are already
checksummed. This change removes the CHECKSUM_UNNECESSARY option
and let IP detect broken data.

Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
8e65c0ece6f2aa732f9b755331869c67aeb1c7f6 25-Nov-2010 Filip Aben <f.aben@option.com> hso: fix disable_net

The HSO driver incorrectly creates a serial device instead of a net
device when disable_net is set. It shouldn't create anything for the
network interface.

Signed-off-by: Filip Aben <f.aben@option.com>
Reported-by: Piotr Isajew <pki@ex.com.pl>
Reported-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ce5a121304af02d02489e86efb6ae26a67f95e52 15-Nov-2010 Alan Cox <alan@linux.intel.com> hso: Fix unused variable warning

Fallout from the TIOCGICOUNT work

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0bca1b913affbd7e2fdaffee62a499659a466eb5 16-Sep-2010 Alan Cox <alan@linux.intel.com> tty: Convert the USB drivers to the new icount interface

Simple pasting job using the new ops function. Also fix a couple of devices
directly returning the internal struct (which happens at this point to match
for the fields that matter but isn't correct or futureproof)

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
7011e660938fc44ed86319c18a5954e95a82ab3e 15-Sep-2010 Dan Rosenberg <drosenberg@vsecurity.com> drivers/net/usb/hso.c: prevent reading uninitialized memory

Fixed formatting (tabs and line breaks).

The TIOCGICOUNT device ioctl allows unprivileged users to read
uninitialized stack memory, because the "reserved" member of the
serial_icounter_struct struct declared on the stack in hso_get_count()
is not altered or zeroed before being copied back to the user. This
patch takes care of it.

Signed-off-by: Dan Rosenberg <dan.j.rosenberg@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
01414802054c382072b6cb9a1bdc6e243c74b2d5 17-Aug-2010 Ben Hutchings <bhutchings@solarflare.com> ethtool: Provide a default implementation of ethtool_ops::get_drvinfo

The driver name and bus address for a net_device can normally be found
through the driver model now. Instead of requiring drivers to provide
this information redundantly through the ethtool_ops::get_drvinfo
operation, use the driver model to do so if the driver does not define
the operation. Since ETHTOOL_GDRVINFO no longer requires the driver
to implement any operations, do not require net_device::ethtool_ops to
be set either.

Remove implementations of get_drvinfo and ethtool_ops that provide
only this information.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5c7bf2f4d6304ab4741f38365ca0c0223147263d 03-Aug-2010 Filip Aben <f.aben@option.com> hso: Add new product ID

This patch adds a new product ID to the hso driver.

Signed-off-by: Filip Aben <f.aben@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
242647bcf8464860f173f3d4d4ab3490d3558518 13-Jul-2010 Filip Aben <f.aben@option.com> hso: remove driver version

This patch removes the driver version from the driver. This version
hasn't changed since the driver's inclusion in the kernel and is a
source of confusion for some customers.

Signed-off-by: Filip Aben <f.aben@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
d5dc0ae4df9db00b8122378d56a071039b17a1eb 22-Jun-2010 Filip Aben <f.aben@option.com> hso: remove setting of low_latency flag

This patch removes the setting of the low_latency flag.
tty_flip_buffer_push() is occasionally being called in irq context, which
causes a hang if the low_latency flag is set.
Removing the low_latency flag only seems to impact the flush to ldisc,
which will now be put on a workqueue.

Signed-off-by: Filip Aben <f.aben@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ba2d3587912f82d1ab4367975b1df460db60fb1e 02-Jun-2010 Eric Dumazet <eric.dumazet@gmail.com> drivers/net: use __packed annotation

cleanup patch.

Use new __packed annotation in drivers/net/

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
dd7496f217462a23a9a8a15b9925866eaad76e22 26-May-2010 Filip Aben <f.aben@option.com> hso: add support for new products

This patch adds a few new product id's for the hso driver.

Signed-off-by: Filip Aben <f.aben@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
a4b770972b8f819e408d7cc3ae9637e15bff62f6 14-May-2010 Joe Perches <joe@perches.com> drivers/net: Remove unnecessary returns from void function()s

This patch removes from drivers/net/ all the unnecessary
return; statements that precede the last closing brace of
void functions.

It does not remove the returns that are immediately
preceded by a label as gcc doesn't like that.

It also does not remove null void functions with return.

Done via:
$ grep -rP --include=*.[ch] -l "return;\n}" net/ | \
xargs perl -i -e 'local $/ ; while (<>) { s/\n[ \t\n]+return;\n}/\n}/g; print; }'

with some cleanups by hand.

Compile tested x86 allmodconfig only.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
1ae5dc342ac78d7a42965fd1f323815f6f5ef2c1 10-May-2010 Eric Dumazet <eric.dumazet@gmail.com> net: trans_start cleanups

Now that core network takes care of trans_start updates, dont do it
in drivers themselves, if possible. Drivers can avoid one cache miss
(on dev->trans_start) in their start_xmit() handler.

Exceptions are NETIF_F_LLTX drivers

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4d823be98c5b24d94c7f41a384a4bb60d7848ad5 11-Mar-2010 Christoph Egger <siccegge@stud.informatik.uni-erlangen.de> obsolete config in kernel source: HSO_AUTOPM

CONFIG_HSO_AUTOPM is set by KConfig / set in the Kernel source, makefiles
and won't be ever set this way, therefor simply removing the protected
code.

Signed-off-by: Christoph Egger <siccegge@stud.informatik.uni-erlangen.de>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8a5c9c4932ad1fbe9daa501e89a7357a2804e3fa 05-Jan-2010 Jan Dumon <j.dumon@option.com> hso: fixed missing newlines

Fixed missing newlines in calls to dev_warn & dev_err.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0e0367e980b55629917f3dd5f5f0ccbf3d0dab62 05-Jan-2010 Jan Dumon <j.dumon@option.com> hso: Fix for 5 sec timeouts with v2.x firmware

Don't send flow control settings to any port other than the modem port.
Older firmware ignored this request but did sent a reply. Newer firmware just
ignores it without reply and causes a 5 second timeout every time a port
(except for the modem port) is opened or if tiocm settings are changed.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
68a351c501ad22077a969df157cd13367cb43a40 05-Jan-2010 Jan Dumon <j.dumon@option.com> hso: Attempt to recover from usb bus errors

Attempt to reset the usb device when we receive usb bus errors.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
f4763e96c08ea0790750603999e5b3158c3b50d4 05-Jan-2010 Jan Dumon <j.dumon@option.com> hso: don't change the state of a closed port

Don't change the state of a port if it's not open. This fixes an issue where a
port sometimes has to be opened twice before data can be received.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
d9ced80d1084758772d350ac66b1ad0eeefc7f95 05-Jan-2010 Jan Dumon <j.dumon@option.com> hso: Fix for endian issues on big endian machines

Some fields are always little endian and have to be converted on big endian
machines.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
ec157937d9799cf30c9a19bd18be33721242c64f 05-Jan-2010 Jan Dumon <j.dumon@option.com> hso: Add Vendor/Product ID's for new devices

Add product ID's for new devices.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8e95a2026f3b43f7c3d676adaccd2de9532e8dcc 03-Dec-2009 Joe Perches <joe@perches.com> drivers/net: Move && and || to end of previous line

Only files where David Miller is the primary git-signer.
wireless, wimax, ixgbe, etc are not modified.

Compile tested x86 allyesconfig only
Not all files compiled (not x86 compatible)

Added a few > 80 column lines, which I ignored.
Existing checkpatch complaints ignored.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
dcfcb256cc23c4436691b0fe677275306699d6a1 23-Nov-2009 Antti Kaijanmäki <antti.kaijanmaki@nomovok.com> hso: fix soft-lockup

Fix soft-lockup in hso.c which is triggered on SMP machine when
modem is removed while file descriptor(s) under /dev are still open:

old version called kref_put() too early which resulted in destroying
hso_serial and hso_device objects which were still used later on.

Signed-off-by: Antti Kaijanmäki <antti.kaijanmaki@nomovok.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
9ce673d5e919966efc1ef5adf20248e6ecc62724 23-Nov-2009 Antti Kaijanmäki <antti.kaijanmaki@nomovok.com> hso: fix debug routines

Signed-off-by: Antti Kaijanmäki <antti.kaijanmaki@nomovok.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
384912ed194e43c03ad1cdaa09b0b1e488c34d46 31-Aug-2009 Marcel Holtmann <marcel@holtmann.org> net: Add DEVTYPE support for Ethernet based devices

The Ethernet framing is used for a lot of devices these days. Most
prominent are WiFi and WiMAX based devices. However for userspace
application it is important to classify these devices correctly and
not only see them as Ethernet devices. The daemons like HAL, DeviceKit
or even NetworkManager with udev support tries to do the classification
in userspace with a lot trickery and extra system calls. This is not
good and actually reaches its limitations. Especially since the kernel
does know the type of the Ethernet device it is pretty stupid.

To solve this problem the underlying device type needs to be set and
then the value will be exported as DEVTYPE via uevents and available
within udev.

# cat /sys/class/net/wlan0/uevent
DEVTYPE=wlan
INTERFACE=wlan0
IFINDEX=5

This is similar to subsystems like USB and SCSI that distinguish
between hosts, devices, disks, partitions etc.

The new SET_NETDEV_DEVTYPE() is a convenience helper to set the actual
device type. All device types are free form, but for convenience the
same strings as used with RFKILL are choosen.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
0fc0b732eaa38beb93a6fb62f77c7bd9622c76ec 02-Sep-2009 Stephen Hemminger <shemminger@vyatta.com> netdev: drivers should make ethtool_ops const

No need to put ethtool_ops in data, they should be const.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
25a79c41ce0ce88a4288adf278e9b0e00f228383 31-Aug-2009 Stephen Hemminger <shemminger@vyatta.com> usbnet: convert to netdev_tx_t

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
6ed106549d17474ca17a16057f4c0ed4eba5a7ca 23-Jun-2009 Patrick McHardy <kaber@trash.net> net: use NETDEV_TX_OK instead of 0 in ndo_start_xmit() functions

This patch is the result of an automatic spatch transformation to convert
all ndo_start_xmit() return values of 0 to NETDEV_TX_OK.

Some occurences are missed by the automatic conversion, those will be
handled in a seperate patch.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
5b2c4b972c0226406361f83b747eb5cdab51e68e 12-Jun-2009 Patrick McHardy <kaber@trash.net> net: fix network drivers ndo_start_xmit() return values (part 8)

Fix up USB drivers that return an errno value (result of usb_submit_urb())
to qdisc_restart(), causing qdisc_restart() to print a warning and requeue/
retransmit the skb.

- hso: skb is freed: use after free
- at76_usb: skb is freed: use after free

Compile tested only.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
d65a68a8da5c9d1041ebc5e018e677d641910668 04-Jun-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt> hso: convert dev_alloc_skb() to netdev_alloc_skb()

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: David S. Miller <davem@davemloft.net>
19d337dff95cbf76edd3ad95c0cee2732c3e1ec5 02-Jun-2009 Johannes Berg <johannes@sipsolutions.net> rfkill: rewrite

This patch completely rewrites the rfkill core to address
the following deficiencies:

* all rfkill drivers need to implement polling where necessary
rather than having one central implementation

* updating the rfkill state cannot be done from arbitrary
contexts, forcing drivers to use schedule_work and requiring
lots of code

* rfkill drivers need to keep track of soft/hard blocked
internally -- the core should do this

* the rfkill API has many unexpected quirks, for example being
asymmetric wrt. alloc/free and register/unregister

* rfkill can call back into a driver from within a function the
driver called -- this is prone to deadlocks and generally
should be avoided

* rfkill-input pointlessly is a separate module

* drivers need to #ifdef rfkill functions (unless they want to
depend on or select RFKILL) -- rfkill should provide inlines
that do nothing if it isn't compiled in

* the rfkill structure is not opaque -- drivers need to initialise
it correctly (lots of sanity checking code required) -- instead
force drivers to pass the right variables to rfkill_alloc()

* the documentation is hard to read because it always assumes the
reader is completely clueless and contains way TOO MANY CAPS

* the rfkill code needlessly uses a lot of locks and atomic
operations in locked sections

* fix LED trigger to actually change the LED when the radio state
changes -- this wasn't done before

Tested-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> [thinkpad]
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
1aec5bdfed91b50aedbcad43393bcb05033c7ef3 30-Apr-2009 Greg Kroah-Hartman <gregkh@suse.de> net: remove driver_data direct access of struct device

In the near future, the driver core is going to not allow direct access
to the driver_data pointer in struct device. Instead, the functions
dev_get_drvdata() and dev_set_drvdata() should be used. These functions
have been around since the beginning, so are backwards compatible with
all older kernel versions.

Cc: netdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
c1c6b14b22af0f85d05a70405dc3fba5de840c7b 30-Mar-2009 Johannes Berg <johannes@sipsolutions.net> rfkill: remove deprecated state constants

I only did superficial review, but these constants are stupid
to have and without proper warnings nobody will review the
code anyway, no amount of shouting will help.

Also fix wimax to use correct states.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
0de8ca597d7b449e9e7ce7af138944acf06c8f05 02-Apr-2009 Jan Dumon <j.dumon@option.com> hso: fix for the 'invalid frame length' messages

Some devices cannot send very short usb transfers. To get around this the
firmware adds a known pattern and flags the driver that it should check for
this pattern on short transfers. This flag was not taken into account by
the driver.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3b7d2b319db0ba1f6208ca58b297fb419301f85a 02-Apr-2009 Jan Dumon <j.dumon@option.com> hso: fix for crash when unplugging the device

Changed the order in which things are freed. This fixes an oops when
unplugging the device while network traffic is ongoing.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9961d84270ce1d5f4c662382acf0b418a3ff6a0f 02-Apr-2009 Jan Dumon <j.dumon@option.com> hso: add Vendor/Product ID's for new devices

Add Vendor/Product ID's for new devices.
Removed duplicate product ID 0x7361.

Signed-off-by: Jan Dumon <j.dumon@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
c266cb4ef2ef1f1e3f46d81022939feebe8fa54d 20-Mar-2009 Stephen Hemminger <shemminger@vyatta.com> usbnet: convert hso driver to net_device_ops

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
e44578ea7c4f87462e05e0d0a2dd43b6beecd5f6 23-Feb-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt> hso: remove hso_free_device()

There is really no need for function just doing simple kfree()

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Cc: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
a6f26e4b0e1d63f466df7ae0fa35398316cf2dfc 23-Feb-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt> hso: remove claiming and releasing of USB interface

No need to reclaim the same USB interface beeing probed.
Releasing interface does nothing also.

This is already in for a long time in off-kernel hso driver
and no regresions were noticed for this change.

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Cc: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
0227abc9d011892fd13f360b56a7b276ebea8b07 14-Feb-2009 Hannes Eder <hannes@hanneseder.net> drivers/net/usb: fix sparse warnings: Should it be static?

Impact: Make symbols static.

Fix this sparse warnings:
drivers/net/usb/hso.c:1249:6: warning: symbol 'hso_unthrottle_tasklet' was not declared. Should it be static?
drivers/net/usb/hso.c:1268:6: warning: symbol 'hso_unthrottle_workfunc' was not declared. Should it be static?
drivers/net/usb/hso.c:1466:5: warning: symbol 'tiocmget_submit_urb' was not declared. Should it be static?
drivers/net/usb/smsc95xx.c:62:5: warning: symbol 'turbo_mode' was not declared. Should it be static?

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
67dd82462d553c35bef14de1bf8afcb1095e041d 04-Feb-2009 Filip Aben <f.aben@option.com> hso: add new device id's

This patch adds a few device ID's. It also removes an ID that was used
in an internal engineering version of a device and will never see
commercial light. Even if this ID will be 'recycled' in the future,
which is very unlikely, we don't know what kind of device will be
behind it. Therefore it's safer to remove it.

Signed-off-by: Filip Aben <f.aben@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
09640e6365c679b5642b1c41b6d7078f51689ddf 01-Feb-2009 Harvey Harrison <harvey.harrison@gmail.com> net: replace uses of __constant_{endian}

Base versions handle constant folding now.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5839b414f9f9d2d6a471988763b61dbf85eb2dba 15-Jan-2009 Denis Joseph Barrow <D.Barow@option.com> hso serial throttled tty kref fix.

This patch is for Alan Cox as it related to the tty layer.
Hopefully the hso driver is again relatively stable with this fix.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d45eb81c3e345fabaf27ef3ab437b85c0bf9fafa 15-Jan-2009 Denis Joseph Barrow <D.Barrow@option.com> tty: Fix double grabbing of a spinlock

The HSO changes for kref introduced a recursive spinlock take. All
functions which call put_rxbuf_data already have serial->serial_lock
grabbed.

[Comment to code added-AC]

Signed-off-by: Denis Joseph Barrow <D.Barrow@option.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fe41cbb164a0dc55f3914a0e4cabe8240410157c 15-Jan-2009 Alan Cox <alan@redhat.com> tty: Fix a kref leak in the HSO driver on re-open

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b74f62c1e736ea01c660355526dd54132d241ca9 13-Jan-2009 Denis Joseph Barrow <D.Barow@option.com> hso: driver fix for big endian machines.

Filip Aben says this fix is neccessary for big endian machines.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
11cd29b028be88b13717401496fe4953fb96be03 02-Jan-2009 Denis Joseph Barrow <D.Barow@option.com> hso maintainers update patch

Added D.J. Barrow as maintainer of hso driver.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
58eb17f155704062d76729d1fb7e23d3559ca86a 02-Jan-2009 Denis Joseph Barrow <D.Barow@option.com> hso modem detect fix patch against Alan Cox'es tty tree

Fixed incorrect check for the modem port, this prevents
crashes caused by issueing a tiocmget_submit_urb
on endpoints which don't exist for non modem devices.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
542f54823614915780c3459b0e6062f06c0c0f99 02-Jan-2009 Denis Joseph Barrow <D.Barow@option.com> tty: Modem functions for the HSO driver

Makes TIOCM ioctls for Data Carrier Detect & related functions
work like /drivers/serial/serial-core.c potentially needed
for pppd & similar user programs.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ac9720c37e8795317e8be3adad63cb0d5522a640 02-Jan-2009 Alan Cox <alan@redhat.com> tty: Fix the HSO termios handling a bit

Init the tty structure once
Don't set ->low_latency twice in a row
Don't force bits we should be leaving to the user
Don't allocate termios arrays as these are in fact allocated by the tty layer
for you and just overwrite the ones allocated in the driver

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
e136e3036bf27569dbfeae245cc09c7167cdc749 02-Jan-2009 Alan Cox <alan@redhat.com> hso: net driver using tty without locking

Checking tty == NULL doesn't help us unless we have a clear semantic for
the locking of the tty object in the driver. Use the tty kref objects so that
we can take references to the tty in the USB event handling paths.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f201a8a4511a4c9953189924df3c880207194b41 29-Dec-2008 Julia Lawall <julia@diku.dk> drivers/net/usb: use USB API functions rather than constants

This set of patches introduces calls to the following set of functions:

usb_endpoint_dir_in(epd)
usb_endpoint_dir_out(epd)
usb_endpoint_is_bulk_in(epd)
usb_endpoint_is_bulk_out(epd)
usb_endpoint_is_int_in(epd)
usb_endpoint_is_int_out(epd)
usb_endpoint_num(epd)
usb_endpoint_type(epd)
usb_endpoint_xfer_bulk(epd)
usb_endpoint_xfer_control(epd)
usb_endpoint_xfer_int(epd)
usb_endpoint_xfer_isoc(epd)

In some cases, introducing one of these functions is not possible, and it
just replaces an explicit integer value by one of the following constants:

USB_ENDPOINT_XFER_BULK
USB_ENDPOINT_XFER_CONTROL
USB_ENDPOINT_XFER_INT
USB_ENDPOINT_XFER_ISOC

In drivers/net/wireless/zd1211rw/zd_usb.c the code:

(endpoint->bEndpointAddress & USB_TYPE_MASK) == USB_DIR_OUT

is suspicious. If it is intended to use USB_ENDPOINT_DIR_MASK rather than
USB_TYPE_MASK, then the whole conditional test could be converted to a call
to usb_endpoint_is_bulk_in.

An extract of the semantic patch that makes these changes is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r1@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bmAttributes & \(USB_ENDPOINT_XFERTYPE_MASK\|3\)) ==
- \(USB_ENDPOINT_XFER_CONTROL\|0\))
+ usb_endpoint_xfer_control(epd)

@r5@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bEndpointAddress & \(USB_ENDPOINT_DIR_MASK\|0x80\)) ==
- \(USB_DIR_IN\|0x80\))
+ usb_endpoint_dir_in(epd)

@inc@
@@

#include <linux/usb.h>

@depends on !inc && (r1||r5)@
@@

+ #include <linux/usb.h>
#include <linux/usb/...>
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
889bd9b6dbcd426b8698c4a779dd7dbf247f57b8 18-Dec-2008 Oliver Neukum <oliver@neukum.org> net: startup race in hso driver

The flag marking a device running must be set before the URBs for
recption are submitted or they may complete too early and fail to resubmit.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2f9889a20cd2854bc6305198255c617b0b4eb719 25-Nov-2008 David S. Miller <davem@davemloft.net> Revert "hso: Fix crashes on close."

This reverts commit 4a3e818181e1baf970e9232ca8b747e233176b87.

On request from Alan Cox.

Signed-off-by: David S. Miller <davem@davemloft.net>
ab153d84d9609b4e6f53632a6f14b882e866cb47 25-Nov-2008 David S. Miller <davem@davemloft.net> Revert "hso: Fix free of mutexes still in use."

This reverts commit 52429eb216385fdc6969c0112ba8b46cffefaaef.

On request from Alan Cox.

Signed-off-by: David S. Miller <davem@davemloft.net>
cd90ee1799136bd74158b734cf71b72609244a91 25-Nov-2008 David S. Miller <davem@davemloft.net> Revert "hso: Add TIOCM ioctl handling."

This reverts commit 7ea3a9ad9bf360f746a7ad6fa72511a5c359490d.

On request from Alan Cox.

Signed-off-by: David S. Miller <davem@davemloft.net>
9c8f92aed16dbd1924910f3305f5992a4f29fe2a 25-Nov-2008 Denis Joseph Barrow <D.Barow@option.com> hso: Hook up ->reset_resume

Made usb_drivers reset_resume function point to hso_resume this
fixes problems a usb reset is done when the network interface
is left idle for a few minutes. Possibly reset_resume should
initialise hardware more but this works in the common case.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
7ea3a9ad9bf360f746a7ad6fa72511a5c359490d 25-Nov-2008 Denis Joseph Barrow <D.Barow@option.com> hso: Add TIOCM ioctl handling.

Makes TIOCM ioctls for Data Carrier Detect & related functions
work like /drivers/serial/serial-core.c potentially needed
for pppd & similar user programs.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
52429eb216385fdc6969c0112ba8b46cffefaaef 25-Nov-2008 Denis Joseph Barrow <D.Barow@option.com> hso: Fix free of mutexes still in use.

A new structure hso_mutex_table had to be declared statically
& used as as hso_device mutex_lock(&serial->parent->mutex) etc
is freed in hso_serial_open & hso_serial_close by kref_put while
the mutex is still in use.

This is a substantial change but should make the driver much stabler.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
89930b7b5e3e9bfe9c6ec5e19920451c8f5d9088 25-Nov-2008 Denis Joseph Barrow <D.Barow@option.com> hso: Fix URB submission -EINVAL.

Added check for IFF_UP in hso_resume, this should eliminate -EINVAL (-22)
errors caused from urb's being submitted twice, once by hso_resume
& once in hso_net_open, if suspend/resume USB power saving mode is enabled

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4a3e818181e1baf970e9232ca8b747e233176b87 25-Nov-2008 Denis Joseph Barrow <D.Barow@option.com> hso: Fix crashes on close.

Moved serial_open_count in hso_serial_open to
prevent crashes owing to the serial structure being made NULL
when hso_serial_close is called even though hso_serial_open
returned -ENODEV, Alan Cox pointed out this happens,
also put in sanity check in hso_serial_close
to check for a valid serial structure which should prevent
the most reproducable crash in the driver when the hso device
is disconnected while in use.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
bab04c3adbb55aeb5e8db60522f14ce0bb0d4179 25-Nov-2008 Denis Joseph Barrow <D.Barow@option.com> hso: Add new usb device id's.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
939a9516416ad8ccec27aa05bd19236c550c0c03 04-Nov-2008 Jonathan McDowell <noodles@earth.li> [netdrvr] usb/hso: Cleanup rfkill error handling

Yup, this appears to be the problem, thanks. I think &hso_net->net->dev
is more intuitive for the error message, so I've used that. I've also
added missing line endings on the error messages and set our local
rfkill structure element to NULL on failure so we don't try to call
rfkill_unregister on driver removal if we failed to register at all.

The patch below Works For Me (TM); the device is detected fine, can be
removed without problems and connects ok. I'll have a prod at why the
rfkill stuff isn't working next, but I believe this cleanup of the error
handling is appropriate no matter what the issue with registration is.

Signed-Off-By: Jonathan McDowell <noodles@earth.li>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
db053c6b447d083f3c63e5540b70a3e521b468ca 04-Nov-2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt> hso: rfkill type should be WWAN

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Cc: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
8ef5ba63b94b04b182ac4a6009dbbf1406beb3c5 05-Sep-2008 Denis Joseph Barrow <D.Barow@option.com> [netdrvr] usb/hso: throttle to prevent loss of serial data

Patch to stop loss of characters on the hso modems,
this patch throttles & unthrottles the modem by
not putting out urbs until the tty/line discipline layer
has enough space for newly received packets.
serial ports. This is required for firmware diagnostics
being done at Option.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
e57b641dfafc10ce23d26cf271fd2638589fdb3f 28-Aug-2008 Adrian Bunk <bunk@kernel.org> [netdrvr/usb] hso_create_bulk_serial_device(): fix a double free

hso_serial_common_free() mustn't be called if
hso_serial_common_create() fails.

Reported-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
c213f286f2cf6590f83f541f66a625ee8d20c6f4 20-Aug-2008 Denis Joseph Barrow <D.Barow@option.com> [netdrvr] hso: dev_kfree_skb crash fix

Fixes dev_kfree_skb happening too many times when hso_start_net_device
is called from hso_resume.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
95eacee870a521d2647f42c4f670cd65a145a6bd 20-Aug-2008 Denis Joseph Barrow <D.Barow@option.com> [netdrvr] hso: icon 322 detection fix

Fixes Icon-322 detection.

Signed-off-by: Denis Joseph Barrow <D.Barow@option.com>
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
0235f64175db41fa17a6ce5c9b58fd3550986eb4 08-Aug-2008 Greg Kroah-Hartman <gregkh@suse.de> USB: HSO: minor fixes due to code review

Fix up problems in hso.c driver as pointed out by Andrew.

Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
6c59f56978c3dffd447176d218bc5852842c9ce9 08-Aug-2008 Greg Kroah-Hartman <gregkh@suse.de> USB: HSO: make tty_operations const

As recommended by Arjan.

Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Andrew Bird <ajb@spheresystems.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
6d558a52ba295fc1c281c671d7daab2f74ddb4f2 08-Aug-2008 Olivier Blin <blino@mandriva.com> hso: fix refcounting on the ttyHSx devices

The references on ttyHSx devices were not decremented correctly when
the tty was closed. The helper freeing the serial devices was never
called because of that, and the module left some dangling sysfs
devices after being unloaded.

Signed-off-by: Olivier Blin <blino@mandriva.com>
Cc: Jari Tenhunen <jari.tenhunen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
add477df674db00377d9a4dc0d9b553ce79bc06d 08-Aug-2008 Olivier Blin <blino@mandriva.com> hso: fix oops in read/write callbacks

The tty may be closed already when the read/write callbacks are called.
This patch checks that the ttys still exist before waking them up.

Signed-off-by: Olivier Blin <blino@mandriva.com>
Acked-by: Alan Cox <alan@redhat.com>
Cc: Jari Tenhunen <jari.tenhunen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
72dc1c096c7051a48ab1dbb12f71976656b55eb5 14-May-2008 Greg Kroah-Hartman <gregkh@suse.de> HSO: add option hso driver

This driver is for a number of different Option devices. Originally
written by Option and Andrew Bird, but cleaned up massivly for
acceptance into mainline by me and others.

Many thanks to the following for their help in cleaning up the driver by
providing feedback and patches to it:
- Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
- Oliver Neukum <oliver@neukum.org>
- Alan Cox <alan@lxorguk.ukuu.org.uk>
- Javier Marcet <javier@krausbeck.org>

Cc: Andrew Bird <ajb@spheresystems.co.uk>
Cc: Javier Marcet <javier@krausbeck.org>
Cc: Filip Aben <f.aben@option.com>
Cc: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Cc: Oliver Neukum <oliver@neukum.org>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>