History log of /drivers/usb/class/usbtmc.c
Revision Date Author Comments
ab53eb97369a4fb19c3ba7b827b949c1015bc948 01-Jun-2014 Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> usb: class: usbtmc.c: Cleaning up uninitialized variables

There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
d846b7650db3fcca7901b6e23f6416c3601a3dfe 19-May-2014 Oliver Neukum <oneukum@suse.de> USB: usbtmc: fix DMA on stack

send_request_dev_dep_msg_in() use a buffer allocated on the stack.
Fix by kmalloc()ing the buffer.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
803a536243b3a1ed2289f41897b11b72bd083309 08-Jan-2014 Paul Gortmaker <paul.gortmaker@windriver.com> usb: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>. Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2a6eb8ac9bdee5b09077ae2d6efc4babffd9d93e 24-Aug-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> USB: usbtmc: fix up attribute permissions

In auditing the usbtmc sysfs files, a bunch of them were being created
as "read only", yet they have logic to handle writing to. So fix them
up by setting the permissions properly.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
c786138fcc28d42754695ecdcbaba3d1c057f153 11-Aug-2013 Johan Hovold <jhovold@gmail.com> USB: usbtmc: fix big-endian probe of Rigol devices

Fix probe of Rigol devices on big-endian machines. A quirk for these
devices was introduced by commit c2e314835 ("USB: usbtmc: Set
rigol_quirk if device is listed") but was only enabled on little-endian
machines.

Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
e6c7efdcb76f11b04e3d3f71c8d764ab75c9423b 15-Jul-2013 Andy Shevchenko <andriy.shevchenko@linux.intel.com> usbtmc: convert to devm_kzalloc

kfree(data) will be called implicitly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
bbf4976e7715da4a3e3599a500eb20d6be8b5046 15-Jul-2013 Andy Shevchenko <andriy.shevchenko@linux.intel.com> usbtmc: remove redundant braces

There is a few cases where braces are not needed. This patch removes
unnecessary '& 255' pieces as well when lvalue type is u8.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f4d844cb6c073998db0c7fe3d76c6c070333054e 15-Jul-2013 Andy Shevchenko <andriy.shevchenko@linux.intel.com> usbtmc: call pr_err instead of plain printk

Additionally remove useless label.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
92f78ddb10eab664c8934f0f3a9f284167ac45f9 15-Jul-2013 Andy Shevchenko <andriy.shevchenko@linux.intel.com> usbtmc: remove trailing spaces

Recent patch series introduces few trailing spaces. This patch removes them.
No functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
50c9ba311402f611b54b1da5c6d49873e907daee 30-Apr-2013 Alexandre Peixoto Ferreira <alexandref75@gmail.com> USB: usbtmc: Change magic number to constant

These patches implement a modification of the USBTMC
protocol to allow operation with Rigol equipment. Cosmetic change to show
that 12 is the USBTMC header size.

Signed-off-by: Alexandre Peixoto Ferreira <alexandref75@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
d2ddce37a7f5992e256ba0d893f3ad5e2af96b21 30-Apr-2013 Alexandre Peixoto Ferreira <alexandref75@gmail.com> USB: usbtmc: usbtmc_read sends multiple TMC header based on rigol_quirk

These patches implement a modification of the USBTMC
protocol to allow operation with Rigol equipment. The usbtmc_read function is
modified so if the quirk is active, the TMC header is sent with the size of
the data as the whole size of the request. If the quirk is inactive, the TMC
request is sent once per bulk transfer and with size limited to the bulk
transfer size. In the case of the quirk, only the first response contains the
TMC header and the others are just data.

Signed-off-by: Alexandre Peixoto Ferreira <alexandref75@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
c2e314835af0e09652ef4571eb5e481757ebb90f 30-Apr-2013 Alexandre Peixoto Ferreira <alexandref75@gmail.com> USB: usbtmc: Set rigol_quirk if device is listed

These patches implement a modification of the USBTMC
protocol to allow operation with Rigol equipment. It an idVendor and
idProduct is found on the usbtmc_id_quirk array, the rigol_quirk is set for
this device.

Signed-off-by: Alexandre Peixoto Ferreira <alexandref75@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
88d9b2b38c99d7d7f5eb557a56b6aaeaa392df86 30-Apr-2013 Alexandre Peixoto Ferreira <alexandref75@gmail.com> USB: usbtmc: TMC request code segregated from usbtmc_read

These patches implement a modification of the USBTMC
protocol to allow operation with Rigol equipment. The TMC request portion of
the code in function usbtmc_read is segregated to a function
send_request_dev_dep_msg_in as implemented by tommie in
https://github.com/tommie/linux/blob/usbtmc-rigol/drivers/usb/class/usbtmc.c
allowing the reuse later.

Signed-off-by: Alexandre Peixoto Ferreira <alexandref75@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8402db5dda3ac167014c143a633efff340aaff5b 30-Apr-2013 Alexandre Peixoto Ferreira <alexandref75@gmail.com> USB: usbtmc: Add flag rigol_quirk to usbtmc_device_data

These patches implement a modification of the USBTMC
protocol to allow operation with Rigol equipment. Rigol requires that a
single TMC request to receive any buffer size and bulk requests to get the
data. The original algorithm sends a TMC request for each subset of the data
(a single USB transaction). The modification is only active for Rigol
equipment, vendor and product set is contained in the array usbtmc_id_quirk.

This patch creates the rigol_quirk variable and the arrays for the
idvendor and idproduct.

Signed-off-by: Alexandre Peixoto Ferreira <alexandref75@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ac9e59cad7b0b699b2aa9a104eb22ed67a560e02 17-Apr-2013 Ming Lei <ming.lei@canonical.com> USB: usbtmc: remove unnecessary memory allocation

Inside usbtmc_ioctl_clear_out_halt()/usbtmc_ioctl_clear_in_halt(),
usb_clear_halt() needn't any buffer to pass in, so remove the
unnecessary memory allocation.

Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
65db43054065790a75291b0834657445fea2cf56 18-Nov-2011 Greg Kroah-Hartman <gregkh@suse.de> USB: convert drivers/usb/* to use module_usb_driver()

This converts the drivers in drivers/usb/* to use the
module_usb_driver() macro which makes the code smaller and a bit
simpler.

Added bonus is that it removes some unneeded kernel log messages about
drivers loading and/or unloading.

Cc: Simon Arlott <cxacru@fire.lp0.eu>
Cc: Duncan Sands <duncan.sands@free.fr>
Cc: Matthieu CASTET <castet.matthieu@free.fr>
Cc: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Oliver Neukum <oliver@neukum.name>
Cc: Juergen Stuber <starblue@users.sourceforge.net>
Cc: Cesar Miquel <miquel@df.uba.ar>
Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Cc: Michael Hund <mhund@ld-didactic.de>
Cc: Zack Parsons <k3bacon@gmail.com>
Cc: Melchior FRANZ <mfranz@aon.at>
Cc: Tomoki Sekiyama <tomoki.sekiyama@gmail.com>
Cc: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
29cc88979a8818cd8c5019426e945aed118b400e 23-Aug-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> USB: use usb_endpoint_maxp() instead of le16_to_cpu()

Now ${LINUX}/drivers/usb/* can use usb_endpoint_maxp(desc) to get maximum packet size
instead of le16_to_cpu(desc->wMaxPacketSize).
This patch fix it up

Cc: Armin Fuerst <fuerst@in.tum.de>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Johannes Erdfelt <johannes@erdfelt.com>
Cc: Vojtech Pavlik <vojtech@suse.cz>
Cc: Oliver Neukum <oliver@neukum.name>
Cc: David Kubicek <dave@awk.cz>
Cc: Johan Hovold <jhovold@gmail.com>
Cc: Brad Hards <bhards@bigpond.net.au>
Acked-by: Felipe Balbi <balbi@ti.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Dahlmann <dahlmann.thomas@arcor.de>
Cc: David Brownell <david-b@pacbell.net>
Cc: David Lopo <dlopo@chipidea.mips.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: Xie Xiaobo <X.Xie@freescale.com>
Cc: Li Yang <leoli@freescale.com>
Cc: Jiang Bo <tanya.jiang@freescale.com>
Cc: Yuan-hsin Chen <yhchen@faraday-tech.com>
Cc: Darius Augulis <augulis.darius@gmail.com>
Cc: Xiaochen Shen <xiaochen.shen@intel.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: OKI SEMICONDUCTOR, <toshiharu-linux@dsn.okisemi.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Ben Dooks <ben@simtec.co.uk>
Cc: Thomas Abraham <thomas.ab@samsung.com>
Cc: Herbert Pötzl <herbert@13thfloor.at>
Cc: Arnaud Patard <arnaud.patard@rtp-net.org>
Cc: Roman Weissgaerber <weissg@vienna.at>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Tony Olech <tony.olech@elandigitalsystems.com>
Cc: Florian Floe Echtler <echtler@fs.tum.de>
Cc: Christian Lucht <lucht@codemercs.com>
Cc: Juergen Stuber <starblue@sourceforge.net>
Cc: Georges Toth <g.toth@e-biz.lu>
Cc: Bill Ryder <bryder@sgi.com>
Cc: Kuba Ober <kuba@mareimbrium.org>
Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
4f1a7a3e78037721496283ea3e87cfefc64d99c7 09-Jul-2011 Maxim Nikulin <m.a.nikulin@gmail.com> USB: assign instead of equal in usbtmc.c

Assign operator instead of equality test in the usbtmc_ioctl_abort_bulk_in() function.

Signed-off-by: Maxim A. Nikulin <M.A.Nikulin@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
6038f373a3dc1f1c26496e60b6c40b164716f07e 15-Aug-2010 Arnd Bergmann <arnd@arndb.de> llseek: automatically add .llseek fop

All file_operations should get a .llseek operation so we can make
nonseekable_open the default for future file operations without a
.llseek pointer.

The three cases that we can automatically detect are no_llseek, seq_lseek
and default_llseek. For cases where we can we can automatically prove that
the file offset is always ignored, we use noop_llseek, which maintains
the current behavior of not returning an error from a seek.

New drivers should normally not use noop_llseek but instead use no_llseek
and call nonseekable_open at open time. Existing drivers can be converted
to do the same when the maintainer knows for certain that no user code
relies on calling seek on the device file.

The generated code is often incorrectly indented and right now contains
comments that clarify for each added line why a specific variant was
chosen. In the version that gets submitted upstream, the comments will
be gone and I will manually fix the indentation, because there does not
seem to be a way to do that using coccinelle.

Some amount of new code is currently sitting in linux-next that should get
the same modifications, which I will do at the end of the merge window.

Many thanks to Julia Lawall for helping me learn to write a semantic
patch that does all this.

===== begin semantic patch =====
// This adds an llseek= method to all file operations,
// as a preparation for making no_llseek the default.
//
// The rules are
// - use no_llseek explicitly if we do nonseekable_open
// - use seq_lseek for sequential files
// - use default_llseek if we know we access f_pos
// - use noop_llseek if we know we don't access f_pos,
// but we still want to allow users to call lseek
//
@ open1 exists @
identifier nested_open;
@@
nested_open(...)
{
<+...
nonseekable_open(...)
...+>
}

@ open exists@
identifier open_f;
identifier i, f;
identifier open1.nested_open;
@@
int open_f(struct inode *i, struct file *f)
{
<+...
(
nonseekable_open(...)
|
nested_open(...)
)
...+>
}

@ read disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}

@ read_no_fpos disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
... when != off
}

@ write @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}

@ write_no_fpos @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
... when != off
}

@ fops0 @
identifier fops;
@@
struct file_operations fops = {
...
};

@ has_llseek depends on fops0 @
identifier fops0.fops;
identifier llseek_f;
@@
struct file_operations fops = {
...
.llseek = llseek_f,
...
};

@ has_read depends on fops0 @
identifier fops0.fops;
identifier read_f;
@@
struct file_operations fops = {
...
.read = read_f,
...
};

@ has_write depends on fops0 @
identifier fops0.fops;
identifier write_f;
@@
struct file_operations fops = {
...
.write = write_f,
...
};

@ has_open depends on fops0 @
identifier fops0.fops;
identifier open_f;
@@
struct file_operations fops = {
...
.open = open_f,
...
};

// use no_llseek if we call nonseekable_open
////////////////////////////////////////////
@ nonseekable1 depends on !has_llseek && has_open @
identifier fops0.fops;
identifier nso ~= "nonseekable_open";
@@
struct file_operations fops = {
... .open = nso, ...
+.llseek = no_llseek, /* nonseekable */
};

