aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/airo.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2010-12-25 01:03:58 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-01-04 14:35:12 -0500
commitad9082adfc0a6bdcef1bad2f22485575479d7a9d (patch)
treed990dec471dce26a84f922c90c6b5cccbbe02536 /drivers/net/wireless/airo.c
parent52671e43dbfb0e0dfa5fab604cb3984bd1d777a6 (diff)
airo: use simple_write_to_buffer
Simplify write file operation for /proc files by using simple_write_to_buffer(). Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: "John W. Linville" <linville@tuxdriver.com> Cc: linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/airo.c')
-rw-r--r--drivers/net/wireless/airo.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index a36e7870b03e..57a79b0475f6 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -4652,24 +4652,18 @@ static ssize_t proc_write( struct file *file,
4652 size_t len, 4652 size_t len,
4653 loff_t *offset ) 4653 loff_t *offset )
4654{ 4654{
4655 loff_t pos = *offset; 4655 ssize_t ret;
4656 struct proc_data *priv = file->private_data; 4656 struct proc_data *priv = file->private_data;
4657 4657
4658 if (!priv->wbuffer) 4658 if (!priv->wbuffer)
4659 return -EINVAL; 4659 return -EINVAL;
4660 4660
4661 if (pos < 0) 4661 ret = simple_write_to_buffer(priv->wbuffer, priv->maxwritelen, offset,
4662 return -EINVAL; 4662 buffer, len);
4663 if (pos >= priv->maxwritelen) 4663 if (ret > 0)
4664 return 0; 4664 priv->writelen = max_t(int, priv->writelen, *offset);
4665 if (len > priv->maxwritelen - pos) 4665
4666 len = priv->maxwritelen - pos; 4666 return ret;
4667 if (copy_from_user(priv->wbuffer + pos, buffer, len))
4668 return -EFAULT;
4669 if ( pos + len > priv->writelen )
4670 priv->writelen = len + file->f_pos;
4671 *offset = pos + len;
4672 return len;
4673} 4667}
4674 4668
4675static int proc_status_open(struct inode *inode, struct file *file) 4669static int proc_status_open(struct inode *inode, struct file *file)