aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/misc/ldusb.c
AgeCommit message (Collapse)AuthorFilesLines
2013-07-23USB: ldusb: remove custom dbg_info() macroGreg Kroah-Hartman1-21/+10
We want to get rid of CONFIG_USB_DEBUG, so remove the reliance of the ldusb driver on it. Don't use the custom macro, or a special module parameter, instead, rely on the in-kernel dynamic debugging infrastructure, which is much easier to use, and consistant across the whole kernel. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-04-20USB: ldusb.c: remove err() usageGreg Kroah-Hartman1-6/+9
err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Michael Hund <[email protected]> CC: Kuninori Morimoto <[email protected]> CC: Sarah Sharp <[email protected]> CC: Felipe Balbi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2011-11-18USB: convert drivers/usb/* to use module_usb_driver()Greg Kroah-Hartman1-26/+1
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 <[email protected]> Cc: Duncan Sands <[email protected]> Cc: Matthieu CASTET <[email protected]> Cc: Stanislaw Gruszka <[email protected]> Cc: Pete Zaitcev <[email protected]> Cc: Oliver Neukum <[email protected]> Cc: Juergen Stuber <[email protected]> Cc: Cesar Miquel <[email protected]> Cc: Matthew Dharm <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Sarah Sharp <[email protected]> Cc: Kuninori Morimoto <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Lucas De Marchi <[email protected]> Cc: Michael Hund <[email protected]> Cc: Zack Parsons <[email protected]> Cc: Melchior FRANZ <[email protected]> Cc: Tomoki Sekiyama <[email protected]> Cc: Dan Carpenter <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2011-08-23USB: use usb_endpoint_maxp() instead of le16_to_cpu()Kuninori Morimoto1-2/+2
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 <[email protected]> Cc: Pavel Machek <[email protected]> Cc: Johannes Erdfelt <[email protected]> Cc: Vojtech Pavlik <[email protected]> Cc: Oliver Neukum <[email protected]> Cc: David Kubicek <[email protected]> Cc: Johan Hovold <[email protected]> Cc: Brad Hards <[email protected]> Acked-by: Felipe Balbi <[email protected]> Cc: Sebastian Andrzej Siewior <[email protected]> Cc: Thomas Dahlmann <[email protected]> Cc: David Brownell <[email protected]> Cc: David Lopo <[email protected]> Cc: Alan Stern <[email protected]> Cc: Michal Nazarewicz <[email protected]> Cc: Xie Xiaobo <[email protected]> Cc: Li Yang <[email protected]> Cc: Jiang Bo <[email protected]> Cc: Yuan-hsin Chen <[email protected]> Cc: Darius Augulis <[email protected]> Cc: Xiaochen Shen <[email protected]> Cc: Yoshihiro Shimoda <[email protected]> Cc: OKI SEMICONDUCTOR, <[email protected]> Cc: Robert Jarzmik <[email protected]> Cc: Ben Dooks <[email protected]> Cc: Thomas Abraham <[email protected]> Cc: Herbert Pötzl <[email protected]> Cc: Arnaud Patard <[email protected]> Cc: Roman Weissgaerber <[email protected]> Acked-by: Sarah Sharp <[email protected]> Cc: Tony Olech <[email protected]> Cc: Florian Floe Echtler <[email protected]> Cc: Christian Lucht <[email protected]> Cc: Juergen Stuber <[email protected]> Cc: Georges Toth <[email protected]> Cc: Bill Ryder <[email protected]> Cc: Kuba Ober <[email protected]> Cc: Inaky Perez-Gonzalez <[email protected]> Signed-off-by: Kuninori Morimoto <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2011-05-03USB: ldusb: add several new devicesMichael Hund1-10/+42
Added several new devices to ldusb and excluded them from the HID driver. Signed-off-by: Michael Hund <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-11-01tree-wide: fix comment/printk typosUwe Kleine-König1-1/+1
"gadget", "through", "command", "maintain", "maintain", "controller", "address", "between", "initiali[zs]e", "instead", "function", "select", "already", "equal", "access", "management", "hierarchy", "registration", "interest", "relative", "memory", "offset", "already", Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
2010-10-15llseek: automatically add .llseek fopArnd Bergmann1-0/+1
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 <[email protected]> Cc: Julia Lawall <[email protected]> Cc: Christoph Hellwig <[email protected]>
2010-03-02USB: Convert concatenated __FILE__ to %s, __FILE__Joe Perches1-1/+1
Reduces string space a bit Neaten a macro redefine of dbg Signed-off-by: Joe Perches <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-03-02USB: BKL removal: ldusbOliver Neukum1-10/+2
BKL was not needed at all. Removed without replacement. Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-03-02USB: Push BKL on open down into the driversOliver Neukum1-2/+10
Straightforward push into the drivers to allow auditing individual drivers separately Signed-off-by: Oliver Neukum <[email protected]> Acked-by: Mauro Carvalho Chehab <[email protected]> Cc: Jiri Kosina <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-03-02USB misc: make USB device id constantNémeth Márton1-1/+1
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 <[email protected]> Cc: Julia Lawall <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2009-09-23USB: ldusb should signal an error in poll if the device is disconnectedOliver Neukum1-0/+6
poll() should test for a disconnection of the device. Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2009-01-27USB: remove vernier labpro from ldusbsware1-2/+0
Labpro device is in both ldusb and vstusb device tables. Should only be a vstusb device. Signed-off-by: stephen ware <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2008-05-14USB: remove PICDEM FS USB demo (04d8:000c) device from ldusbXiaofan Chen1-4/+0
Microchip has changed the PICDEM FS USB demo device (0x04d8:000c) to use bulk transfer and not interrupt transfer. So I've updated the libusb based program here (Post #31). http://forum.microchip.com/tm.aspx?m=106426&mpage=2 So I believe that the in-kernel ldusb driver will no longer work with the demo firmware. It should be removed. Signed-off-by: Xiaofan Chen <[email protected]> Cc: Michael Hund <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2008-05-02usb: ldusb: ld_usb semaphore to mutexDaniel Walker1-14/+14
Signed-off-by: Daniel Walker <[email protected]> Acked-by: Matthew Wilcox <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2008-04-24USB: replace remaining __FUNCTION__ occurrencesHarvey Harrison1-5/+5
__FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2008-02-21USB: add new vernier product id to ldusb.cStephen Ware1-0/+2
I have a new ldusb device to go into the device table. Jiri has merged the change for hiddev quirks already. From: Stephen Ware <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2007-07-19USB: misc: ldusb: clean up urb->status usageGreg Kroah-Hartman1-9/+11
This done in anticipation of removal of urb->status, which will make that patch easier to review and apply in the future. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2007-07-12USB: prevent char device open/deregister raceAlan Stern1-25/+8
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2007-05-22USB: ldusb bugfixOliver Neukum1-4/+31
This patch fixes a problem reported with consecutive reads in the ldusb driver. Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2007-04-27USB: add picdem device to ldusbJoey Goncalves1-0/+3
Hi Greg: I have found that /drivers/usb/misc/ldusb.c works with the "PICDEM Full Speed USB" http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en021940 Signed-off-by: Joey S Goncalves <[email protected]> Cc: Michael Hund <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-10-05IRQ: Maintain regs pointer globally rather than passing to IRQ handlersDavid Howells1-2/+2
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 <[email protected]> (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-09-27USB: ldusb: Use usb_endpoint_* functions.Luiz Fernando N. Capitulino1-6/+2
Signed-off-by: Luiz Fernando N. Capitulino <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-09-27USB: Make file operations structs in drivers/usb const.Luiz Fernando N. Capitulino1-1/+1
Making structs const prevents accidental bugs and with the proper debug options they're protected against corruption. Signed-off-by: Luiz Fernando N. Capitulino <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-06-30Remove obsolete #include <linux/config.h>Jörn Engel1-1/+0
Signed-off-by: Jörn Engel <[email protected]> Signed-off-by: Adrian Bunk <[email protected]>
2006-03-20[PATCH] USB: convert a bunch of USB semaphores to mutexesArjan van de Ven1-5/+6
the patch below converts a bunch of semaphores-used-as-mutex in the USB code to mutexes Signed-off-by: Arjan van de Ven <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-03-20[PATCH] USB: kzalloc in ldusbOliver Neukum1-2/+1
another one for kzalloc Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-02-13[PATCH] USB: add new device ids to ldusbMichael Hund1-25/+32
Signed-off-by: Michael Hund <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-01-31[PATCH] USB: remove some left over devfs droppings hanging around in the usb ↵Greg Kroah-Hartman1-1/+1
drivers As there is no more usb devfs support, these bits would just confuse people. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2006-01-04[PATCH] USB: remove .owner field from struct usb_driverGreg Kroah-Hartman1-1/+0
It is no longer needed, so let's remove it, saving a bit of memory. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-09-08[PATCH] USB ldusb: fmt warnings fixes for 64-bit platformsAlexey Dobriyan1-3/+3
Fix drivers/usb/misc/ldusb.c: In function `ld_usb_read': drivers/usb/misc/ldusb.c:467: warning: int format, different type arg (arg 4) drivers/usb/misc/ldusb.c: In function `ld_usb_write': drivers/usb/misc/ldusb.c:531: warning: int format, different type arg (arg 4) drivers/usb/misc/ldusb.c:532: warning: int format, different type arg (arg 5) drivers/usb/misc/ldusb.c:532: warning: int format, different type arg (arg 6) Signed-off-by: Alexey Dobriyan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2005-07-29[PATCH] USB: ldusb fixesMichael Hund1-1/+6
below you will find the forgotten kmalloc check (sorry). Signed-off-by: Michael Hund <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2005-07-12[PATCH] USB: add ldusb driverMichael Hund1-0/+794
The following driver provides complete interrupt-in and interrupt-out reports (raw data) to a user program. Until now it uses the HIDIOCGDEVINFO ioctl call, because I don't know better :-(. Perhaps, it will be ok for you - and I will be happy, if you assign 8 minor numbers. I have tested it in several environments and it works very well for me. However, it has a problem with two or more devices at the same hub, if the two or more devices need 1 ms interrupt-in transfers. Unfortunately more than one interrupt-in transfer every ms isn't possible (ehci driver?). This is why the min_interrupt_in_interval and min_interrupt_out_interval are increased to 2 ms (see the corresponding module parameters). This way, I can use two devices simultaneously at the same hub. Signed-off-by: Michael Hund <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>