aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-12-30 00:20:30 -0500
committerGrant Likely <grant.likely@secretlab.ca>2010-12-30 00:21:47 -0500
commitd392da5207352f09030e95d9ea335a4225667ec0 (patch)
tree7d6cd1932afcad0a5619a5c504a6d93ca318187c /drivers/message
parente39d5ef678045d61812c1401f04fe8edb14d6359 (diff)
parent387c31c7e5c9805b0aef8833d1731a5fe7bdea14 (diff)
Merge v2.6.37-rc8 into powerpc/next
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/mptbase.c251
-rw-r--r--drivers/message/fusion/mptbase.h25
-rw-r--r--drivers/message/fusion/mptctl.c15
-rw-r--r--drivers/message/fusion/mptfc.c7
-rw-r--r--drivers/message/fusion/mptsas.c4
-rw-r--r--drivers/message/fusion/mptspi.c4
-rw-r--r--drivers/message/i2o/exec-osm.c8
-rw-r--r--drivers/message/i2o/i2o_block.c34
-rw-r--r--drivers/message/i2o/i2o_config.c41
-rw-r--r--drivers/message/i2o/i2o_scsi.c9
10 files changed, 204 insertions, 194 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index b88a244a1edd..3e57b61ca446 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -50,6 +50,7 @@
50#include <linux/module.h> 50#include <linux/module.h>
51#include <linux/errno.h> 51#include <linux/errno.h>
52#include <linux/init.h> 52#include <linux/init.h>
53#include <linux/seq_file.h>
53#include <linux/slab.h> 54#include <linux/slab.h>
54#include <linux/types.h> 55#include <linux/types.h>
55#include <linux/pci.h> 56#include <linux/pci.h>
@@ -109,8 +110,7 @@ MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h \
109 110
110int mpt_fwfault_debug; 111int mpt_fwfault_debug;
111EXPORT_SYMBOL(mpt_fwfault_debug); 112EXPORT_SYMBOL(mpt_fwfault_debug);
112module_param_call(mpt_fwfault_debug, param_set_int, param_get_int, 113module_param(mpt_fwfault_debug, int, 0600);
113 &mpt_fwfault_debug, 0600);
114MODULE_PARM_DESC(mpt_fwfault_debug, "Enable detection of Firmware fault" 114MODULE_PARM_DESC(mpt_fwfault_debug, "Enable detection of Firmware fault"
115 " and halt Firmware on fault - (default=0)"); 115 " and halt Firmware on fault - (default=0)");
116 116
@@ -200,12 +200,9 @@ static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_valu
200static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init); 200static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init);
201 201
202#ifdef CONFIG_PROC_FS 202#ifdef CONFIG_PROC_FS
203static int procmpt_summary_read(char *buf, char **start, off_t offset, 203static const struct file_operations mpt_summary_proc_fops;
204 int request, int *eof, void *data); 204static const struct file_operations mpt_version_proc_fops;
205static int procmpt_version_read(char *buf, char **start, off_t offset, 205static const struct file_operations mpt_iocinfo_proc_fops;
206 int request, int *eof, void *data);
207static int procmpt_iocinfo_read(char *buf, char **start, off_t offset,
208 int request, int *eof, void *data);
209#endif 206#endif
210static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc); 207static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc);
211 208
@@ -629,6 +626,7 @@ mptbase_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
629 * mpt_register - Register protocol-specific main callback handler. 626 * mpt_register - Register protocol-specific main callback handler.
630 * @cbfunc: callback function pointer 627 * @cbfunc: callback function pointer
631 * @dclass: Protocol driver's class (%MPT_DRIVER_CLASS enum value) 628 * @dclass: Protocol driver's class (%MPT_DRIVER_CLASS enum value)
629 * @func_name: call function's name
632 * 630 *
633 * This routine is called by a protocol-specific driver (SCSI host, 631 * This routine is called by a protocol-specific driver (SCSI host,
634 * LAN, SCSI target) to register its reply callback routine. Each 632 * LAN, SCSI target) to register its reply callback routine. Each
@@ -1725,7 +1723,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1725 u8 pcixcmd; 1723 u8 pcixcmd;
1726 static int mpt_ids = 0; 1724 static int mpt_ids = 0;
1727#ifdef CONFIG_PROC_FS 1725#ifdef CONFIG_PROC_FS
1728 struct proc_dir_entry *dent, *ent; 1726 struct proc_dir_entry *dent;
1729#endif 1727#endif
1730 1728
1731 ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); 1729 ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC);
@@ -1980,16 +1978,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1980 */ 1978 */
1981 dent = proc_mkdir(ioc->name, mpt_proc_root_dir); 1979 dent = proc_mkdir(ioc->name, mpt_proc_root_dir);
1982 if (dent) { 1980 if (dent) {
1983 ent = create_proc_entry("info", S_IFREG|S_IRUGO, dent); 1981 proc_create_data("info", S_IRUGO, dent, &mpt_iocinfo_proc_fops, ioc);
1984 if (ent) { 1982 proc_create_data("summary", S_IRUGO, dent, &mpt_summary_proc_fops, ioc);
1985 ent->read_proc = procmpt_iocinfo_read;
1986 ent->data = ioc;
1987 }
1988 ent = create_proc_entry("summary", S_IFREG|S_IRUGO, dent);
1989 if (ent) {
1990 ent->read_proc = procmpt_summary_read;
1991 ent->data = ioc;
1992 }
1993 } 1983 }
1994#endif 1984#endif
1995 1985
@@ -5955,8 +5945,10 @@ mpt_findImVolumes(MPT_ADAPTER *ioc)
5955 goto out; 5945 goto out;
5956 5946
5957 mem = kmalloc(iocpage2sz, GFP_KERNEL); 5947 mem = kmalloc(iocpage2sz, GFP_KERNEL);
5958 if (!mem) 5948 if (!mem) {
5949 rc = -ENOMEM;
5959 goto out; 5950 goto out;
5951 }
5960 5952
5961 memcpy(mem, (u8 *)pIoc2, iocpage2sz); 5953 memcpy(mem, (u8 *)pIoc2, iocpage2sz);
5962 ioc->raid_data.pIocPg2 = (IOCPage2_t *) mem; 5954 ioc->raid_data.pIocPg2 = (IOCPage2_t *) mem;
@@ -6546,20 +6538,12 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
6546static int 6538static int
6547procmpt_create(void) 6539procmpt_create(void)
6548{ 6540{
6549 struct proc_dir_entry *ent;
6550
6551 mpt_proc_root_dir = proc_mkdir(MPT_PROCFS_MPTBASEDIR, NULL); 6541 mpt_proc_root_dir = proc_mkdir(MPT_PROCFS_MPTBASEDIR, NULL);
6552 if (mpt_proc_root_dir == NULL) 6542 if (mpt_proc_root_dir == NULL)
6553 return -ENOTDIR; 6543 return -ENOTDIR;
6554 6544
6555 ent = create_proc_entry("summary", S_IFREG|S_IRUGO, mpt_proc_root_dir); 6545 proc_create("summary", S_IRUGO, mpt_proc_root_dir, &mpt_summary_proc_fops);
6556 if (ent) 6546 proc_create("version", S_IRUGO, mpt_proc_root_dir, &mpt_version_proc_fops);
6557 ent->read_proc = procmpt_summary_read;
6558
6559 ent = create_proc_entry("version", S_IFREG|S_IRUGO, mpt_proc_root_dir);
6560 if (ent)
6561 ent->read_proc = procmpt_version_read;
6562
6563 return 0; 6547 return 0;
6564} 6548}
6565 6549
@@ -6578,71 +6562,47 @@ procmpt_destroy(void)
6578} 6562}
6579 6563
6580/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6564/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6581/** 6565/*
6582 * procmpt_summary_read - Handle read request of a summary file
6583 * @buf: Pointer to area to write information
6584 * @start: Pointer to start pointer
6585 * @offset: Offset to start writing
6586 * @request: Amount of read data requested
6587 * @eof: Pointer to EOF integer
6588 * @data: Pointer
6589 *
6590 * Handles read request from /proc/mpt/summary or /proc/mpt/iocN/summary. 6566 * Handles read request from /proc/mpt/summary or /proc/mpt/iocN/summary.
6591 * Returns number of characters written to process performing the read.
6592 */ 6567 */
6593static int 6568static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int showlan);
6594procmpt_summary_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
6595{
6596 MPT_ADAPTER *ioc;
6597 char *out = buf;
6598 int len;
6599 6569
6600 if (data) { 6570static int mpt_summary_proc_show(struct seq_file *m, void *v)
6601 int more = 0; 6571{
6602 6572 MPT_ADAPTER *ioc = m->private;
6603 ioc = data;
6604 mpt_print_ioc_summary(ioc, out, &more, 0, 1);
6605 6573
6606 out += more; 6574 if (ioc) {
6575 seq_mpt_print_ioc_summary(ioc, m, 1);
6607 } else { 6576 } else {
6608 list_for_each_entry(ioc, &ioc_list, list) { 6577 list_for_each_entry(ioc, &ioc_list, list) {
6609 int more = 0; 6578 seq_mpt_print_ioc_summary(ioc, m, 1);
6610
6611 mpt_print_ioc_summary(ioc, out, &more, 0, 1);
6612
6613 out += more;
6614 if ((out-buf) >= request)
6615 break;
6616 } 6579 }
6617 } 6580 }
6618 6581
6619 len = out - buf; 6582 return 0;
6583}
6620 6584
6621 MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len); 6585static int mpt_summary_proc_open(struct inode *inode, struct file *file)
6586{
6587 return single_open(file, mpt_summary_proc_show, PDE(inode)->data);
6622} 6588}
6623 6589
6624/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6590static const struct file_operations mpt_summary_proc_fops = {
6625/** 6591 .owner = THIS_MODULE,
6626 * procmpt_version_read - Handle read request from /proc/mpt/version. 6592 .open = mpt_summary_proc_open,
6627 * @buf: Pointer to area to write information 6593 .read = seq_read,
6628 * @start: Pointer to start pointer 6594 .llseek = seq_lseek,
6629 * @offset: Offset to start writing 6595 .release = single_release,
6630 * @request: Amount of read data requested 6596};
6631 * @eof: Pointer to EOF integer 6597
6632 * @data: Pointer 6598static int mpt_version_proc_show(struct seq_file *m, void *v)
6633 *
6634 * Returns number of characters written to process performing the read.
6635 */
6636static int
6637procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
6638{ 6599{
6639 u8 cb_idx; 6600 u8 cb_idx;
6640 int scsi, fc, sas, lan, ctl, targ, dmp; 6601 int scsi, fc, sas, lan, ctl, targ, dmp;
6641 char *drvname; 6602 char *drvname;
6642 int len;
6643 6603
6644 len = sprintf(buf, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON); 6604 seq_printf(m, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON);
6645 len += sprintf(buf+len, " Fusion MPT base driver\n"); 6605 seq_printf(m, " Fusion MPT base driver\n");
6646 6606
6647 scsi = fc = sas = lan = ctl = targ = dmp = 0; 6607 scsi = fc = sas = lan = ctl = targ = dmp = 0;
6648 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) { 6608 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
@@ -6670,98 +6630,97 @@ procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eo
6670 } 6630 }
6671 6631
6672 if (drvname) 6632 if (drvname)
6673 len += sprintf(buf+len, " Fusion MPT %s driver\n", drvname); 6633 seq_printf(m, " Fusion MPT %s driver\n", drvname);
6674 } 6634 }
6675 } 6635 }
6676 6636
6677 MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len); 6637 return 0;
6678} 6638}
6679 6639
6680/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6640static int mpt_version_proc_open(struct inode *inode, struct file *file)
6681/**
6682 * procmpt_iocinfo_read - Handle read request from /proc/mpt/iocN/info.
6683 * @buf: Pointer to area to write information
6684 * @start: Pointer to start pointer
6685 * @offset: Offset to start writing
6686 * @request: Amount of read data requested
6687 * @eof: Pointer to EOF integer
6688 * @data: Pointer
6689 *
6690 * Returns number of characters written to process performing the read.
6691 */
6692static int
6693procmpt_iocinfo_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
6694{ 6641{
6695 MPT_ADAPTER *ioc = data; 6642 return single_open(file, mpt_version_proc_show, NULL);
6696 int len; 6643}
6644
6645static const struct file_operations mpt_version_proc_fops = {
6646 .owner = THIS_MODULE,
6647 .open = mpt_version_proc_open,
6648 .read = seq_read,
6649 .llseek = seq_lseek,
6650 .release = single_release,
6651};
6652
6653static int mpt_iocinfo_proc_show(struct seq_file *m, void *v)
6654{
6655 MPT_ADAPTER *ioc = m->private;
6697 char expVer[32]; 6656 char expVer[32];
6698 int sz; 6657 int sz;
6699 int p; 6658 int p;
6700 6659
6701 mpt_get_fw_exp_ver(expVer, ioc); 6660 mpt_get_fw_exp_ver(expVer, ioc);
6702 6661
6703 len = sprintf(buf, "%s:", ioc->name); 6662 seq_printf(m, "%s:", ioc->name);
6704 if (ioc->facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT) 6663 if (ioc->facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT)
6705 len += sprintf(buf+len, " (f/w download boot flag set)"); 6664 seq_printf(m, " (f/w download boot flag set)");
6706// if (ioc->facts.IOCExceptions & MPI_IOCFACTS_EXCEPT_CONFIG_CHECKSUM_FAIL) 6665// if (ioc->facts.IOCExceptions & MPI_IOCFACTS_EXCEPT_CONFIG_CHECKSUM_FAIL)
6707// len += sprintf(buf+len, " CONFIG_CHECKSUM_FAIL!"); 6666// seq_printf(m, " CONFIG_CHECKSUM_FAIL!");
6708 6667
6709 len += sprintf(buf+len, "\n ProductID = 0x%04x (%s)\n", 6668 seq_printf(m, "\n ProductID = 0x%04x (%s)\n",
6710 ioc->facts.ProductID, 6669 ioc->facts.ProductID,
6711 ioc->prod_name); 6670 ioc->prod_name);
6712 len += sprintf(buf+len, " FWVersion = 0x%08x%s", ioc->facts.FWVersion.Word, expVer); 6671 seq_printf(m, " FWVersion = 0x%08x%s", ioc->facts.FWVersion.Word, expVer);
6713 if (ioc->facts.FWImageSize) 6672 if (ioc->facts.FWImageSize)
6714 len += sprintf(buf+len, " (fw_size=%d)", ioc->facts.FWImageSize); 6673 seq_printf(m, " (fw_size=%d)", ioc->facts.FWImageSize);
6715 len += sprintf(buf+len, "\n MsgVersion = 0x%04x\n", ioc->facts.MsgVersion); 6674 seq_printf(m, "\n MsgVersion = 0x%04x\n", ioc->facts.MsgVersion);
6716 len += sprintf(buf+len, " FirstWhoInit = 0x%02x\n", ioc->FirstWhoInit); 6675 seq_printf(m, " FirstWhoInit = 0x%02x\n", ioc->FirstWhoInit);
6717 len += sprintf(buf+len, " EventState = 0x%02x\n", ioc->facts.EventState); 6676 seq_printf(m, " EventState = 0x%02x\n", ioc->facts.EventState);
6718 6677
6719 len += sprintf(buf+len, " CurrentHostMfaHighAddr = 0x%08x\n", 6678 seq_printf(m, " CurrentHostMfaHighAddr = 0x%08x\n",
6720 ioc->facts.CurrentHostMfaHighAddr); 6679 ioc->facts.CurrentHostMfaHighAddr);
6721 len += sprintf(buf+len, " CurrentSenseBufferHighAddr = 0x%08x\n", 6680 seq_printf(m, " CurrentSenseBufferHighAddr = 0x%08x\n",
6722 ioc->facts.CurrentSenseBufferHighAddr); 6681 ioc->facts.CurrentSenseBufferHighAddr);
6723 6682
6724 len += sprintf(buf+len, " MaxChainDepth = 0x%02x frames\n", ioc->facts.MaxChainDepth); 6683 seq_printf(m, " MaxChainDepth = 0x%02x frames\n", ioc->facts.MaxChainDepth);
6725 len += sprintf(buf+len, " MinBlockSize = 0x%02x bytes\n", 4*ioc->facts.BlockSize); 6684 seq_printf(m, " MinBlockSize = 0x%02x bytes\n", 4*ioc->facts.BlockSize);
6726 6685
6727 len += sprintf(buf+len, " RequestFrames @ 0x%p (Dma @ 0x%p)\n", 6686 seq_printf(m, " RequestFrames @ 0x%p (Dma @ 0x%p)\n",
6728 (void *)ioc->req_frames, (void *)(ulong)ioc->req_frames_dma); 6687 (void *)ioc->req_frames, (void *)(ulong)ioc->req_frames_dma);
6729 /* 6688 /*
6730 * Rounding UP to nearest 4-kB boundary here... 6689 * Rounding UP to nearest 4-kB boundary here...
6731 */ 6690 */
6732 sz = (ioc->req_sz * ioc->req_depth) + 128; 6691 sz = (ioc->req_sz * ioc->req_depth) + 128;
6733 sz = ((sz + 0x1000UL - 1UL) / 0x1000) * 0x1000; 6692 sz = ((sz + 0x1000UL - 1UL) / 0x1000) * 0x1000;
6734 len += sprintf(buf+len, " {CurReqSz=%d} x {CurReqDepth=%d} = %d bytes ^= 0x%x\n", 6693 seq_printf(m, " {CurReqSz=%d} x {CurReqDepth=%d} = %d bytes ^= 0x%x\n",
6735 ioc->req_sz, ioc->req_depth, ioc->req_sz*ioc->req_depth, sz); 6694 ioc->req_sz, ioc->req_depth, ioc->req_sz*ioc->req_depth, sz);
6736 len += sprintf(buf+len, " {MaxReqSz=%d} {MaxReqDepth=%d}\n", 6695 seq_printf(m, " {MaxReqSz=%d} {MaxReqDepth=%d}\n",
6737 4*ioc->facts.RequestFrameSize, 6696 4*ioc->facts.RequestFrameSize,
6738 ioc->facts.GlobalCredits); 6697 ioc->facts.GlobalCredits);
6739 6698
6740 len += sprintf(buf+len, " Frames @ 0x%p (Dma @ 0x%p)\n", 6699 seq_printf(m, " Frames @ 0x%p (Dma @ 0x%p)\n",
6741 (void *)ioc->alloc, (void *)(ulong)ioc->alloc_dma); 6700 (void *)ioc->alloc, (void *)(ulong)ioc->alloc_dma);
6742 sz = (ioc->reply_sz * ioc->reply_depth) + 128; 6701 sz = (ioc->reply_sz * ioc->reply_depth) + 128;
6743 len += sprintf(buf+len, " {CurRepSz=%d} x {CurRepDepth=%d} = %d bytes ^= 0x%x\n", 6702 seq_printf(m, " {CurRepSz=%d} x {CurRepDepth=%d} = %d bytes ^= 0x%x\n",
6744 ioc->reply_sz, ioc->reply_depth, ioc->reply_sz*ioc->reply_depth, sz); 6703 ioc->reply_sz, ioc->reply_depth, ioc->reply_sz*ioc->reply_depth, sz);
6745 len += sprintf(buf+len, " {MaxRepSz=%d} {MaxRepDepth=%d}\n", 6704 seq_printf(m, " {MaxRepSz=%d} {MaxRepDepth=%d}\n",
6746 ioc->facts.CurReplyFrameSize, 6705 ioc->facts.CurReplyFrameSize,
6747 ioc->facts.ReplyQueueDepth); 6706 ioc->facts.ReplyQueueDepth);
6748 6707
6749 len += sprintf(buf+len, " MaxDevices = %d\n", 6708 seq_printf(m, " MaxDevices = %d\n",
6750 (ioc->facts.MaxDevices==0) ? 255 : ioc->facts.MaxDevices); 6709 (ioc->facts.MaxDevices==0) ? 255 : ioc->facts.MaxDevices);
6751 len += sprintf(buf+len, " MaxBuses = %d\n", ioc->facts.MaxBuses); 6710 seq_printf(m, " MaxBuses = %d\n", ioc->facts.MaxBuses);
6752 6711
6753 /* per-port info */ 6712 /* per-port info */
6754 for (p=0; p < ioc->facts.NumberOfPorts; p++) { 6713 for (p=0; p < ioc->facts.NumberOfPorts; p++) {
6755 len += sprintf(buf+len, " PortNumber = %d (of %d)\n", 6714 seq_printf(m, " PortNumber = %d (of %d)\n",
6756 p+1, 6715 p+1,
6757 ioc->facts.NumberOfPorts); 6716 ioc->facts.NumberOfPorts);
6758 if (ioc->bus_type == FC) { 6717 if (ioc->bus_type == FC) {
6759 if (ioc->pfacts[p].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) { 6718 if (ioc->pfacts[p].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) {
6760 u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow; 6719 u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
6761 len += sprintf(buf+len, " LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n", 6720 seq_printf(m, " LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n",
6762 a[5], a[4], a[3], a[2], a[1], a[0]); 6721 a[5], a[4], a[3], a[2], a[1], a[0]);
6763 } 6722 }
6764 len += sprintf(buf+len, " WWN = %08X%08X:%08X%08X\n", 6723 seq_printf(m, " WWN = %08X%08X:%08X%08X\n",
6765 ioc->fc_port_page0[p].WWNN.High, 6724 ioc->fc_port_page0[p].WWNN.High,
6766 ioc->fc_port_page0[p].WWNN.Low, 6725 ioc->fc_port_page0[p].WWNN.Low,
6767 ioc->fc_port_page0[p].WWPN.High, 6726 ioc->fc_port_page0[p].WWPN.High,
@@ -6769,9 +6728,21 @@ procmpt_iocinfo_read(char *buf, char **start, off_t offset, int request, int *eo
6769 } 6728 }
6770 } 6729 }
6771 6730
6772 MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len); 6731 return 0;
6732}
6733
6734static int mpt_iocinfo_proc_open(struct inode *inode, struct file *file)
6735{
6736 return single_open(file, mpt_iocinfo_proc_show, PDE(inode)->data);
6773} 6737}
6774 6738
6739static const struct file_operations mpt_iocinfo_proc_fops = {
6740 .owner = THIS_MODULE,
6741 .open = mpt_iocinfo_proc_open,
6742 .read = seq_read,
6743 .llseek = seq_lseek,
6744 .release = single_release,
6745};
6775#endif /* CONFIG_PROC_FS } */ 6746#endif /* CONFIG_PROC_FS } */
6776 6747
6777/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6748/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -6837,6 +6808,39 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh
6837 6808
6838 *size = y; 6809 *size = y;
6839} 6810}
6811
6812static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int showlan)
6813{
6814 char expVer[32];
6815
6816 mpt_get_fw_exp_ver(expVer, ioc);
6817
6818 /*
6819 * Shorter summary of attached ioc's...
6820 */
6821 seq_printf(m, "%s: %s, %s%08xh%s, Ports=%d, MaxQ=%d",
6822 ioc->name,
6823 ioc->prod_name,
6824 MPT_FW_REV_MAGIC_ID_STRING, /* "FwRev=" or somesuch */
6825 ioc->facts.FWVersion.Word,
6826 expVer,
6827 ioc->facts.NumberOfPorts,
6828 ioc->req_depth);
6829
6830 if (showlan && (ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN)) {
6831 u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
6832 seq_printf(m, ", LanAddr=%02X:%02X:%02X:%02X:%02X:%02X",
6833 a[5], a[4], a[3], a[2], a[1], a[0]);
6834 }
6835
6836 seq_printf(m, ", IRQ=%d", ioc->pci_irq);
6837
6838 if (!ioc->active)
6839 seq_printf(m, " (disabled)");
6840
6841 seq_putc(m, '\n');
6842}
6843
6840/** 6844/**
6841 * mpt_set_taskmgmt_in_progress_flag - set flags associated with task management 6845 * mpt_set_taskmgmt_in_progress_flag - set flags associated with task management
6842 * @ioc: Pointer to MPT_ADAPTER structure 6846 * @ioc: Pointer to MPT_ADAPTER structure
@@ -6922,7 +6926,6 @@ EXPORT_SYMBOL(mpt_halt_firmware);
6922 * mpt_SoftResetHandler - Issues a less expensive reset 6926 * mpt_SoftResetHandler - Issues a less expensive reset
6923 * @ioc: Pointer to MPT_ADAPTER structure 6927 * @ioc: Pointer to MPT_ADAPTER structure
6924 * @sleepFlag: Indicates if sleep or schedule must be called. 6928 * @sleepFlag: Indicates if sleep or schedule must be called.
6925
6926 * 6929 *
6927 * Returns 0 for SUCCESS or -1 if FAILED. 6930 * Returns 0 for SUCCESS or -1 if FAILED.
6928 * 6931 *
@@ -7067,7 +7070,6 @@ mpt_SoftResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
7067 * mpt_Soft_Hard_ResetHandler - Try less expensive reset 7070 * mpt_Soft_Hard_ResetHandler - Try less expensive reset
7068 * @ioc: Pointer to MPT_ADAPTER structure 7071 * @ioc: Pointer to MPT_ADAPTER structure
7069 * @sleepFlag: Indicates if sleep or schedule must be called. 7072 * @sleepFlag: Indicates if sleep or schedule must be called.
7070
7071 * 7073 *
7072 * Returns 0 for SUCCESS or -1 if FAILED. 7074 * Returns 0 for SUCCESS or -1 if FAILED.
7073 * Try for softreset first, only if it fails go for expensive 7075 * Try for softreset first, only if it fails go for expensive
@@ -8004,6 +8006,7 @@ mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info)
8004 * mpt_sas_log_info - Log information returned from SAS IOC. 8006 * mpt_sas_log_info - Log information returned from SAS IOC.
8005 * @ioc: Pointer to MPT_ADAPTER structure 8007 * @ioc: Pointer to MPT_ADAPTER structure
8006 * @log_info: U32 LogInfo reply word from the IOC 8008 * @log_info: U32 LogInfo reply word from the IOC
8009 * @cb_idx: callback function's handle
8007 * 8010 *
8008 * Refer to lsi/mpi_log_sas.h. 8011 * Refer to lsi/mpi_log_sas.h.
8009 **/ 8012 **/
@@ -8050,7 +8053,7 @@ union loginfo_type {
8050 code_desc = ir_code_str[sas_loginfo.dw.code]; 8053 code_desc = ir_code_str[sas_loginfo.dw.code];
8051 if (sas_loginfo.dw.subcode >= 8054 if (sas_loginfo.dw.subcode >=
8052 ARRAY_SIZE(raid_sub_code_str)) 8055 ARRAY_SIZE(raid_sub_code_str))
8053 break; 8056 break;
8054 if (sas_loginfo.dw.code == 0) 8057 if (sas_loginfo.dw.code == 0)
8055 sub_code_desc = 8058 sub_code_desc =
8056 raid_sub_code_str[sas_loginfo.dw.subcode]; 8059 raid_sub_code_str[sas_loginfo.dw.subcode];
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 23ed3dec72a5..f71f22948477 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -420,31 +420,6 @@ typedef struct _VirtDevice {
420#define MPT_TARGET_FLAGS_LED_ON 0x80 420#define MPT_TARGET_FLAGS_LED_ON 0x80
421 421
422/* 422/*
423 * /proc/mpt interface
424 */
425typedef struct {
426 const char *name;
427 mode_t mode;
428 int pad;
429 read_proc_t *read_proc;
430 write_proc_t *write_proc;
431} mpt_proc_entry_t;
432
433#define MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len) \
434do { \
435 len -= offset; \
436 if (len < request) { \
437 *eof = 1; \
438 if (len <= 0) \
439 return 0; \
440 } else \
441 len = request; \
442 *start = buf + offset; \
443 return len; \
444} while (0)
445
446
447/*
448 * IOCTL structure and associated defines 423 * IOCTL structure and associated defines
449 */ 424 */
450 425
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index d8ddfdf8be14..a3856ed90aef 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -54,7 +54,7 @@
54#include <linux/pci.h> 54#include <linux/pci.h>
55#include <linux/delay.h> /* for mdelay */ 55#include <linux/delay.h> /* for mdelay */
56#include <linux/miscdevice.h> 56#include <linux/miscdevice.h>
57#include <linux/smp_lock.h> 57#include <linux/mutex.h>
58#include <linux/compat.h> 58#include <linux/compat.h>
59 59
60#include <asm/io.h> 60#include <asm/io.h>
@@ -83,6 +83,7 @@ MODULE_VERSION(my_VERSION);
83 83
84/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 84/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
85 85
86static DEFINE_MUTEX(mpctl_mutex);
86static u8 mptctl_id = MPT_MAX_PROTOCOL_DRIVERS; 87static u8 mptctl_id = MPT_MAX_PROTOCOL_DRIVERS;
87static u8 mptctl_taskmgmt_id = MPT_MAX_PROTOCOL_DRIVERS; 88static u8 mptctl_taskmgmt_id = MPT_MAX_PROTOCOL_DRIVERS;
88 89
@@ -601,12 +602,12 @@ mptctl_fasync(int fd, struct file *filep, int mode)
601 MPT_ADAPTER *ioc; 602 MPT_ADAPTER *ioc;
602 int ret; 603 int ret;
603 604
604 lock_kernel(); 605 mutex_lock(&mpctl_mutex);
605 list_for_each_entry(ioc, &ioc_list, list) 606 list_for_each_entry(ioc, &ioc_list, list)
606 ioc->aen_event_read_flag=0; 607 ioc->aen_event_read_flag=0;
607 608
608 ret = fasync_helper(fd, filep, mode, &async_queue); 609 ret = fasync_helper(fd, filep, mode, &async_queue);
609 unlock_kernel(); 610 mutex_unlock(&mpctl_mutex);
610 return ret; 611 return ret;
611} 612}
612 613
@@ -698,9 +699,9 @@ static long
698mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 699mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
699{ 700{
700 long ret; 701 long ret;
701 lock_kernel(); 702 mutex_lock(&mpctl_mutex);
702 ret = __mptctl_ioctl(file, cmd, arg); 703 ret = __mptctl_ioctl(file, cmd, arg);
703 unlock_kernel(); 704 mutex_unlock(&mpctl_mutex);
704 return ret; 705 return ret;
705} 706}
706 707
@@ -2926,7 +2927,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd,
2926static long compat_mpctl_ioctl(struct file *f, unsigned int cmd, unsigned long arg) 2927static long compat_mpctl_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
2927{ 2928{
2928 long ret; 2929 long ret;
2929 lock_kernel(); 2930 mutex_lock(&mpctl_mutex);
2930 switch (cmd) { 2931 switch (cmd) {
2931 case MPTIOCINFO: 2932 case MPTIOCINFO:
2932 case MPTIOCINFO1: 2933 case MPTIOCINFO1:
@@ -2951,7 +2952,7 @@ static long compat_mpctl_ioctl(struct file *f, unsigned int cmd, unsigned long a
2951 ret = -ENOIOCTLCMD; 2952 ret = -ENOIOCTLCMD;
2952 break; 2953 break;
2953 } 2954 }
2954 unlock_kernel(); 2955 mutex_unlock(&mpctl_mutex);
2955 return ret; 2956 return ret;
2956} 2957}
2957 2958
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index e15220ff52fc..d784c36707c0 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -97,8 +97,7 @@ static u8 mptfcInternalCtx = MPT_MAX_PROTOCOL_DRIVERS;
97 97
98static int mptfc_target_alloc(struct scsi_target *starget); 98static int mptfc_target_alloc(struct scsi_target *starget);
99static int mptfc_slave_alloc(struct scsi_device *sdev); 99static int mptfc_slave_alloc(struct scsi_device *sdev);
100static int mptfc_qcmd(struct scsi_cmnd *SCpnt, 100static int mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt);
101 void (*done)(struct scsi_cmnd *));
102static void mptfc_target_destroy(struct scsi_target *starget); 101static void mptfc_target_destroy(struct scsi_target *starget);
103static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout); 102static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout);
104static void __devexit mptfc_remove(struct pci_dev *pdev); 103static void __devexit mptfc_remove(struct pci_dev *pdev);
@@ -650,7 +649,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
650} 649}
651 650
652static int 651static int
653mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 652mptfc_qcmd_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
654{ 653{
655 struct mptfc_rport_info *ri; 654 struct mptfc_rport_info *ri;
656 struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device)); 655 struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device));
@@ -681,6 +680,8 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
681 return mptscsih_qcmd(SCpnt,done); 680 return mptscsih_qcmd(SCpnt,done);
682} 681}
683 682
683static DEF_SCSI_QCMD(mptfc_qcmd)
684
684/* 685/*
685 * mptfc_display_port_link_speed - displaying link speed 686 * mptfc_display_port_link_speed - displaying link speed
686 * @ioc: Pointer to MPT_ADAPTER structure 687 * @ioc: Pointer to MPT_ADAPTER structure
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 83a5115f0251..d48c2c6058e1 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1889,7 +1889,7 @@ mptsas_slave_alloc(struct scsi_device *sdev)
1889} 1889}
1890 1890
1891static int 1891static int
1892mptsas_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 1892mptsas_qcmd_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
1893{ 1893{
1894 MPT_SCSI_HOST *hd; 1894 MPT_SCSI_HOST *hd;
1895 MPT_ADAPTER *ioc; 1895 MPT_ADAPTER *ioc;
@@ -1913,6 +1913,8 @@ mptsas_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
1913 return mptscsih_qcmd(SCpnt,done); 1913 return mptscsih_qcmd(SCpnt,done);
1914} 1914}
1915 1915
1916static DEF_SCSI_QCMD(mptsas_qcmd)
1917
1916/** 1918/**
1917 * mptsas_mptsas_eh_timed_out - resets the scsi_cmnd timeout 1919 * mptsas_mptsas_eh_timed_out - resets the scsi_cmnd timeout
1918 * if the device under question is currently in the 1920 * if the device under question is currently in the
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 0e2803155ae2..6d9568d2ec59 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -780,7 +780,7 @@ static int mptspi_slave_configure(struct scsi_device *sdev)
780} 780}
781 781
782static int 782static int
783mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 783mptspi_qcmd_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
784{ 784{
785 struct _MPT_SCSI_HOST *hd = shost_priv(SCpnt->device->host); 785 struct _MPT_SCSI_HOST *hd = shost_priv(SCpnt->device->host);
786 VirtDevice *vdevice = SCpnt->device->hostdata; 786 VirtDevice *vdevice = SCpnt->device->hostdata;
@@ -805,6 +805,8 @@ mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
805 return mptscsih_qcmd(SCpnt,done); 805 return mptscsih_qcmd(SCpnt,done);
806} 806}
807 807
808static DEF_SCSI_QCMD(mptspi_qcmd)
809
808static void mptspi_slave_destroy(struct scsi_device *sdev) 810static void mptspi_slave_destroy(struct scsi_device *sdev)
809{ 811{
810 struct scsi_target *starget = scsi_target(sdev); 812 struct scsi_target *starget = scsi_target(sdev);
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c
index 06c655c55587..a3970e56ae53 100644
--- a/drivers/message/i2o/exec-osm.c
+++ b/drivers/message/i2o/exec-osm.c
@@ -389,12 +389,16 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
389 dev = &c->pdev->dev; 389 dev = &c->pdev->dev;
390 390
391 if (i2o_dma_realloc(dev, &c->dlct, 391 if (i2o_dma_realloc(dev, &c->dlct,
392 le32_to_cpu(sb->expected_lct_size))) 392 le32_to_cpu(sb->expected_lct_size))) {
393 mutex_unlock(&c->lct_lock);
393 return -ENOMEM; 394 return -ENOMEM;
395 }
394 396
395 msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET); 397 msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
396 if (IS_ERR(msg)) 398 if (IS_ERR(msg)) {
399 mutex_unlock(&c->lct_lock);
397 return PTR_ERR(msg); 400 return PTR_ERR(msg);
401 }
398 402
399 msg->u.head[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6); 403 msg->u.head[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6);
400 msg->u.head[1] = cpu_to_le32(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 | 404 msg->u.head[1] = cpu_to_le32(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 |
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index fc593fbab696..f87a9d405a5e 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -53,6 +53,7 @@
53#include <linux/module.h> 53#include <linux/module.h>
54#include <linux/slab.h> 54#include <linux/slab.h>
55#include <linux/i2o.h> 55#include <linux/i2o.h>
56#include <linux/mutex.h>
56 57
57#include <linux/mempool.h> 58#include <linux/mempool.h>
58 59
@@ -68,6 +69,7 @@
68#define OSM_VERSION "1.325" 69#define OSM_VERSION "1.325"
69#define OSM_DESCRIPTION "I2O Block Device OSM" 70#define OSM_DESCRIPTION "I2O Block Device OSM"
70 71
72static DEFINE_MUTEX(i2o_block_mutex);
71static struct i2o_driver i2o_block_driver; 73static struct i2o_driver i2o_block_driver;
72 74
73/* global Block OSM request mempool */ 75/* global Block OSM request mempool */
@@ -577,6 +579,7 @@ static int i2o_block_open(struct block_device *bdev, fmode_t mode)
577 if (!dev->i2o_dev) 579 if (!dev->i2o_dev)
578 return -ENODEV; 580 return -ENODEV;
579 581
582 mutex_lock(&i2o_block_mutex);
580 if (dev->power > 0x1f) 583 if (dev->power > 0x1f)
581 i2o_block_device_power(dev, 0x02); 584 i2o_block_device_power(dev, 0x02);
582 585
@@ -585,6 +588,7 @@ static int i2o_block_open(struct block_device *bdev, fmode_t mode)
585 i2o_block_device_lock(dev->i2o_dev, -1); 588 i2o_block_device_lock(dev->i2o_dev, -1);
586 589
587 osm_debug("Ready.\n"); 590 osm_debug("Ready.\n");
591 mutex_unlock(&i2o_block_mutex);
588 592
589 return 0; 593 return 0;
590}; 594};
@@ -615,6 +619,7 @@ static int i2o_block_release(struct gendisk *disk, fmode_t mode)
615 if (!dev->i2o_dev) 619 if (!dev->i2o_dev)
616 return 0; 620 return 0;
617 621
622 mutex_lock(&i2o_block_mutex);
618 i2o_block_device_flush(dev->i2o_dev); 623 i2o_block_device_flush(dev->i2o_dev);
619 624
620 i2o_block_device_unlock(dev->i2o_dev, -1); 625 i2o_block_device_unlock(dev->i2o_dev, -1);
@@ -625,6 +630,7 @@ static int i2o_block_release(struct gendisk *disk, fmode_t mode)
625 operation = 0x24; 630 operation = 0x24;
626 631
627 i2o_block_device_power(dev, operation); 632 i2o_block_device_power(dev, operation);
633 mutex_unlock(&i2o_block_mutex);
628 634
629 return 0; 635 return 0;
630} 636}
@@ -652,30 +658,40 @@ static int i2o_block_ioctl(struct block_device *bdev, fmode_t mode,
652{ 658{
653 struct gendisk *disk = bdev->bd_disk; 659 struct gendisk *disk = bdev->bd_disk;
654 struct i2o_block_device *dev = disk->private_data; 660 struct i2o_block_device *dev = disk->private_data;
661 int ret = -ENOTTY;
655 662
656 /* Anyone capable of this syscall can do *real bad* things */ 663 /* Anyone capable of this syscall can do *real bad* things */
657 664
658 if (!capable(CAP_SYS_ADMIN)) 665 if (!capable(CAP_SYS_ADMIN))
659 return -EPERM; 666 return -EPERM;
660 667
668 mutex_lock(&i2o_block_mutex);
661 switch (cmd) { 669 switch (cmd) {
662 case BLKI2OGRSTRAT: 670 case BLKI2OGRSTRAT:
663 return put_user(dev->rcache, (int __user *)arg); 671 ret = put_user(dev->rcache, (int __user *)arg);
672 break;
664 case BLKI2OGWSTRAT: 673 case BLKI2OGWSTRAT:
665 return put_user(dev->wcache, (int __user *)arg); 674 ret = put_user(dev->wcache, (int __user *)arg);
675 break;
666 case BLKI2OSRSTRAT: 676 case BLKI2OSRSTRAT:
677 ret = -EINVAL;
667 if (arg < 0 || arg > CACHE_SMARTFETCH) 678 if (arg < 0 || arg > CACHE_SMARTFETCH)
668 return -EINVAL; 679 break;
669 dev->rcache = arg; 680 dev->rcache = arg;
681 ret = 0;
670 break; 682 break;
671 case BLKI2OSWSTRAT: 683 case BLKI2OSWSTRAT:
684 ret = -EINVAL;
672 if (arg != 0 685 if (arg != 0
673 && (arg < CACHE_WRITETHROUGH || arg > CACHE_SMARTBACK)) 686 && (arg < CACHE_WRITETHROUGH || arg > CACHE_SMARTBACK))
674 return -EINVAL; 687 break;
675 dev->wcache = arg; 688 dev->wcache = arg;
689 ret = 0;
676 break; 690 break;
677 } 691 }
678 return -ENOTTY; 692 mutex_unlock(&i2o_block_mutex);
693
694 return ret;
679}; 695};
680 696
681/** 697/**
@@ -712,7 +728,7 @@ static int i2o_block_transfer(struct request *req)
712{ 728{
713 struct i2o_block_device *dev = req->rq_disk->private_data; 729 struct i2o_block_device *dev = req->rq_disk->private_data;
714 struct i2o_controller *c; 730 struct i2o_controller *c;
715 u32 tid = dev->i2o_dev->lct_data.tid; 731 u32 tid;
716 struct i2o_message *msg; 732 struct i2o_message *msg;
717 u32 *mptr; 733 u32 *mptr;
718 struct i2o_block_request *ireq = req->special; 734 struct i2o_block_request *ireq = req->special;
@@ -728,6 +744,7 @@ static int i2o_block_transfer(struct request *req)
728 goto exit; 744 goto exit;
729 } 745 }
730 746
747 tid = dev->i2o_dev->lct_data.tid;
731 c = dev->i2o_dev->iop; 748 c = dev->i2o_dev->iop;
732 749
733 msg = i2o_msg_get(c); 750 msg = i2o_msg_get(c);
@@ -883,7 +900,7 @@ static void i2o_block_request_fn(struct request_queue *q)
883 if (!req) 900 if (!req)
884 break; 901 break;
885 902
886 if (blk_fs_request(req)) { 903 if (req->cmd_type == REQ_TYPE_FS) {
887 struct i2o_block_delayed_request *dreq; 904 struct i2o_block_delayed_request *dreq;
888 struct i2o_block_request *ireq = req->special; 905 struct i2o_block_request *ireq = req->special;
889 unsigned int queue_depth; 906 unsigned int queue_depth;
@@ -930,7 +947,8 @@ static const struct block_device_operations i2o_block_fops = {
930 .owner = THIS_MODULE, 947 .owner = THIS_MODULE,
931 .open = i2o_block_open, 948 .open = i2o_block_open,
932 .release = i2o_block_release, 949 .release = i2o_block_release,
933 .locked_ioctl = i2o_block_ioctl, 950 .ioctl = i2o_block_ioctl,
951 .compat_ioctl = i2o_block_ioctl,
934 .getgeo = i2o_block_getgeo, 952 .getgeo = i2o_block_getgeo,
935 .media_changed = i2o_block_media_changed 953 .media_changed = i2o_block_media_changed
936}; 954};
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
index c4b117f5fb70..7d3cc575c361 100644
--- a/drivers/message/i2o/i2o_config.c
+++ b/drivers/message/i2o/i2o_config.c
@@ -31,7 +31,7 @@
31 */ 31 */
32 32
33#include <linux/miscdevice.h> 33#include <linux/miscdevice.h>
34#include <linux/smp_lock.h> 34#include <linux/mutex.h>
35#include <linux/compat.h> 35#include <linux/compat.h>
36#include <linux/slab.h> 36#include <linux/slab.h>
37 37
@@ -41,6 +41,7 @@
41 41
42#define SG_TABLESIZE 30 42#define SG_TABLESIZE 30
43 43
44static DEFINE_MUTEX(i2o_cfg_mutex);
44static long i2o_cfg_ioctl(struct file *, unsigned int, unsigned long); 45static long i2o_cfg_ioctl(struct file *, unsigned int, unsigned long);
45 46
46static spinlock_t i2o_config_lock; 47static spinlock_t i2o_config_lock;
@@ -111,11 +112,11 @@ static int i2o_cfg_gethrt(unsigned long arg)
111 112
112 len = 8 + ((hrt->entry_len * hrt->num_entries) << 2); 113 len = 8 + ((hrt->entry_len * hrt->num_entries) << 2);
113 114
114 /* We did a get user...so assuming mem is ok...is this bad? */ 115 if (put_user(len, kcmd.reslen))
115 put_user(len, kcmd.reslen); 116 ret = -EFAULT;
116 if (len > reslen) 117 else if (len > reslen)
117 ret = -ENOBUFS; 118 ret = -ENOBUFS;
118 if (copy_to_user(kcmd.resbuf, (void *)hrt, len)) 119 else if (copy_to_user(kcmd.resbuf, (void *)hrt, len))
119 ret = -EFAULT; 120 ret = -EFAULT;
120 121
121 return ret; 122 return ret;
@@ -147,8 +148,9 @@ static int i2o_cfg_getlct(unsigned long arg)
147 lct = (i2o_lct *) c->lct; 148 lct = (i2o_lct *) c->lct;
148 149
149 len = (unsigned int)lct->table_size << 2; 150 len = (unsigned int)lct->table_size << 2;
150 put_user(len, kcmd.reslen); 151 if (put_user(len, kcmd.reslen))
151 if (len > reslen) 152 ret = -EFAULT;
153 else if (len > reslen)
152 ret = -ENOBUFS; 154 ret = -ENOBUFS;
153 else if (copy_to_user(kcmd.resbuf, lct, len)) 155 else if (copy_to_user(kcmd.resbuf, lct, len))
154 ret = -EFAULT; 156 ret = -EFAULT;
@@ -208,8 +210,9 @@ static int i2o_cfg_parms(unsigned long arg, unsigned int type)
208 return -EAGAIN; 210 return -EAGAIN;
209 } 211 }
210 212
211 put_user(len, kcmd.reslen); 213 if (put_user(len, kcmd.reslen))
212 if (len > reslen) 214 ret = -EFAULT;
215 else if (len > reslen)
213 ret = -ENOBUFS; 216 ret = -ENOBUFS;
214 else if (copy_to_user(kcmd.resbuf, res, len)) 217 else if (copy_to_user(kcmd.resbuf, res, len))
215 ret = -EFAULT; 218 ret = -EFAULT;
@@ -739,7 +742,7 @@ static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd,
739 unsigned long arg) 742 unsigned long arg)
740{ 743{
741 int ret; 744 int ret;
742 lock_kernel(); 745 mutex_lock(&i2o_cfg_mutex);
743 switch (cmd) { 746 switch (cmd) {
744 case I2OGETIOPS: 747 case I2OGETIOPS:
745 ret = i2o_cfg_ioctl(file, cmd, arg); 748 ret = i2o_cfg_ioctl(file, cmd, arg);
@@ -751,7 +754,7 @@ static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd,
751 ret = -ENOIOCTLCMD; 754 ret = -ENOIOCTLCMD;
752 break; 755 break;
753 } 756 }
754 unlock_kernel(); 757 mutex_unlock(&i2o_cfg_mutex);
755 return ret; 758 return ret;
756} 759}
757 760
@@ -979,7 +982,7 @@ static long i2o_cfg_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
979{ 982{
980 int ret; 983 int ret;
981 984
982 lock_kernel(); 985 mutex_lock(&i2o_cfg_mutex);
983 switch (cmd) { 986 switch (cmd) {
984 case I2OGETIOPS: 987 case I2OGETIOPS:
985 ret = i2o_cfg_getiops(arg); 988 ret = i2o_cfg_getiops(arg);
@@ -1035,7 +1038,7 @@ static long i2o_cfg_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
1035 osm_debug("unknown ioctl called!\n"); 1038 osm_debug("unknown ioctl called!\n");
1036 ret = -EINVAL; 1039 ret = -EINVAL;
1037 } 1040 }
1038 unlock_kernel(); 1041 mutex_unlock(&i2o_cfg_mutex);
1039 return ret; 1042 return ret;
1040} 1043}
1041 1044
@@ -1049,7 +1052,7 @@ static int cfg_open(struct inode *inode, struct file *file)
1049 if (!tmp) 1052 if (!tmp)
1050 return -ENOMEM; 1053 return -ENOMEM;
1051 1054
1052 lock_kernel(); 1055 mutex_lock(&i2o_cfg_mutex);
1053 file->private_data = (void *)(i2o_cfg_info_id++); 1056 file->private_data = (void *)(i2o_cfg_info_id++);
1054 tmp->fp = file; 1057 tmp->fp = file;
1055 tmp->fasync = NULL; 1058 tmp->fasync = NULL;
@@ -1063,7 +1066,7 @@ static int cfg_open(struct inode *inode, struct file *file)
1063 spin_lock_irqsave(&i2o_config_lock, flags); 1066 spin_lock_irqsave(&i2o_config_lock, flags);
1064 open_files = tmp; 1067 open_files = tmp;
1065 spin_unlock_irqrestore(&i2o_config_lock, flags); 1068 spin_unlock_irqrestore(&i2o_config_lock, flags);
1066 unlock_kernel(); 1069 mutex_unlock(&i2o_cfg_mutex);
1067 1070
1068 return 0; 1071 return 0;
1069} 1072}
@@ -1074,14 +1077,14 @@ static int cfg_fasync(int fd, struct file *fp, int on)
1074 struct i2o_cfg_info *p; 1077 struct i2o_cfg_info *p;
1075 int ret = -EBADF; 1078 int ret = -EBADF;
1076 1079
1077 lock_kernel(); 1080 mutex_lock(&i2o_cfg_mutex);
1078 for (p = open_files; p; p = p->next) 1081 for (p = open_files; p; p = p->next)
1079 if (p->q_id == id) 1082 if (p->q_id == id)
1080 break; 1083 break;
1081 1084
1082 if (p) 1085 if (p)
1083 ret = fasync_helper(fd, fp, on, &p->fasync); 1086 ret = fasync_helper(fd, fp, on, &p->fasync);
1084 unlock_kernel(); 1087 mutex_unlock(&i2o_cfg_mutex);
1085 return ret; 1088 return ret;
1086} 1089}
1087 1090
@@ -1091,7 +1094,7 @@ static int cfg_release(struct inode *inode, struct file *file)
1091 struct i2o_cfg_info *p, **q; 1094 struct i2o_cfg_info *p, **q;
1092 unsigned long flags; 1095 unsigned long flags;
1093 1096
1094 lock_kernel(); 1097 mutex_lock(&i2o_cfg_mutex);
1095 spin_lock_irqsave(&i2o_config_lock, flags); 1098 spin_lock_irqsave(&i2o_config_lock, flags);
1096 for (q = &open_files; (p = *q) != NULL; q = &p->next) { 1099 for (q = &open_files; (p = *q) != NULL; q = &p->next) {
1097 if (p->q_id == id) { 1100 if (p->q_id == id) {
@@ -1101,7 +1104,7 @@ static int cfg_release(struct inode *inode, struct file *file)
1101 } 1104 }
1102 } 1105 }
1103 spin_unlock_irqrestore(&i2o_config_lock, flags); 1106 spin_unlock_irqrestore(&i2o_config_lock, flags);
1104 unlock_kernel(); 1107 mutex_unlock(&i2o_cfg_mutex);
1105 1108
1106 return 0; 1109 return 0;
1107} 1110}
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
index 3d45817e6dcd..97bdf82ec905 100644
--- a/drivers/message/i2o/i2o_scsi.c
+++ b/drivers/message/i2o/i2o_scsi.c
@@ -506,7 +506,7 @@ static struct i2o_driver i2o_scsi_driver = {
506 * Locks: takes the controller lock on error path only 506 * Locks: takes the controller lock on error path only
507 */ 507 */
508 508
509static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt, 509static int i2o_scsi_queuecommand_lck(struct scsi_cmnd *SCpnt,
510 void (*done) (struct scsi_cmnd *)) 510 void (*done) (struct scsi_cmnd *))
511{ 511{
512 struct i2o_controller *c; 512 struct i2o_controller *c;
@@ -528,7 +528,6 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
528 * Do the incoming paperwork 528 * Do the incoming paperwork
529 */ 529 */
530 i2o_dev = SCpnt->device->hostdata; 530 i2o_dev = SCpnt->device->hostdata;
531 c = i2o_dev->iop;
532 531
533 SCpnt->scsi_done = done; 532 SCpnt->scsi_done = done;
534 533
@@ -538,7 +537,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
538 done(SCpnt); 537 done(SCpnt);
539 goto exit; 538 goto exit;
540 } 539 }
541 540 c = i2o_dev->iop;
542 tid = i2o_dev->lct_data.tid; 541 tid = i2o_dev->lct_data.tid;
543 542
544 osm_debug("qcmd: Tid = %03x\n", tid); 543 osm_debug("qcmd: Tid = %03x\n", tid);
@@ -689,7 +688,9 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
689 688
690 exit: 689 exit:
691 return rc; 690 return rc;
692}; 691}
692
693static DEF_SCSI_QCMD(i2o_scsi_queuecommand)
693 694
694/** 695/**
695 * i2o_scsi_abort - abort a running command 696 * i2o_scsi_abort - abort a running command