linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: mgreer@mvista.com
Cc: linuxppc-dev@ozlabs.org
Subject: [PATCH] mv64x60 use mutex instead of semaphore
Date: Thu, 19 Jul 2007 23:50:49 +0200	[thread overview]
Message-ID: <20070719215049.GA4896@lst.de> (raw)


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/arch/ppc/syslib/mv64x60.c
===================================================================
--- linux-2.6.orig/arch/ppc/syslib/mv64x60.c	2007-07-19 22:47:07.000000000 +0200
+++ linux-2.6/arch/ppc/syslib/mv64x60.c	2007-07-19 22:48:29.000000000 +0200
@@ -14,6 +14,7 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
 #include <linux/string.h>
 #include <linux/spinlock.h>
 #include <linux/mv643xx.h>
@@ -2359,7 +2360,7 @@ mv64460_chip_specific_init(struct mv64x6
 /* Export the hotswap register via sysfs for enum event monitoring */
 #define	VAL_LEN_MAX	11 /* 32-bit hex or dec stringified number + '\n' */
 
-DECLARE_MUTEX(mv64xxx_hs_lock);
+static DEFINE_MUTEX(mv64xxx_hs_lock);
 
 static ssize_t
 mv64xxx_hs_reg_read(struct kobject *kobj, char *buf, loff_t off, size_t count)
@@ -2372,14 +2373,14 @@ mv64xxx_hs_reg_read(struct kobject *kobj
 	if (count < VAL_LEN_MAX)
 		return -EINVAL;
 
-	if (down_interruptible(&mv64xxx_hs_lock))
+	if (mutex_lock_interruptible(&mv64xxx_hs_lock))
 		return -ERESTARTSYS;
 	save_exclude = mv64x60_pci_exclude_bridge;
 	mv64x60_pci_exclude_bridge = 0;
 	early_read_config_dword(&sysfs_hose_a, 0, PCI_DEVFN(0, 0),
 			MV64360_PCICFG_CPCI_HOTSWAP, &v);
 	mv64x60_pci_exclude_bridge = save_exclude;
-	up(&mv64xxx_hs_lock);
+	mutex_unlock(&mv64xxx_hs_lock);
 
 	return sprintf(buf, "0x%08x\n", v);
 }
@@ -2396,14 +2397,14 @@ mv64xxx_hs_reg_write(struct kobject *kob
 		return -EINVAL;
 
 	if (sscanf(buf, "%i", &v) == 1) {
-		if (down_interruptible(&mv64xxx_hs_lock))
+		if (mutex_lock_interruptible(&mv64xxx_hs_lock))
 			return -ERESTARTSYS;
 		save_exclude = mv64x60_pci_exclude_bridge;
 		mv64x60_pci_exclude_bridge = 0;
 		early_write_config_dword(&sysfs_hose_a, 0, PCI_DEVFN(0, 0),
 				MV64360_PCICFG_CPCI_HOTSWAP, v);
 		mv64x60_pci_exclude_bridge = save_exclude;
-		up(&mv64xxx_hs_lock);
+		mutex_unlock(&mv64xxx_hs_lock);
 	}
 	else
 		count = -EINVAL;
@@ -2433,10 +2434,10 @@ mv64xxx_hs_reg_valid_show(struct device 
 	pdev = container_of(dev, struct platform_device, dev);
 	pdp = (struct mv64xxx_pdata *)pdev->dev.platform_data;
 
-	if (down_interruptible(&mv64xxx_hs_lock))
+	if (mutex_lock_interruptible(&mv64xxx_hs_lock))
 		return -ERESTARTSYS;
 	v = pdp->hs_reg_valid;
-	up(&mv64xxx_hs_lock);
+	mutex_unlock(&mv64xxx_hs_lock);
 
 	return sprintf(buf, "%i\n", v);
 }

             reply	other threads:[~2007-07-19 21:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-19 21:50 Christoph Hellwig [this message]
2007-07-19 22:35 ` [PATCH] mv64x60 use mutex instead of semaphore Mark A. Greer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070719215049.GA4896@lst.de \
    --to=hch@lst.de \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mgreer@mvista.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).