@ nonseekable2 depends on !has_llseek @
identifier fops0.fops;
identifier open.open_f;
@@
struct file_operations fops = {
... .open = open_f, ...
+.llseek = no_llseek, /* open uses nonseekable */
};

// use seq_lseek for sequential files
/////////////////////////////////////
@ seq depends on !has_llseek @
identifier fops0.fops;
identifier sr ~= "seq_read";
@@
struct file_operations fops = {
... .read = sr, ...
+.llseek = seq_lseek, /* we have seq_read */
};

// use default_llseek if there is a readdir
///////////////////////////////////////////
@ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier readdir_e;
@@
// any other fop is used that changes pos
struct file_operations fops = {
... .readdir = readdir_e, ...
+.llseek = default_llseek, /* readdir is present */
};

// use default_llseek if at least one of read/write touches f_pos
/////////////////////////////////////////////////////////////////
@ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read.read_f;
@@
// read fops use offset
struct file_operations fops = {
... .read = read_f, ...
+.llseek = default_llseek, /* read accesses f_pos */
};

@ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier write.write_f;
@@
// write fops use offset
struct file_operations fops = {
... .write = write_f, ...
+ .llseek = default_llseek, /* write accesses f_pos */
};

// Use noop_llseek if neither read nor write accesses f_pos
///////////////////////////////////////////////////////////

@ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
identifier write_no_fpos.write_f;
@@
// write fops use offset
struct file_operations fops = {
...
.write = write_f,
.read = read_f,
...
+.llseek = noop_llseek, /* read and write both use no f_pos */
};

@ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier write_no_fpos.write_f;
@@
struct file_operations fops = {
... .write = write_f, ...
+.llseek = noop_llseek, /* write uses no f_pos */
};

@ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
@@
struct file_operations fops = {
... .read = read_f, ...
+.llseek = noop_llseek, /* read uses no f_pos */
};

@ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
@@
struct file_operations fops = {
...
+.llseek = noop_llseek, /* no read or write fn */
};
===== End semantic patch =====

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Julia Lawall <julia@diku.dk>
Cc: Christoph Hellwig <hch@infradead.org>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
0022457a5469d328219dfb1ea5bd89d076e28372 14-Jan-2010 Oliver Neukum <oliver@neukum.org> USB: BKL removal: usbtmc

BKL not needed at all. Removed without replacement.

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
86266452f80545285c14e20a8024f79c4fb88a86 13-Jan-2010 Oliver Neukum <oliver@neukum.org> USB: Push BKL on open down into the drivers

Straightforward push into the drivers to allow
auditing individual drivers separately

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
6ef4852b1326301f6e9657e99b2c3221be1a3a44 10-Jan-2010 Németh Márton <nm127@freemail.hu> USB class: make USB device id constant

