10 Jan, 2012

1 commit

  • * 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (232 commits)
    USB: Add USB-ID for Multiplex RC serial adapter to cp210x.c
    xhci: Clean up 32-bit build warnings.
    USB: update documentation for usbmon
    usb: usb-storage doesn't support dynamic id currently, the patch disables the feature to fix an oops
    drivers/usb/class/cdc-acm.c: clear dangling pointer
    drivers/usb/dwc3/dwc3-pci.c: introduce missing kfree
    drivers/usb/host/isp1760-if.c: introduce missing kfree
    usb: option: add ZD Incorporated HSPA modem
    usb: ch9: fix up MaxStreams helper
    USB: usb-skeleton.c: cleanup open_count
    USB: usb-skeleton.c: fix open/disconnect race
    xhci: Properly handle COMP_2ND_BW_ERR
    USB: remove dead code from suspend/resume path
    USB: add quirk for another camera
    drivers: usb: wusbcore: Fix dependency for USB_WUSB
    xhci: Better debugging for critical host errors.
    xhci: Be less verbose during URB cancellation.
    xhci: Remove debugging about ring structure allocation.
    xhci: Remove debugging about toggling cycle bits.
    xhci: Remove debugging for individual transfers.
    ...

    Linus Torvalds
     

05 Jan, 2012

2 commits


19 Nov, 2011

1 commit

  • 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
    Cc: Duncan Sands
    Cc: Matthieu CASTET
    Cc: Stanislaw Gruszka
    Cc: Pete Zaitcev
    Cc: Oliver Neukum
    Cc: Juergen Stuber
    Cc: Cesar Miquel
    Cc: Matthew Dharm
    Cc: Matthew Wilcox
    Cc: Sarah Sharp
    Cc: Kuninori Morimoto
    Cc: Felipe Balbi
    Cc: Lucas De Marchi
    Cc: Michael Hund
    Cc: Zack Parsons
    Cc: Melchior FRANZ
    Cc: Tomoki Sekiyama
    Cc: Dan Carpenter
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

24 Aug, 2011

1 commit

  • 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
    Cc: Pavel Machek
    Cc: Johannes Erdfelt
    Cc: Vojtech Pavlik
    Cc: Oliver Neukum
    Cc: David Kubicek
    Cc: Johan Hovold
    Cc: Brad Hards
    Acked-by: Felipe Balbi
    Cc: Sebastian Andrzej Siewior
    Cc: Thomas Dahlmann
    Cc: David Brownell
    Cc: David Lopo
    Cc: Alan Stern
    Cc: Michal Nazarewicz
    Cc: Xie Xiaobo
    Cc: Li Yang
    Cc: Jiang Bo
    Cc: Yuan-hsin Chen
    Cc: Darius Augulis
    Cc: Xiaochen Shen
    Cc: Yoshihiro Shimoda
    Cc: OKI SEMICONDUCTOR,
    Cc: Robert Jarzmik
    Cc: Ben Dooks
    Cc: Thomas Abraham
    Cc: Herbert Pötzl
    Cc: Arnaud Patard
    Cc: Roman Weissgaerber
    Acked-by: Sarah Sharp
    Cc: Tony Olech
    Cc: Florian Floe Echtler
    Cc: Christian Lucht
    Cc: Juergen Stuber
    Cc: Georges Toth
    Cc: Bill Ryder
    Cc: Kuba Ober
    Cc: Inaky Perez-Gonzalez
    Signed-off-by: Kuninori Morimoto
    Signed-off-by: Greg Kroah-Hartman

    Kuninori Morimoto
     

15 Oct, 2010

1 commit

  • 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(...)
    {

    }

    @ open exists@
    identifier open_f;
    identifier i, f;
    identifier open1.nested_open;
    @@
    int open_f(struct inode *i, struct file *f)
    {

    }

    @ 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)
    {

    }

    @ 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)
    {

    }

    @ 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
    Cc: Julia Lawall
    Cc: Christoph Hellwig

    Arnd Bergmann
     

11 Aug, 2010

1 commit


21 May, 2010

1 commit

  • For more clearance what the functions actually do,

    usb_buffer_alloc() is renamed to usb_alloc_coherent()
    usb_buffer_free() is renamed to usb_free_coherent()

    They should only be used in code which really needs DMA coherency.

    All call sites have been changed accordingly, except for staging
    drivers.

    Signed-off-by: Daniel Mack
    Cc: Alan Stern
    Cc: Pedro Ribeiro
    Signed-off-by: Greg Kroah-Hartman

    Daniel Mack
     

