aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/aha152x.c
AgeCommit message (Collapse)Author
2008-10-16drivers/scsi: use nr_irqsYinghai Lu
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-27[SCSI] replace __FUNCTION__ with __func__Harvey Harrison
[jejb: fixed up a ton of missed conversions. All of you are on notice this has happened, driver trees will now need to be rebased] Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Cc: SCSI List <linux-scsi@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-05-23scsi: fix integer as NULL pointer warningHarvey Harrison
drivers/scsi/aha152x.c:3585:60: warning: Using plain integer as NULL pointer drivers/scsi/aha152x.c:3845:56: warning: Using plain integer as NULL pointer drivers/scsi/qla1280.c:2814:37: warning: Using plain integer as NULL pointer drivers/scsi/atp870u.c:750:47: warning: Using plain integer as NULL pointer drivers/scsi/3w-9xxx.c:1281:36: warning: Using plain integer as NULL pointer drivers/scsi/3w-9xxx.c:1293:36: warning: Using plain integer as NULL pointer drivers/scsi/3w-9xxx.c:1301:35: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:447:10: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:457:10: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:479:24: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:483:22: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:1213:23: warning: Using plain integer as NULL pointer drivers/scsi/hptiop.c:1214:23: warning: Using plain integer as NULL pointer Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-05-11[SCSI] aha152x: Fix oops on module removalJames Bottomley
Reported-by: Frank de Jong <frapex@xs4all.nl> > after trying to unload the module: > BUG: unable to handle kernel paging request at 00100100 > IP: [<fb9ff667>] :aha152x:aha152x_exit+0x47/0x6a > *pde = 00000000 > Oops: 0000 [#1] PREEMPT SMP > Modules linked in: aha152x(-) w83781d hwmon_vid tun ne 8390 bonding > usb_storage snd_usb_audio snd_usb_lib snd_rawmidi pwc snd_seq_device > compat_ioctl32 snd_hwdep videodev v4l1_compat 3c59x mii intel_agp > agpgart snd_pcm_oss snd_pcm snd_timer snd_page_alloc snd_mixer_oss snd > > Pid: 2837, comm: rmmod Not tainted (2.6.25.3 #1) > EIP: 0060:[<fb9ff667>] EFLAGS: 00210212 CPU: 0 > EIP is at aha152x_exit+0x47/0x6a [aha152x] > EAX: 00000001 EBX: 000ffdc4 ECX: f7c517a8 EDX: 00000001 > ESI: 00000000 EDI: 00000003 EBP: e7880000 ESP: e7881f58 > DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 > Process rmmod (pid: 2837, ti=e7880000 task=f27eb580 task.ti=e7880000) > Stack: fba03700 c01419d2 31616861 00783235 e795ee70 c0157709 b7f24000 e79ae000 > c0158271 ffffffff b7f25000 e79ae004 e795e370 b7f25000 e795e37c e795e370 > 009ae000 fba03700 00000880 e7881fa8 00000000 bf93ec20 bf93ec20 c0102faa > Call Trace: > [<c01419d2>] sys_delete_module+0x112/0x1a0 > [<c0157709>] remove_vma+0x39/0x50 > [<c0158271>] do_munmap+0x181/0x1f0 > [<c0102faa>] sysenter_past_esp+0x5f/0x85 > [<c0490000>] rsc_parse+0x0/0x3c0 The problem is that the driver calls aha152x_release() under a list_for_each_entry(). Unfortunately, aha152x_release() deletes from the list in question. Fix this by using list_for_each_entry_safe(). Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-05-11[SCSI] aha152x: fix init suspiciously returned 1, it should follow 0/-E ↵James Bottomley
convention Reported-by: Frank de Jong <frapex@xs4all.nl> > [1.] One line summary of the problem: > linux-2.6.25.3, aha152x'->init suspiciously returned 1, it should > follow 0/-E convention. The module / driver works okay. Unloading the > module is impossible. The driver is apparently returning 0 on failure and 1 on success. That's a bit unfortunate. Fix it by altering to -ENODEV and 0. Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-28scsi: fix integer as NULL pointer warningsHarvey Harrison
drivers/scsi/aic7xxx/aic7770_osm.c:53:58: warning: Using plain integer as NULL pointer drivers/scsi/aic7xxx/aic7xxx_osm_pci.c:355:47: warning: Using plain integer as NULL pointer drivers/scsi/aic7xxx/aic7xxx_osm_pci.c:372:55: warning: Using plain integer as NULL pointer drivers/scsi/aha152x.c:997:28: warning: Using plain integer as NULL pointer drivers/scsi/aha152x.c:1003:28: warning: Using plain integer as NULL pointer drivers/scsi/aha152x.c:1165:46: warning: Using plain integer as NULL pointer drivers/scsi/fdomain.c:1446:40: warning: Using plain integer as NULL pointer drivers/scsi/sym53c8xx_2/sym_hipd.c:1650:51: warning: Using plain integer as NULL pointer drivers/scsi/sym53c8xx_2/sym_hipd.c:3171:42: warning: Using plain integer as NULL pointer drivers/scsi/sym53c8xx_2/sym_hipd.c:5732:52: warning: Using plain integer as NULL pointer drivers/scsi/ncr53c8xx.c:8189:31: warning: Using plain integer as NULL pointer drivers/scsi/ncr53c8xx.c:8225:34: warning: Using plain integer as NULL pointer drivers/scsi/dpt_i2o.c:156:32: warning: Using plain integer as NULL pointer drivers/scsi/ultrastor.c:954:42: warning: Using plain integer as NULL pointer drivers/scsi/ultrastor.c:1104:18: warning: Using plain integer as NULL pointer Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-25[SCSI] aha152x, eata, u14-34f: minor irq handler cleanupsJeff Garzik
- remove pointless casts from void* - remove needless references to 'irq' function argument, when that information is already stored somewhere in a driver-private struct. - where the 'irq' function argument is known never to be used, rename it to 'dummy' to make this more obvious - remove always-false tests for dev_id==NULL - remove always-true tests for 'irq == host_struct->irq' - replace per-irq lookup functions and tables with a direct reference to data object obtained via 'dev_id' function argument, passed from request_irq() This change's main purpose is to prepare for the patchset in jgarzik/misc-2.6.git#irq-remove, that explores removal of the never-used 'irq' argument in each interrupt handler. Signed-off-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-01-11[SCSI] aha152x: Use scsi_eh API for REQUEST_SENSE invocationBoaz Harrosh
- Use new scsi_eh_prep/restor_cmnd() for synchronous REQUEST_SENSE invocation. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2007-10-22[SG] Update drivers to use sg helpersJens Axboe
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-19Convert files to UTF-8 and some cleanupsJan Engelhardt
* Convert files to UTF-8. * Also correct some people's names (one example is Eißfeldt, which was found in a source file. Given that the author used an ß at all in a source file indicates that the real name has in fact a 'ß' and not an 'ss', which is commonly used as a substitute for 'ß' when limited to 7bit.) * Correct town names (Goettingen -> Göttingen) * Update Eberhard Mönkeberg's address (http://lkml.org/lkml/2007/1/8/313) Signed-off-by: Jan Engelhardt <jengelh@gmx.de> Signed-off-by: Adrian Bunk <bunk@kernel.org>
2007-10-12[SCSI] aha152x: Close narrow race in releaseMatthew Wilcox
We were releasing the IRQ before removing the host, so commands could still be coming in which would never be seen by the interrupt handler. Just remove the host before releasing the IRQ to close this race. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-08-04[SCSI] aha152x: use data accessors and !use_sg cleanupBoaz Harrosh
And finally this is the regular !use_sg cleanup and use of data accessors. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-08-04[SCSI] aha152x: Fix check_condition code-pathBoaz Harrosh
check_condition code-path was similar but more complicated to Reset. It went like this: 1. extra space was allocated at aha152x_scdata for mirroring scsi_cmnd members. 2. At aha152x_internal_queue() every not check_condition (REQUEST_SENSE) command was copied to above members in case of error. 3. At busfree_run() in the DONE_CS phase if a Status of SAM_STAT_CHECK_CONDITION was detected. The command was re-queued Internally using aha152x_internal_queue(,,check_condition,) The old command members are over written with the REQUEST_SENSE info. 4. At busfree_run() in the DONE_CS phase again. If it is a check_condition command, info was restored from mirror made at first call to aha152x_internal_queue() (see 2) and the command is completed. What I did is: 1. Allocate less space in aha152x_scdata only for the 16-byte original command. (which is actually not needed by scsi-ml anymore at this stage. But this is to much knowledge of scsi-ml) 2. If Status == SAM_STAT_CHECK_CONDITION, then like before re-queue a REQUEST_SENSE command. But only now save original command members. (Less of them) 3. In aha152x_internal_queue(), just like for Reset, use the check_condition hint to set differently the working members. execute the command. 4. At busfree_run() in the DONE_CS phase again. restore needed members. While at it. This patch fixes a BUG. Old code when sending a REQUEST_SENSE for a failed command. Would than return with cmd->resid == 0 which was the status of the REQUEST_SENSE. The failing command resid was lost. And when would resid be interesting if not on a failing command? Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-08-04[SCSI] aha152x: Clean Reset pathBoaz Harrosh
What Reset code was doing: Save command's important/dangerous Info on stack. NULL those members from scsi_cmnd. Issue a Reset. wait for it to finish than restore members and return. What I do is save or NULL nothing. But use the "resetting" hint in aha152x_internal_queue() to NULL out working members and leave struct scsi_cmnd alone. The indent here looks funny but it will change/drop in last patch and it is clear this way what changed. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-08-04[SCSI] aha152x: preliminary fixes and some commentsBoaz Harrosh
hunk by hunk: - CHECK_CONDITION is what happens to cmnd->status >> 1 or after status_byte() macro. But here it is used directly on status which means 0x1 which is an undefined bit in the standard. And is a status that will never return from a target. - in busfree_run at the DONE_SC phase we have 3 distinct operation: 1-if(DONE_SC->SCp.phase & check_condition) The REQUEST_SENSE command return. - Restore original command - Than continue to operation 3. 2-if(DONE_SC->SCp.Status==SAM_STAT_CHECK_CONDITION) A regular command returned with a status. - Internally re-Q a REQUEST_SENSE. - Do not do operation 3. 3- - Complete the command and return it to scsi-ml So the 0x2 in both these operations (1,2) means the scsi check-condition status, hence SAM_STAT_CHECK_CONDITION - Here the code asks about !(DONE_SC->SCp.Status & not_issued) but "not_issued" is an enum belonging to the "phase" member and not to the Status returned from target. The reason this works is because not_issued==1 and Also CHECK_CONDITION==1 (remember from hunk 1). So actually the code was asking !(DONE_SC->SCp.Status & CHECK_CONDITION). Which means "Has the status been read from target yet?" Staus is read at status_run(). "not_issued" is cleared in seldo_run() which is usually earlier than status_run(). So this patch does nothing as far as assembly is concerned but it does let the reader understand what is going on. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-08-04[SCSI] aha152x: use bounce bufferBoaz Harrosh
Cause highmem buffers to be bounced to low memory until this driver supports highmem addresses. Otherwise it just oopses on NULL buffer addresses. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-08-04[SCSI] aha152x: fix debug mode symbol conflictBoaz Harrosh
The symbol <debug_locks> conflicts with the rather global one in include/linux/locks.h. Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-05-22[SCSI] aha152x: use wait_for_completion_timeoutChristoph Hellwig
Use wait_for_completion_timeout instead a semaphore + timer. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-02-14[PATCH] remove many unneeded #includes of sched.hTim Schmielau
After Al Viro (finally) succeeded in removing the sched.h #include in module.h recently, it makes sense again to remove other superfluous sched.h includes. There are quite a lot of files which include it but don't actually need anything defined in there. Presumably these includes were once needed for macros that used to live in sched.h, but moved to other header files in the course of cleaning it up. To ease the pain, this time I did not fiddle with any header files and only removed #includes from .c-files, which tend to cause less trouble. Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha, arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig, allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all configs in arch/arm/configs on arm. I also checked that no new warnings were introduced by the patch (actually, some warnings are removed that were emitted by unnecessarily included header files). Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2006-11-22WorkStruct: make allyesconfigDavid Howells
Fix up for make allyesconfig. Signed-Off-By: David Howells <dhowells@redhat.com>
2006-10-11[PATCH] Use linux/io.h instead of asm/io.hMatthew Wilcox
In preparation for moving check_signature, change these users from asm/io.h to linux/io.h Signed-off-by: Matthew Wilcox <willy@parisc-linux.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-06Various drivers' irq handlers: kill dead code, needless castsJeff Garzik
- Eliminate casts to/from void* - Eliminate checks for conditions that never occur. These typically fall into two classes: 1) Checking for 'dev_id == NULL', then it is never called with NULL as an argument. 2) Checking for invalid irq number, when the only caller (the system) guarantees the irq handler is called with the proper 'irq' number argument. Signed-off-by: Jeff Garzik <jeff@garzik.org>
2006-10-05IRQ: Maintain regs pointer globally rather than passing to IRQ handlersDavid Howells
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-23[SCSI] aha152x: remove static host arrayJames Bottomley
Fix this driver not to use a static two element host array instead use a list. This should fix panic on multiple eject reinsert of the pcmcia version of this device. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-07-09[SCSI] hide EH backup data outside the scsi_cmndChristoph Hellwig
Currently struct scsi_cmnd has various fields that are used to backup original data after the corresponding fields have been overridden for EH commands. This means drivers can easily get at it and misuse it. Due to the old_ naming this doesn't happen for most of them, but two that have different names have been used wrong a lot (see previous patch). Another downside is that they unessecarily bloat the scsi_cmnd size. This patch moves them onstack in scsi_send_eh_cmnd to fix those two issues aswell as allowing future EH fixes like moving the EH command submissions to use SG lists like everything else. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-07-09[SCSI] aha152x: stop poking at saved scsi_cmnd membersChristoph Hellwig
Stop poking into the old_ & co scsi_cmnd fields that should only be used in the EH code. Untested, but this is required to move ahead with the EH fixes. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-07-02[PATCH] irq-flags: scsi: Use the new IRQF_ constantsThomas Gleixner
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@elte.hu> Cc: "David S. Miller" <davem@davemloft.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: James Bottomley <James.Bottomley@steeleye.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-14Merge ../linux-2.6James Bottomley
2006-02-28[SCSI] aha152x: fix variable use before initialisation and other bugsJürgen E. Fischer
- change interface of the reset functions from Scsi_Cmnd to Scsi_Host. - add functions with the original interface and rename the new functions to reflect the new interface. - call these from the pcmcia driver, thereby avoiding the need to construct a (broken) Scsi_Cmnd from a Scsi_Host. - just run the bh if the interrupt is from the controller and if so ensure that it's only called once per interrupt. Signed-off-by: Juergen E. Fischer <fischer@linux-buechse.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-02-27[SCSI] Add spi_populate_*_msg functionsMatthew Wilcox
Introduce new helpers: - spi_populate_width_msg() - spi_populate_sync_msg() - spi_populate_ppr_msg() and use them in drivers which already enable the SPI transport. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-12-15[SCSI] Rename scsi_print_msg to spi_print_msgMatthew Wilcox
Rename scsi_print_msg to spi_print_msg and move its prototype from scsi_dbg.h to scsi_transport_spi.h Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-09[SCSI] remove Scsi_Host_Template typedefChristoph Hellwig
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-10-28[SCSI] use sfoo_printk() in driversJeff Garzik
Rejections fixed up and Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-17[SCSI] allow sleeping in ->eh_device_reset_handler()Jeff Garzik
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-04-18[PATCH] remove outdated print_* functions
We have the scsi_print_* functions in the proper namespace for a long time now and there weren't a lot users left. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-04-16Linux-2.6.12-rc2Linus Torvalds
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!