The id_table field of the struct usb_device_id is constant in <linux/usb.h>
so it is worth to make the initialization data also constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
struct I1 {
...
const struct I2 *x;
...
};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
struct I1 y = {
.x = E,
};
@c@
identifier r.I2;
identifier s.E;
@@
const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+ const
struct I2 E[] = ...;
// </smpl>

Signed-off-by: Németh Márton <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Cc: cocci@diku.dk
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
3342ecda3ffb059f2ffd765a71d9579f0aa036eb 03-Dec-2009 Sarah Sharp <sarah.a.sharp@linux.intel.com> USB: usbtmc: Use usb_clear_halt() instead of custom code.

Make the USB Test & Measurement driver use usb_clear_halt() instead of
usb_control_msg() to clear a stalled endpoint. This will allow devices to
be tested under an xHCI host controller. The endpoint stall will not be
cleared in the internal xHCI hardware state unless usb_clear_halt() is
used.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Steve Holland <sdh4@iastate.edu>
Cc: Oliver Neukum <oliver@neukum.org>
Cc: Jouni Ryno <Jouni.Ryno@fmi.fi>
Cc: Gergely Imreh <imrehg@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ec412b92dbe3ea839716853eea058d1bcc5e6ca4 19-Nov-2009 Andre Herms <andre.herms@tec-venture.de> USB: usbtmc: repeat usb_bulk_msg until whole message is transfered