03 Mar, 2010

3 commits

  • BKL not needed at all. Removed without replacement.

    Signed-off-by: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     
  • Straightforward push into the drivers to allow
    auditing individual drivers separately

    Signed-off-by: Oliver Neukum
    Acked-by: Mauro Carvalho Chehab
    Cc: Jiri Kosina
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     
  • The id_table field of the struct usb_device_id is constant in
    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/)

    //
    @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[] = ...;
    //

    Signed-off-by: Németh Márton
    Cc: Julia Lawall
    Cc: cocci@diku.dk
    Signed-off-by: Greg Kroah-Hartman

    Németh Márton
     

12 Dec, 2009

1 commit

  • Correct priority problem in the use of ! and &.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@ expression E; constant C; @@
    - !E & C
    + !(E & C)
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Greg Kroah-Hartman

    Julia Lawall
     

23 Sep, 2009

4 commits


25 Mar, 2009

1 commit


25 Apr, 2008

2 commits


13 Oct, 2007

1 commit

  • This weekend I was hacking around with a trivial USB driver for talking
    to the boot load firmware of a USB Bit Whacker. It's running the
    MicroChip Pic18 boot loader firmware and I'm putting together a flash
    program for writing new FW to the thing.

    Anyway in my use of the usb-skeleton.c as my starting point I discovered
    my test program was getting hung up after attempting to write a buffer.
    The application and driver where hung in a way that required me to
    reboot to get it to clean up so I could try again.

    It turned out the code path through skel_open can grap the driver's
    io_mutex lock and forget to release it.

    The following patch fixes the problem for me.

    Signed-off-by: Mark Gross
    Cc: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Mark Gross
     

13 Jul, 2007

5 commits

  • use anchors in pre/post_reset

    Signed-off-by: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     
  • use anchors in suspend/resume handling

    Signed-off-by: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     
  • use anchors in disconnect handling

    Signed-off-by: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     
  • This patch set introduces usb_anchor and uses it to implement all modern
    APIs in the skeleton driver.

    - proper error reporting in the skeleton driver
    - implementation of flush()

    Signed-off-by: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     
  • This patch (as908) adds central protection in usbcore for the
    prototypical race between opening and unregistering a char device.
    The spinlock used to protect the minor-numbers array is replaced with
    an rwsem, which can remain locked across a call to a driver's open()
    method. This guarantees that open() and deregister() will be mutually
    exclusive.

    The private locks currently used in several individual drivers for
    this purpose are no longer necessary, and the patch removes them. The
    following USB drivers are affected: usblcd, idmouse, auerswald,
    legousbtower, sisusbvga/sisusb, ldusb, adutux, iowarrior, and
    usb-skeleton.

    As a side effect of this change, usb_deregister_dev() must not be
    called while holding a lock that is acquired by open(). Unfortunately
    a number of drivers do this, but luckily the solution is simple: call
    usb_deregister_dev() before acquiring the lock.

    In addition to these changes (and their consequent code
    simplifications), the patch fixes a use-after-free bug in adutux and a
    race between open() and release() in iowarrior.

    Signed-off-by: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

28 Apr, 2007

2 commits

  • Iet's kill BKL where we can. This is relative to the last patch to the
    skeleton driver.

    Signed-off-by: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     
  • compilation of the skeleton driver is currently broken. It doesn't compile.
    So while I am it:

    - fix typo
    - add comments to answer common questions
    - actually allow autosuspend in the driver struct
    - increase paralellism by restricting code under locks

    Signed-off-by: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     

17 Feb, 2007

1 commit

  • as the skeleton driver was made ready for autosuspend a race condition
    was introduced. The reference to get device must be gotten before the
    autosuspend counter is upped, as this operation may sleep, dropping BKL.
    Dropping BKL means that the pointer to the device may become invalid.
    Here's the fix.

    Signed-off-by: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     

05 Oct, 2006

