summaryrefslogtreecommitdiff
path: root/drivers/message
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/mptbase.c4
-rw-r--r--drivers/message/fusion/mptctl.c8
-rw-r--r--drivers/message/fusion/mptfc.c2
-rw-r--r--drivers/message/fusion/mptsas.c2
-rw-r--r--drivers/message/fusion/mptscsih.c98
-rw-r--r--drivers/message/fusion/mptscsih.h2
-rw-r--r--drivers/message/fusion/mptspi.c2
-rw-r--r--drivers/message/i2o/i2o_block.c8
-rw-r--r--drivers/message/i2o/i2o_config.c10
-rw-r--r--drivers/message/i2o/i2o_proc.c97
10 files changed, 47 insertions, 186 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index fb69baa06ca8..767ff4d839f4 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -6656,7 +6656,7 @@ static int mpt_summary_proc_show(struct seq_file *m, void *v)
static int mpt_summary_proc_open(struct inode *inode, struct file *file)
{
- return single_open(file, mpt_summary_proc_show, PDE(inode)->data);
+ return single_open(file, mpt_summary_proc_show, PDE_DATA(inode));
}
static const struct file_operations mpt_summary_proc_fops = {
@@ -6805,7 +6805,7 @@ static int mpt_iocinfo_proc_show(struct seq_file *m, void *v)
static int mpt_iocinfo_proc_open(struct inode *inode, struct file *file)
{
- return single_open(file, mpt_iocinfo_proc_show, PDE(inode)->data);
+ return single_open(file, mpt_iocinfo_proc_show, PDE_DATA(inode));
}
static const struct file_operations mpt_iocinfo_proc_fops = {
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index b383b6961e59..dcc8385adeb3 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -597,13 +597,6 @@ mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
}
static int
-mptctl_release(struct inode *inode, struct file *filep)
-{
- fasync_helper(-1, filep, 0, &async_queue);
- return 0;
-}
-
-static int
mptctl_fasync(int fd, struct file *filep, int mode)
{
MPT_ADAPTER *ioc;
@@ -2822,7 +2815,6 @@ static const struct file_operations mptctl_fops = {
.llseek = no_llseek,
.fasync = mptctl_fasync,
.unlocked_ioctl = mptctl_ioctl,
- .release = mptctl_release,
#ifdef CONFIG_COMPAT
.compat_ioctl = compat_mpctl_ioctl,
#endif
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index c13cd9bc590b..fd75108c355e 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -109,7 +109,7 @@ static int mptfc_host_reset(struct scsi_cmnd *SCpnt);
static struct scsi_host_template mptfc_driver_template = {
.module = THIS_MODULE,
.proc_name = "mptfc",
- .proc_info = mptscsih_proc_info,
+ .show_info = mptscsih_show_info,
.name = "MPT FC Host",
.info = mptscsih_info,
.queuecommand = mptfc_qcmd,
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 2bb01546df0b..dd239bdbfcb4 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1977,7 +1977,7 @@ done:
static struct scsi_host_template mptsas_driver_template = {
.module = THIS_MODULE,
.proc_name = "mptsas",
- .proc_info = mptscsih_proc_info,
+ .show_info = mptscsih_show_info,
.name = "MPT SAS Host",
.info = mptscsih_info,
.queuecommand = mptsas_qcmd,
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 164afa71bba7..727819cc7034 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -1284,101 +1284,17 @@ mptscsih_info(struct Scsi_Host *SChost)
return h->info_kbuf;
}
-struct info_str {
- char *buffer;
- int length;
- int offset;
- int pos;
-};
-
-static void
-mptscsih_copy_mem_info(struct info_str *info, char *data, int len)
-{
- if (info->pos + len > info->length)
- len = info->length - info->pos;
-
- if (info->pos + len < info->offset) {
- info->pos += len;
- return;
- }
-
- if (info->pos < info->offset) {
- data += (info->offset - info->pos);
- len -= (info->offset - info->pos);
- }
-
- if (len > 0) {
- memcpy(info->buffer + info->pos, data, len);
- info->pos += len;
- }
-}
-
-static int
-mptscsih_copy_info(struct info_str *info, char *fmt, ...)
-{
- va_list args;
- char buf[81];
- int len;
-
- va_start(args, fmt);
- len = vsprintf(buf, fmt, args);
- va_end(args);
-
- mptscsih_copy_mem_info(info, buf, len);
- return len;
-}
-
-static int
-mptscsih_host_info(MPT_ADAPTER *ioc, char *pbuf, off_t offset, int len)
-{
- struct info_str info;
-
- info.buffer = pbuf;
- info.length = len;
- info.offset = offset;
- info.pos = 0;
-
- mptscsih_copy_info(&info, "%s: %s, ", ioc->name, ioc->prod_name);
- mptscsih_copy_info(&info, "%s%08xh, ", MPT_FW_REV_MAGIC_ID_STRING, ioc->facts.FWVersion.Word);
- mptscsih_copy_info(&info, "Ports=%d, ", ioc->facts.NumberOfPorts);
- mptscsih_copy_info(&info, "MaxQ=%d\n", ioc->req_depth);
-
- return ((info.pos > info.offset) ? info.pos - info.offset : 0);
-}
-
-/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/**
- * mptscsih_proc_info - Return information about MPT adapter
- * @host: scsi host struct
- * @buffer: if write, user data; if read, buffer for user
- * @start: returns the buffer address
- * @offset: if write, 0; if read, the current offset into the buffer from
- * the previous read.
- * @length: if write, return length;
- * @func: write = 1; read = 0
- *
- * (linux scsi_host_template.info routine)
- */
-int
-mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset,
- int length, int func)
+int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)
{
MPT_SCSI_HOST *hd = shost_priv(host);
MPT_ADAPTER *ioc = hd->ioc;
- int size = 0;
- if (func) {
- /*
- * write is not supported
- */
- } else {
- if (start)
- *start = buffer;
-
- size = mptscsih_host_info(ioc, buffer, offset, length);
- }
+ seq_printf(m, "%s: %s, ", ioc->name, ioc->prod_name);
+ seq_printf(m, "%s%08xh, ", MPT_FW_REV_MAGIC_ID_STRING, ioc->facts.FWVersion.Word);
+ seq_printf(m, "Ports=%d, ", ioc->facts.NumberOfPorts);
+ seq_printf(m, "MaxQ=%d\n", ioc->req_depth);
- return size;
+ return 0;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -3348,7 +3264,7 @@ EXPORT_SYMBOL(mptscsih_shutdown);
EXPORT_SYMBOL(mptscsih_suspend);
EXPORT_SYMBOL(mptscsih_resume);
#endif
-EXPORT_SYMBOL(mptscsih_proc_info);
+EXPORT_SYMBOL(mptscsih_show_info);
EXPORT_SYMBOL(mptscsih_info);
EXPORT_SYMBOL(mptscsih_qcmd);
EXPORT_SYMBOL(mptscsih_slave_destroy);
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h
index 43e75ff39921..83f503162f7a 100644
--- a/drivers/message/fusion/mptscsih.h
+++ b/drivers/message/fusion/mptscsih.h
@@ -111,7 +111,7 @@ extern void mptscsih_shutdown(struct pci_dev *);
extern int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state);
extern int mptscsih_resume(struct pci_dev *pdev);
#endif
-extern int mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int func);
+extern int mptscsih_show_info(struct seq_file *, struct Scsi_Host *);
extern const char * mptscsih_info(struct Scsi_Host *SChost);
extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *));
extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index c3aabde2dc4f..5653e505f91f 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -831,7 +831,7 @@ static void mptspi_slave_destroy(struct scsi_device *sdev)
static struct scsi_host_template mptspi_driver_template = {
.module = THIS_MODULE,
.proc_name = "mptspi",
- .proc_info = mptscsih_proc_info,
+ .show_info = mptscsih_show_info,
.name = "MPT SPI Host",
.info = mptscsih_info,
.queuecommand = mptspi_qcmd,
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index 49e86aed2bc4..6fc3866965df 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -600,10 +600,8 @@ static int i2o_block_open(struct block_device *bdev, fmode_t mode)
*
* Unlock and unmount the media, and power down the device. Gets called if
* the block device is closed.
- *
- * Returns 0 on success or negative error code on failure.
*/
-static int i2o_block_release(struct gendisk *disk, fmode_t mode)
+static void i2o_block_release(struct gendisk *disk, fmode_t mode)
{
struct i2o_block_device *dev = disk->private_data;
u8 operation;
@@ -617,7 +615,7 @@ static int i2o_block_release(struct gendisk *disk, fmode_t mode)
* the TID no longer exists.
*/
if (!dev->i2o_dev)
- return 0;
+ return;
mutex_lock(&i2o_block_mutex);
i2o_block_device_flush(dev->i2o_dev);
@@ -631,8 +629,6 @@ static int i2o_block_release(struct gendisk *disk, fmode_t mode)
i2o_block_device_power(dev, operation);
mutex_unlock(&i2o_block_mutex);
-
- return 0;
}
static int i2o_block_getgeo(struct block_device *bdev, struct hd_geometry *geo)
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
index 5451beff183f..a60c188c2bd9 100644
--- a/drivers/message/i2o/i2o_config.c
+++ b/drivers/message/i2o/i2o_config.c
@@ -687,6 +687,11 @@ static int i2o_cfg_passthru32(struct file *file, unsigned cmnd,
}
size = size >> 16;
size *= 4;
+ if (size > sizeof(rmsg)) {
+ rcode = -EINVAL;
+ goto sg_list_cleanup;
+ }
+
/* Copy in the user's I2O command */
if (copy_from_user(rmsg, user_msg, size)) {
rcode = -EFAULT;
@@ -922,6 +927,11 @@ static int i2o_cfg_passthru(unsigned long arg)
}
size = size >> 16;
size *= 4;
+ if (size > sizeof(rmsg)) {
+ rcode = -EFAULT;
+ goto sg_list_cleanup;
+ }
+
/* Copy in the user's I2O command */
if (copy_from_user(rmsg, user_msg, size)) {
rcode = -EFAULT;
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
index 8001aa6bfb48..b7d87cd227a9 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -1599,98 +1599,98 @@ static int i2o_seq_show_sensors(struct seq_file *seq, void *v)
static int i2o_seq_open_hrt(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_hrt, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_hrt, PDE_DATA(inode));
};
static int i2o_seq_open_lct(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_lct, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_lct, PDE_DATA(inode));
};
static int i2o_seq_open_status(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_status, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_status, PDE_DATA(inode));
};
static int i2o_seq_open_hw(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_hw, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_hw, PDE_DATA(inode));
};
static int i2o_seq_open_ddm_table(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_ddm_table, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_ddm_table, PDE_DATA(inode));
};
static int i2o_seq_open_driver_store(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_driver_store, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_driver_store, PDE_DATA(inode));
};
static int i2o_seq_open_drivers_stored(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_drivers_stored, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_drivers_stored, PDE_DATA(inode));
};
static int i2o_seq_open_groups(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_groups, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_groups, PDE_DATA(inode));
};
static int i2o_seq_open_phys_device(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_phys_device, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_phys_device, PDE_DATA(inode));
};
static int i2o_seq_open_claimed(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_claimed, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_claimed, PDE_DATA(inode));
};
static int i2o_seq_open_users(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_users, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_users, PDE_DATA(inode));
};
static int i2o_seq_open_priv_msgs(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_priv_msgs, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_priv_msgs, PDE_DATA(inode));
};
static int i2o_seq_open_authorized_users(struct inode *inode, struct file *file)
{
return single_open(file, i2o_seq_show_authorized_users,
- PDE(inode)->data);
+ PDE_DATA(inode));
};
static int i2o_seq_open_dev_identity(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_dev_identity, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_dev_identity, PDE_DATA(inode));
};
static int i2o_seq_open_ddm_identity(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_ddm_identity, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_ddm_identity, PDE_DATA(inode));
};
static int i2o_seq_open_uinfo(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_uinfo, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_uinfo, PDE_DATA(inode));
};
static int i2o_seq_open_sgl_limits(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_sgl_limits, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_sgl_limits, PDE_DATA(inode));
};
static int i2o_seq_open_sensors(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_sensors, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_sensors, PDE_DATA(inode));
};
static int i2o_seq_open_dev_name(struct inode *inode, struct file *file)
{
- return single_open(file, i2o_seq_show_dev_name, PDE(inode)->data);
+ return single_open(file, i2o_seq_show_dev_name, PDE_DATA(inode));
};
static const struct file_operations i2o_seq_fops_lct = {
@@ -1895,25 +1895,6 @@ static int i2o_proc_create_entries(struct proc_dir_entry *dir,
}
/**
- * i2o_proc_subdir_remove - Remove child entries from a proc entry
- * @dir: proc dir entry from which the childs should be removed
- *
- * Iterate over each i2o proc entry under dir and remove it. If the child
- * also has entries, remove them too.
- */
-static void i2o_proc_subdir_remove(struct proc_dir_entry *dir)
-{
- struct proc_dir_entry *pe, *tmp;
- pe = dir->subdir;
- while (pe) {
- tmp = pe->next;
- i2o_proc_subdir_remove(pe);
- remove_proc_entry(pe->name, dir);
- pe = tmp;
- }
-};
-
-/**
* i2o_proc_device_add - Add an I2O device to the proc dir
* @dir: proc dir entry to which the device should be added
* @dev: I2O device which should be added
@@ -1932,14 +1913,12 @@ static void i2o_proc_device_add(struct proc_dir_entry *dir,
osm_debug("adding device /proc/i2o/%s/%s\n", dev->iop->name, buff);
- devdir = proc_mkdir(buff, dir);
+ devdir = proc_mkdir_data(buff, 0, dir, dev);
if (!devdir) {
osm_warn("Could not allocate procdir!\n");
return;
}
- devdir->data = dev;
-
i2o_proc_create_entries(devdir, generic_dev_entries, dev);
/* Inform core that we want updates about this device's status */
@@ -1973,12 +1952,10 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir,
osm_debug("adding IOP /proc/i2o/%s\n", c->name);
- iopdir = proc_mkdir(c->name, dir);
+ iopdir = proc_mkdir_data(c->name, 0, dir, c);
if (!iopdir)
return -1;
- iopdir->data = c;
-
i2o_proc_create_entries(iopdir, i2o_proc_generic_iop_entries, c);
list_for_each_entry(dev, &c->devices, list)
@@ -1988,31 +1965,6 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir,
}
/**
- * i2o_proc_iop_remove - Removes an I2O controller from the i2o proc tree
- * @dir: parent proc dir entry
- * @c: I2O controller which should be removed
- *
- * Iterate over each i2o proc entry and search controller c. If it is found
- * remove it from the tree.
- */
-static void i2o_proc_iop_remove(struct proc_dir_entry *dir,
- struct i2o_controller *c)
-{
- struct proc_dir_entry *pe, *tmp;
-
- pe = dir->subdir;
- while (pe) {
- tmp = pe->next;
- if (pe->data == c) {
- i2o_proc_subdir_remove(pe);
- remove_proc_entry(pe->name, dir);
- }
- osm_debug("removing IOP /proc/i2o/%s\n", c->name);
- pe = tmp;
- }
-}
-
-/**
* i2o_proc_fs_create - Create the i2o proc fs.
*
* Iterate over each I2O controller and create the entries for it.
@@ -2042,12 +1994,7 @@ static int __init i2o_proc_fs_create(void)
*/
static int __exit i2o_proc_fs_destroy(void)
{
- struct i2o_controller *c;
-
- list_for_each_entry(c, &i2o_controllers, list)
- i2o_proc_iop_remove(i2o_proc_dir_root, c);
-
- remove_proc_entry("i2o", NULL);
+ remove_proc_subtree("i2o", NULL);
return 0;
};