usb_bulk_msg() transfers only bytes up to the maximum packet size.
It must be repeated by the usbtmc driver until all bytes of a TMC message
are transfered.

Without this patch, ETIMEDOUT is reported when writing TMC messages
larger than the maximum USB bulk size and the transfer remains incomplete.
The user will notice that the device hangs and must be reset by either closing
the application or pulling the plug.

Signed-off-by: Andre Herms <andre.herms@tec-venture.de>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
dca8cd04dfa4a421511ad0505e4f8a0973f7e38c 24-Sep-2009 Oliver Neukum <oliver@neukum.org> USB: usbtmc: minor formatting cleanups

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
af901ca181d92aac3a7dc265144a9081a86d8f39 14-Nov-2009 André Goddard Rosa <andre.goddard@gmail.com> tree-wide: fix assorted typos all over the place

That is "success", "unknown", "through", "performance", "[re|un]mapping"
, "access", "default", "reasonable", "[con]currently", "temperature"
, "channel", "[un]used", "application", "example","hierarchy", "therefore"
, "[over|under]flow", "contiguous", "threshold", "enough" and others.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
35f76e897d67fb62b4ec0be01fc0caaeb7f90108 15-Sep-2009 Gergely Imreh <imrehg@gmail.com> USB: usbtmc: fix timeout increase

The current 10ms timeout is too short for some normal USBTMC device
operation, increase it to a value which was tested with previously
affected Tektronix oscilloscopes.

Signed-off-by: Gergely Imreh <imrehg@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
828c09509b9695271bcbdc53e9fc9a6a737148d2 02-Oct-2009 Alexey Dobriyan <adobriyan@gmail.com> const: constify remaining file_operations

[akpm@linux-foundation.org: fix KVM]
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d0a38365d9585bf3fb71f7c57fd532441a14f3e8 07-Sep-2009 Gergely Imreh <imrehg@gmail.com> USB: fix USBTMC get_capabilities success handling

In order:
Add reference to relevant section of USBTMC usb488 subclass specs.
Print debug output of capabilities only when it was retrieved successfully.
Clear return value on success, otherwise driver always reports failure.

Signed-off-by: Gergely Imreh <imrehg@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
4143d178e7b39c00d5277040c69a1522c4d98871 19-Jun-2009 Steve Holland <sdh4@iastate.edu> USB: usbtmc: correct termination condition for reads.

Follow T&M convention of obeying EOM flag. Avoid exception cases where
instrument response size matches a buffer size.

Signed-off-by: Steve Holland <sdh4@iastate.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
92d07e422df3cc5370d0d9b95a671abb69d50ef1 19-Jun-2009 Steve Holland <sdh4@iastate.edu> USB: usbtmc: inhibit corruption

Limit data copied to userspace to amount requested. Prevents a faulty
instrument from overwriting user memory.

Signed-off-by: Steve Holland <sdh4@iastate.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
c2cd26e15b84b964c489f2aff278cdaf03840c93 19-Jun-2009 Steve Holland <sdh4@iastate.edu> USB: usbtmc: Fix short reads in usbtmc_read()

The header size should not be included in the number of bytes requested of the
instrument

Signed-off-by: Steve Holland <sdh4@iastate.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
a2fbf10eba3a38407e3984bc9503342de2b5e399 28-Jul-2009 Randy Dunlap <randy.dunlap@oracle.com> USB: usbtmc: fix printk format warnings

Fix printk format warnings:
drivers/usb/class/usbtmc.c:466: warning: format '%zu' expects type 'size_t', but argument 4 has type 'u32'
drivers/usb/class/usbtmc.c:466: warning: format '%zu' expects type 'size_t', but argument 5 has type 'int'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
665d7662d15441b4b3e54131a9418a1a198d0d31 22-Jul-2009 Guus Sliepen <guus@sliepen.org> USB: usbtmc: sanity checks for DEV_DEP_MSG_IN urbs

According to the specifications, an instrument should not return more data in a
DEV_DEP_MSG_IN urb than requested. However, some instruments can send more
than requested. This could cause the kernel to write the extra data past the
end of the buffer provided by read().

Fix this by checking that the value of the TranserSize field is not larger than
the urb itself and not larger than the size of the userspace buffer. Also
correctly decrement the remaining size of the buffer when userspace read()s
more than USBTMC_SIZE_IOBUFFER.