1 commit

  • Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
    of passing regs around manually through all ~1800 interrupt handlers in the
    Linux kernel.

    The regs pointer is used in few places, but it potentially costs both stack
    space and code to pass it around. On the FRV arch, removing the regs parameter
    from all the genirq function results in a 20% speed up of the IRQ exit path
    (ie: from leaving timer_interrupt() to leaving do_IRQ()).

    Where appropriate, an arch may override the generic storage facility and do
    something different with the variable. On FRV, for instance, the address is
    maintained in GR28 at all times inside the kernel as part of general exception
    handling.

    Having looked over the code, it appears that the parameter may be handed down
    through up to twenty or so layers of functions. Consider a USB character
    device attached to a USB hub, attached to a USB controller that posts its
    interrupts through a cascaded auxiliary interrupt controller. A character
    device driver may want to pass regs to the sysrq handler through the input
    layer which adds another few layers of parameter passing.

    I've build this code with allyesconfig for x86_64 and i386. I've runtested the
    main part of the code on FRV and i386, though I can't test most of the drivers.
    I've also done partial conversion for powerpc and MIPS - these at least compile
    with minimal configurations.

    This will affect all archs. Mostly the changes should be relatively easy.
    Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

    struct pt_regs *old_regs = set_irq_regs(regs);

    And put the old one back at the end:

    set_irq_regs(old_regs);

    Don't pass regs through to generic_handle_irq() or __do_IRQ().

    In timer_interrupt(), this sort of change will be necessary:

    - update_process_times(user_mode(regs));
    - profile_tick(CPU_PROFILING, regs);
    + update_process_times(user_mode(get_irq_regs()));
    + profile_tick(CPU_PROFILING);

    I'd like to move update_process_times()'s use of get_irq_regs() into itself,
    except that i386, alone of the archs, uses something other than user_mode().

    Some notes on the interrupt handling in the drivers:

    (*) input_dev() is now gone entirely. The regs pointer is no longer stored in
    the input_dev struct.

    (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
    something different depending on whether it's been supplied with a regs
    pointer or not.

    (*) Various IRQ handler function pointers have been moved to type
    irq_handler_t.

    Signed-Off-By: David Howells
    (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)

    David Howells
     

28 Sep, 2006

4 commits

  • This patch (as741) makes the non-hub parts of usbcore actually use the
    autosuspend facilities added by an earlier patch.

    Devices opened through usbfs are autoresumed and then
    autosuspended upon close.

    Likewise for usb-skeleton.

    Devices are autoresumed for usb_set_configuration.

    Signed-off-by: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     
  • o CodingStyle fixes
    o Removes trailing spaces
    o Do not make not needed initialiation of automatic variables
    o Use usb_endpoint_* functions
    o If we get an error in the write URB callback print an error message instead
    of a debug one

    (Pretty unrelated changes, but spliting this up doesn't pay off as our main
    changes are just CodingStyle fixes).

    Signed-off-by: Luiz Fernando N. Capitulino
    Signed-off-by: Greg Kroah-Hartman

    Luiz Fernando N. Capitulino
     
  • Making structs const prevents accidental bugs and with the proper debug
    options they're protected against corruption.

    Signed-off-by: Luiz Fernando N. Capitulino
    Signed-off-by: Greg Kroah-Hartman

    Luiz Fernando N. Capitulino
     
  • This patch (as712b) is a slight revision of one submitted earlier. It
    fixes the usb-skeleton example driver so that it won't try to submit
    URBs after skel_disconnect() has returned. This could cause errors, if
    the driver was unbound and then a different driver was bound to the
    device. It also fixes a couple of small bugs in the skel_write()
    routine.

    The revised patch uses a slightly different test, suggested by Dave
    Brownell, for determining whether to free a transfer buffer. It's a
    little clearer than the earlier version.

    Signed-off-by: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

01 Jul, 2006

1 commit


01 Feb, 2006

1 commit


05 Jan, 2006

4 commits


29 Oct, 2005

1 commit

  • Also fixes all drivers that set this field, and removes some other devfs
    specfic USB logic.

    Signed-off-by: Greg Kroah-Hartman

    drivers/usb/class/usblp.c | 3 +--
    drivers/usb/core/file.c | 19 ++++---------------
    drivers/usb/image/mdc800.c | 3 +--
    drivers/usb/input/aiptek.c | 2 +-
    drivers/usb/input/hiddev.c | 3 +--
    drivers/usb/media/dabusb.c | 3 +--
    drivers/usb/misc/auerswald.c | 3 +--
    drivers/usb/misc/idmouse.c | 5 ++---
    drivers/usb/misc/legousbtower.c | 5 ++---
    drivers/usb/misc/rio500.c | 3 +--
    drivers/usb/misc/sisusbvga/sisusb.c | 5 -----
    drivers/usb/misc/usblcd.c | 9 ++++-----
    drivers/usb/usb-skeleton.c | 3 +--
    include/linux/usb.h | 7 ++-----
    14 files changed, 22 insertions(+), 51 deletions(-)

    Greg Kroah-Hartman