aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/class/usblp.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
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 <arnd@arndb.de> Cc: Julia Lawall <julia@diku.dk> Cc: Christoph Hellwig <hch@infradead.org>
2010-08-10USB: usblp: fixed switch, brace, whitespace and spacing coding style issuesNicolas Kaiser1-186/+185
Fixed switch, brace, whitespace and spacing coding style issues. Signed-off-by: Nicolas Kaiser <nikai@nikai.net> Acked-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-07-19update email addressPavel Machek1-1/+1
pavel@suse.cz no longer works, replace it with working address. Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-05-20USB: rename usb_buffer_alloc() and usb_buffer_free() usersDaniel Mack1-1/+1
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 <daniel@caiaq.de> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Pedro Ribeiro <pedrib@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-02usb: BKL removal: usblpOliver Neukum1-3/+0
BKL was not needed at all. Removed without replacement. Signed-off-by: Oliver Neukum <oliver@neukum.org> Acked-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-02USB: Push BKL on open down into the driversOliver Neukum1-0/+3
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>
2010-03-02USB class: 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 <nm127@freemail.hu> Cc: Julia Lawall <julia@diku.dk> Cc: cocci@diku.dk Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-02USB: usblp: Remove checks no longer needed with the new runtime PM systemOliver Neukum1-17/+3
Under the new system a device cannot be suspended against the driver's wish. Therefore this condition no longer needs to be checked for. Signed-off-by: Oliver Neukum <oliver@neukum.org> Cc: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-19Driver-Core: extend devnode callbacks to provide permissionsKay Sievers1-2/+2
This allows subsytems to provide devtmpfs with non-default permissions for the device node. Instead of the default mode of 0600, null, zero, random, urandom, full, tty, ptmx now have a mode of 0666, which allows non-privileged processes to access standard device nodes in case no other userspace process applies the expected permissions. This also fixes a wrong assignment in pktcdvd and a checkpatch.pl complain. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-06-15Driver Core: usb: add nodename support for usb drivers.Kay Sievers1-0/+6
This adds support for USB drivers to report their requested nodename to userspace. It also updates a number of USB drivers to provide the needed subdirectory and device name to be used for them. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Jan Blunck <jblunck@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-03-24usblp: continuously poll for statusPete Zaitcev1-4/+7
The usblp in 2.6.18 polled for status regardless if we actually needed it. At some point I dropped it, to save the batteries if nothing else. As it turned out, printers exist (e.g. Canon BJC-3000) that need prodding this way or else they stop. This patch restores the old behaviour. If you want to save battery, don't leave jobs in the print queue. I tested this on my printers by printing and examining usbmon traces to make sure status is being requested and printers continue to print. Tuomas Jäntti verified the fix on BJC-3000. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-01-27USB: usblp.c: add USBLP_QUIRK_BIDIR to Brother HL-1440Brandon Philips1-0/+1
My Brother HL-1440 would print one document before CUPS would stop printing with the error "Printer not connected; will retry in 30 seconds...". I traced this down to the CUPS usb backend getting an EIO out of usblp on the IOCNR_GET_DEVICE_ID IOCTL. Adding the USBLP_QUIRK_BIDIR fixes the problem but is it the right solution? output from strace /usr/lib/cups/backend/usb after printing a document (Note: SNDCTL_DSP_SYNC == IOCNR_GET_DEVICE_ID): before patch open("/dev/usb/lp0", O_RDWR|O_EXCL) = 3 ioctl(3, SNDCTL_DSP_SYNC, 0x7fff2478cef0) = -1 EIO (Input/output error) after patch open("/dev/usb/lp0", O_RDWR|O_EXCL) = 3 ioctl(3, SNDCTL_DSP_SYNC, 0x7fffb8d474c0) = 0 Possibly related bug: https://bugs.launchpad.net/ubuntu/+source/cupsys/+bug/35638 Signed-off-by: Brandon Philips <bphilips@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-10-17USB: remove err() macro from usb class driversGreg Kroah-Hartman1-3/+4
USB should not be having it's own printk macros, so remove err() and use the system-wide standard of dev_err() wherever possible. In the few places that will not work out, use a basic printk(). Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-10-17drivers/usb/class/usblp.c: adjust error handling codeJulia Lawall1-9/+9
In this code, it is possible to tell statically whether usblp will be NULL in the error handling code. Oliver Neukum suggested to make a goto to the final return rather than return directly. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ identifier f,err,l,l1; type T; expression x,E; statement S; @@ x = NULL ... when != goto l1; * x = f(...) ... when != x err = E; goto l; ... * if (x != NULL) S return err; // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Cc: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-02-21USB: fix pm counter leak in usblpOliver Neukum1-0/+1
if you fail in open() you must decrement the pm counter again. Signed-off-by: Oliver Neukum <oneukum@suse.de> Cc: stable <stable@kernel.org> Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
2007-10-12usblp: Fix a double kfreePete Zaitcev1-12/+23
If submit fails, slab hits a BUG() because of a double kfree. The today's lesson is, you cannot just slap USB_FREE_BUFFER on code without adjusting the error paths. The patch is made bigger by opportunistic refactoring. Signed-Off-By: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12usblp: CosmeticsPete Zaitcev1-4/+5
This is a small bunch of cosmetic fixes: - Timeout is not a write timeout anymore, rename - Condition in poll was confusingly backwards, invert and simplify - The comment log gave a wrong impression of version 0.13, terminate it. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12usblp: mutex in usblp_check_statusPete Zaitcev1-3/+4
Add a mutex to protect the ->statusbuf. Not really an issue, because CUPS is single-threaded when it talks to the printer, but I feel safer this way. This should be deadlock-free, but I kept this as a separate patch in case someone ends running a git bisect. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12usblp: Make use of URB_FREE_BUFFERPete Zaitcev1-3/+1
Employ the new API URB_FREE_BUFFER that we've got. There was talk of a combined constructor for this case, but apparently it's not happening, so just set the flag explicitly for now. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12usblp: Implement the ENOSPC conventionPete Zaitcev1-26/+39
This patch implements a mode when a printer returns ENOSPC when it runs out of paper. The default remains the same as before. An application which wishes to use this function has to enable it explicitly with an ioctl LPABORT. This is done on a request by our (Fedora) CUPS guy, Tim Waugh. The API is similar enough to the lp0's one that CUPS works with both (but see below), but it's has some differences. Most importantly, the abort mode is persistent in case of lp0: once tunelp was run your cat fill blow up until you reboot or run tunelp again. For usblp, I made it so the abort mode is only in effect as long as device is open. This way you can mix and match CUPS and cat(1) freely and nothing bad happens even if you run out of paper. It is also safer in the face of any unexpected crashes. It has to be noted that mixing LPABORT and O_NONBLOCK is not advised. It probably does not do what you want: instead of returning -ENOSPC it will always return -EAGAIN (because it would otherwise block while waiting for the paper). Applications which use O_NONBLOCK should continue to use LPGETSTATUS like before. Finally, CUPS actually requires patching to take full advantage of this. It has several components; those which invoke LPABORT work, but some of them need the ioctl added. This is completely compatible, you can mix old CUPS and new kernels or vice versa. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19USB: class: usblp: clean up urb->status usageGreg Kroah-Hartman1-8/+10
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 <gregkh@suse.de>
2007-07-19USB: usblp: "Big cleanup" breaks O_NONBLOCKPete Zaitcev1-4/+5
I found the first regresson in the rewritten ("all dynamic" and "no races") driver. If application uses O_NONBLOCK, I return -EAGAIN despite the URB being submitted successfuly. This causes the application to resubmit the same data erroneously. The fix is to pretend that the transfer has succeeded even if URB was merely queued. It is the same behaviour as with the old version. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: usblp: add dynamic URBs, fix racesPete Zaitcev1-242/+376
This patch's main bulk aims to make usblp the premier driver for code pillaging once again. The code is as streamlined as possible and is bug-free as possible. The usb-skeleton performs the same function, but is somewhat abstract. The usblp is usb-skeleton which is actually used by many. Since I combed a few small bugs away, this also fixes the small races we had in usblp for a while. For example, now it's possible for several threads to make write(2) calls (sounds silly, but consider a printer for paper record, where every line of text is self-contained and thus it's all right to have them interleaved). Also gone are issues with interrupts using barriers dangerously. This patch makes use of Oliver's anchor, and so it must trail the anchor patch on the way to Linus. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-08usblp: Don't let suspend to kill ->usedPete Zaitcev1-3/+2
Suspend destroys refcounting for open/release. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-05-22USB: usblp: Use correct DMA address in case of probe errorPete Zaitcev1-1/+1
Looks like the error path had a copy-paste error. The normal exit path uses correct URB already. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-05-08header cleaning: don't include smp_lock.h when not usedRandy Dunlap1-1/+0
Remove includes of <linux/smp_lock.h> where it is not used/needed. Suggested by Al Viro. Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc, sparc64, and arm (all 59 defconfigs). Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-03-19usblp: quirk flag and device entry for Seiko Epson M129C printerAlan Stern1-1/+5
This patch (as872) adds a device table entry and a new quirk flag to the usblp driver for the Seiko Epson Receipt printer. This printer returns Vendor-Specific values for bInterfaceClass and bInterfaceSubClass, but the bInterfaceProtocol value is valid and it works with usblp. The new quirks flag tells the driver to ignore the Class and SubClass values in the interface descriptor. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: Vojtech Pavlik <vojtech@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-07USB: autosuspend for usb printer driverOliver Neukum1-11/+5
this implements autosuspend for usb printers. It compiles and is tested. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-01-05USB: usblp.c - add Kyocera Mita FS 820 to list of "quirky" printersMartin Williges1-0/+1
This patch gets the Kyocera FS-820 working with cups 1.2 via usb again. It adds the printer to the list of "quirky" printers. The printer seems not answer to ID requests some seconds after plugging in. Patch is based on linux-2.6.19.1. Background: As far as I could see (strace, usbmon), the Kyocera FS-820 answers to ID requests only a few seconds after plugging it in. This applies to detecting it with cups and is also true for the printing itself, which is initiated with an ID request. Since I have little usb knowledge, maybe someone can interpret the data, especially the fist bulk transfer - why request 8192 bytes? This is the second version of the patch. usbmon output of printing an email without patch: tail -F /tmp/printlog.txt c636e140 3374734463 S Bi:002:02 -115 8192 < c9d43b40 3374734494 S Ci:002:00 s a1 00 0000 0000 03ff 1023 < c9d43b40 3379732301 C Ci:002:00 -104 0 c636e140 3379733294 C Bi:002:02 -2 0 [...repeating...] with patch: tail -F /tmp/printlog.txt d9cb82c0 3729790131 S Ci:002:00 s a1 00 0000 0000 03ff 1023 < d9cb82c0 3729791725 C Ci:002:00 0 91 = 005b4944 3a46532d 3832303b 4d46473a 4b796f63 6572613b 434d443a 50434c58 df956320 3732493190 S Bo:002:01 -115 1347 = 1b252d31 32333435 5840504a 4c0a4050 4a4c2053 4554204d 414e5541 4c464545 [...more data...] Signed-off-by: Martin Williges <kernel@zut.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-12-20USB: mutexification of usblpOliver Neukum1-25/+29
this patch: - converts usblp fully to mutex - makes sleeping interruptible where EINTR can be returned anyway Signed-off-by: Oliver Neukum <oliver@neukum.name> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-11-03USB: usblp: fix system suspend for some systemsOliver Neukum1-2/+0
this has been confirmed to fix suspend problems with usblp. Signed-off-by: Oliver Neukum <oliver@neukum.name> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-11-03USB: failure in usblp's error pathOliver Neukum1-0/+1
if urb submission fails due to a transient error here eg. ENOMEM , the driver is dead. This fixes it. Regards Oliver Signed-off-by: Oliver Neukum <oliver@neukum.name> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-10-17USB: fix suspend support for usblpOliver Neukum1-8/+71
this implements suspend support for usblp. According to the CUPS people ENODEV will make CUPS retry the job. Thus it is returned in the runtime case. My printer survives suspend/resume cycles with it. Signed-off-by: Oliver Neukum <oliver@neukum.name> Signed-off-by: Vojtech Pavlik <vojtech@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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 <dhowells@redhat.com> (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-09-27USB: fix __must_check warnings in drivers/usb/class/Greg Kroah-Hartman1-1/+3
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-27USB: usblp: Use usb_endpoint_* functions.Luiz Fernando N. Capitulino1-7/+2
Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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 <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-20[PATCH] USB: convert a bunch of USB semaphores to mutexesArjan van de Ven1-7/+8
the patch below converts a bunch of semaphores-used-as-mutex in the USB code to mutexes Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-31[PATCH] USB: cleanup of usblpOliver Neukum1-47/+24
this fixes -potential hang by disconnecting through usbfs -kzalloc -general cleanup -micro optimisation in interrupt handlers It compiles and I am printing. Signed-off-by: Oliver Neukum <oliver@neukum.name> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivialLinus Torvalds1-1/+1
2006-01-04[PATCH] USB: Export IEEE-1284 device id in sysfs for usblp devicesDavid Woodhouse1-9/+26
I looked at the userspace code which uses the LPIOC_GET_DEVICE_ID ioctl and I almost went blind. Let's export it in sysfs instead, and just as a string instead of with a big-endian length at the beginning of it. This also prints the message about finding the printer _after_ we know the minor device number it's going to have, rather than reporting all printers as 'usblp0'. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04[PATCH] USB: ioctl compat for usblp.cPete Zaitcev1-2/+3
From: David Woodhouse <dwmw2> David has a G5 with a printer. I am quite surprised that nobody else noticed this before. Linus has a G5. Hackers hate printing in general, maybe. We do not use BKL anymore, because one of code paths had a sleeping call, so we had to use a semaphore. I am sure it's safe to use unlocked_ioctl. The new ioctls return long and retval is int. It looks completely fine to me. We never want these extra bits, and the sign extension ought to work right. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --
2006-01-04[PATCH] USB: mark various usb tables constArjan van de Ven1-2/+2
patch below marks various USB tables and variables as const so that they end up in .rodata section and don't cacheline share with things that get written to. For the non-array variables it also allows gcc to optimize more. Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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 <gregkh@suse.de>
2006-01-03update the email address of Randy DunlapAdrian Bunk1-1/+1
This patch removes all references to the bouncing address rddunlap@osdl.org and one dead web page from the kernel. Signed-off-by: Adrian Bunk <bunk@stusta.de> Acked-by: Randy Dunlap <rdunlap@xenotime.net>
2005-10-28[PATCH] devfs: Remove the mode field from usb_class_driver as it's no longer neededGreg Kroah-Hartman1-2/+1
Also fixes all drivers that set this field, and removes some other devfs specfic USB logic. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> 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(-)
2005-09-08[PATCH] USB usblp: rate-limit printer status error messagesRandy Dunlap1-3/+6
Rate-limit usblp printer error status messages. I unplugged my USB printer and almost instantly got several hundred of these in my kernel message log: drivers/usb/class/usblp.c: usblp0: error -19 reading printer status Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-27[PATCH] USB: usblp: 2x up() in usblp_readDomen Puncer1-0/+1
up(&usblp->sem) was called twice in a row in this code path. Signed-off-by: Domen Puncer <domen@coderock.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-06-27[PATCH] USB: Fix race condition in usblp_writeC. Adam Oldham1-0/+2
Initialize status fields in the read and write urbs to prevent a race condition with open/read/close - open/write/close sequences. Fixes bug #4432 at bugzilla.kernel.org Signed-off-by: Adam Oldham <oldhamca@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-04-16Linux-2.6.12-rc2Linus Torvalds1-0/+1214
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!