Signed-off-by: Guus Sliepen <guus@sliepen.org>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
a4708103adeaf5731c329b37b0a2b397f814c55c 02-Jul-2009 Oliver Neukum <oliver@neukum.org> USB: suspend/resume support for usbtmc

a class driver should have suspend/resume. This makes sure we
don't see a virtual disconnect unnecessarily.

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
86286883fc8218c81cc1deb04cd1b4a8464bba6f 02-Jul-2009 Oliver Neukum <oliver@neukum.org> USB: usbtmc can do IO to device after disconnect

usbtmc will happily complete read/write requests even after disconnect
has returned. The fix is to introduce a flag.


Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ca157c4a51fa6209f28c316f4a63d594adb79518 02-Jul-2009 Oliver Neukum <oliver@neukum.org> USB: fix memory leak in usbtmc

If an error is returned kfree must also be called.


Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
a92b63e7e4c185b4dd9e87762e2cb716e54482d0 15-Jun-2009 Greg Kroah-Hartman <gregkh@suse.de> USB: usbtmc: fix switch statment

Steve Holland pointed out that we forgot to call break; in the switch
statment. This probably resolves a lot of the bug reports I've gotten
for the driver lately.

Stupid me...

Reported-by: Steve Holland <sdh4@iastate.edu>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
228dd05dbfdd0fced8ab1a28ed73b500ba6bb0a6 11-Mar-2009 Greg Kroah-Hartman <gregkh@suse.de> USB: usbtmc: add protocol 1 support

The driver already supports the 1 protocol support, so just add it to
the MODULE_DEVICE_TABLE entry so it properly picks up these devices.

Thanks to Jouni Rynö for pointing this out.

Reported-by: Jouni Ryno <Jouni.Ryno@fmi.fi>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5b10916ea0a62920204517e1c4ce14560b4f96ab 11-Mar-2009 Greg Kroah-Hartman <gregkh@suse.de> USB: usbtmc: fix stupid bug in open()

open() will never succeed, as we always return -ENODEV. Fix this
obvious bug.

Thanks to Jouni Ryno for reporting it.

Reported-by: Jouni Ryno <Jouni.Ryno@fmi.fi>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
857cc4dfb6420ec0a67b3cda559aaa7c429ddce7 30-Oct-2008 Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> USB: usbtmc: indent & braces disagree, something else is desired

It seems that there's rather involved way to say something
which is commonly written in a plain simple form.

Some type changes would probably be necessary to get gcc
to do bitops instead of divide but it's no worse after my
change than before I think.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5413aa467806578bf5f78a83893cb9426b815231 04-Dec-2008 Greg Kroah-Hartman <gregkh@suse.de> USB: fix problem with usbtmc driver not loading properly

The usbtmc driver forgot to export its device table to userspace.
Without this, it is never loaded properly when such a device is seen by
the system.

Cc: Marcel Janssen <marcel.janssen@admesy.nl>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
b361a6e348a5de9e18eb17542663d34a57740e87 25-Oct-2008 Chris Malley <mail@chrismalley.co.uk> USB: usbtmc: Use explicit unsigned type for input buffer instead of char*

Silences compiler warning about comparison with 0x80, and type now matches the
corresponding _bulk_out function.

drivers/usb/class/usbtmc.c: In function ‘usbtmc_ioctl_abort_bulk_in’:
drivers/usb/class/usbtmc.c:163: warning: comparison is always false due to limited range of data type

Signed-off-by: Chris Malley <mail@chrismalley.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5b775f672cc993ba9dba5626811ab1f2ac42883b 27-Aug-2008 Greg Kroah-Hartman <gregkh@suse.de> USB: add USB test and measurement class driver

This driver was originaly written by Stefan Kopp, but massively
reworked by Greg for submission.

Thanks to Felipe Balbi <me@felipebalbi.com> for lots of work in cleaning
up this driver.

Thanks to Oliver Neukum <oliver@neukum.org> for reviewing previous
versions and pointing out problems.


Cc: Stefan Kopp <stefan_kopp@agilent.com>
Cc: Marcel Janssen <korgull@home.nl>
Cc: Felipe Balbi <me@felipebalbi.com>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>