[S390] vmcp cleanup

2007-07-17 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d9d119f12fdb14d57e96e4698ef2ec303b102ae9
Commit: d9d119f12fdb14d57e96e4698ef2ec303b102ae9
Parent: 6cbed91ab78e750eef2dacb75bd51bd63792fd07
Author: Christian Borntraeger <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 13:36:05 2007 +0200
Committer:  Martin Schwidefsky <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 13:36:19 2007 +0200

    [S390] vmcp cleanup

A number of small changes to vmcp:
 - Change preferred email address.
 - Use PRINT_xxx machros from debug.h like most s390 drivers, define
   "vmcp:" as PRINTK_HEADER and wrap error message at column 80.
 - Add error number to error message.
 - Update copyright, as I touched this file.
 - Small whitespace diff.
 - Use mutex instead of semaphore (Thanks Heiko for the patch)
 - Don't register debug feature on failure.
 - Check debug feature registration on init to avoid a potential oops
   on unload if the debug feature could not be registered--> 2 more
   messages.

Signed-off-by: Christian Borntraeger <[EMAIL PROTECTED]>
Signed-off-by: Martin Schwidefsky <[EMAIL PROTECTED]>
---
 drivers/s390/char/vmcp.c |   89 ++---
 drivers/s390/char/vmcp.h |4 +-
 2 files changed, 53 insertions(+), 40 deletions(-)

diff --git a/drivers/s390/char/vmcp.c b/drivers/s390/char/vmcp.c
index 82e6a6b..2f419b0 100644
--- a/drivers/s390/char/vmcp.c
+++ b/drivers/s390/char/vmcp.c
@@ -1,7 +1,7 @@
 /*
- * Copyright (C) 2004,2005 IBM Corporation
+ * Copyright IBM Corp. 2004,2007
  * Interface implementation for communication with the z/VM control program
- * Author(s): Christian Borntraeger <[EMAIL PROTECTED]>
+ * Author(s): Christian Borntraeger <[EMAIL PROTECTED]>
  *
  *
  * z/VMs CP offers the possibility to issue commands via the diagnose code 8
@@ -22,9 +22,11 @@
 #include "vmcp.h"
 
 MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Christian Borntraeger <[EMAIL PROTECTED]>");
+MODULE_AUTHOR("Christian Borntraeger <[EMAIL PROTECTED]>");
 MODULE_DESCRIPTION("z/VM CP interface");
 
+#define PRINTK_HEADER "vmcp: "
+
 static debug_info_t *vmcp_debug;
 
 static int vmcp_open(struct inode *inode, struct file *file)
@@ -40,7 +42,7 @@ static int vmcp_open(struct inode *inode, struct file *file)
session->bufsize = PAGE_SIZE;
session->response = NULL;
session->resp_size = 0;
-   init_MUTEX(&session->mutex);
+   mutex_init(&session->mutex);
file->private_data = session;
return nonseekable_open(inode, file);
 }
@@ -57,37 +59,37 @@ static int vmcp_release(struct inode *inode, struct file 
*file)
 }
 
 static ssize_t
-vmcp_read(struct file *file, char __user * buff, size_t count, loff_t * ppos)
+vmcp_read(struct file *file, char __user *buff, size_t count, loff_t *ppos)
 {
size_t tocopy;
struct vmcp_session *session;
 
session = (struct vmcp_session *)file->private_data;
-   if (down_interruptible(&session->mutex))
+   if (mutex_lock_interruptible(&session->mutex))
return -ERESTARTSYS;
if (!session->response) {
-   up(&session->mutex);
+   mutex_unlock(&session->mutex);
return 0;
}
if (*ppos > session->resp_size) {
-   up(&session->mutex);
+   mutex_unlock(&session->mutex);
return 0;
}
tocopy = min(session->resp_size - (size_t) (*ppos), count);
-   tocopy = min(tocopy,session->bufsize - (size_t) (*ppos));
+   tocopy = min(tocopy, session->bufsize - (size_t) (*ppos));
 
if (copy_to_user(buff, session->response + (*ppos), tocopy)) {
-   up(&session->mutex);
+   mutex_unlock(&session->mutex);
return -EFAULT;
}
-   up(&session->mutex);
+   mutex_unlock(&session->mutex);
*ppos += tocopy;
return tocopy;
 }
 
 static ssize_t
-vmcp_write(struct file *file, const char __user * buff, size_t count,
-  loff_t * ppos)
+vmcp_write(struct file *file, const char __user *buff, size_t count,
+  loff_t *ppos)
 {
char *cmd;
struct vmcp_session *session;
@@ -103,24 +105,23 @@ vmcp_write(struct file *file, const char __user * buff, 
size_t count,
}
cmd[count] = '\0';
session = (struct vmcp_session *)file->private_data;
-   if (down_interruptible(&session->mutex)) {
+   if (mutex_lock_interruptible(&session->mutex)) {
kfree(cmd);
return -ERESTARTSYS;
}
if (!session->response)
session->response = (char *)__get_

[S390] vmcp cleanup

2007-07-10 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d197e6921843932b5d8ecf47d23fcac62e73b19a
Commit: d197e6921843932b5d8ecf47d23fcac62e73b19a
Parent: 71780f59e127bb281a9302d430495ca9586c14e7
Author: Robert P. J. Day <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 10 11:24:07 2007 +0200
Committer:  Martin Schwidefsky <[EMAIL PROTECTED]>
CommitDate: Tue Jul 10 11:24:41 2007 +0200

    [S390] vmcp cleanup

No need to use the "&" prefix and, since you're calling nonseekable_open(),
there is no need to use no_llseek().

Signed-off-by: Robert P. J. Day <[EMAIL PROTECTED]>
Signed-off-by: Martin Schwidefsky <[EMAIL PROTECTED]>
---
 drivers/s390/char/vmcp.c |   13 ++---
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/s390/char/vmcp.c b/drivers/s390/char/vmcp.c
index fce3dac..82e6a6b 100644
--- a/drivers/s390/char/vmcp.c
+++ b/drivers/s390/char/vmcp.c
@@ -175,13 +175,12 @@ static long vmcp_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
 
 static const struct file_operations vmcp_fops = {
.owner  = THIS_MODULE,
-   .open   = &vmcp_open,
-   .release= &vmcp_release,
-   .read   = &vmcp_read,
-   .llseek = &no_llseek,
-   .write  = &vmcp_write,
-   .unlocked_ioctl = &vmcp_ioctl,
-   .compat_ioctl   = &vmcp_ioctl
+   .open   = vmcp_open,
+   .release= vmcp_release,
+   .read   = vmcp_read,
+   .write  = vmcp_write,
+   .unlocked_ioctl = vmcp_ioctl,
+   .compat_ioctl   = vmcp_ioctl
 };
 
 static struct miscdevice vmcp_dev = {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html