diff options
author | Christoph Hellwig <hch@lst.de> | 2007-07-19 17:50:49 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-07-22 07:30:58 -0400 |
commit | 461e666723b6669bc6f7ef90b49b615396d70eb8 (patch) | |
tree | af341848054866c2f3d525032466b1993b0fcf20 /arch/ppc/syslib | |
parent | adff093d6c545c882f1503607f6af14ddd90bb89 (diff) |
[POWERPC] mv64x60: Use mutex instead of semaphore
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc/syslib')
-rw-r--r-- | arch/ppc/syslib/mv64x60.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c index 032f4b7f4225..d212b1c418a9 100644 --- a/arch/ppc/syslib/mv64x60.c +++ b/arch/ppc/syslib/mv64x60.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/pci.h> | 14 | #include <linux/pci.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/mutex.h> | ||
17 | #include <linux/string.h> | 18 | #include <linux/string.h> |
18 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
19 | #include <linux/mv643xx.h> | 20 | #include <linux/mv643xx.h> |
@@ -2359,7 +2360,7 @@ mv64460_chip_specific_init(struct mv64x60_handle *bh, | |||
2359 | /* Export the hotswap register via sysfs for enum event monitoring */ | 2360 | /* Export the hotswap register via sysfs for enum event monitoring */ |
2360 | #define VAL_LEN_MAX 11 /* 32-bit hex or dec stringified number + '\n' */ | 2361 | #define VAL_LEN_MAX 11 /* 32-bit hex or dec stringified number + '\n' */ |
2361 | 2362 | ||
2362 | DECLARE_MUTEX(mv64xxx_hs_lock); | 2363 | static DEFINE_MUTEX(mv64xxx_hs_lock); |
2363 | 2364 | ||
2364 | static ssize_t | 2365 | static ssize_t |
2365 | mv64xxx_hs_reg_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | 2366 | 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, char *buf, loff_t off, size_t count) | |||
2372 | if (count < VAL_LEN_MAX) | 2373 | if (count < VAL_LEN_MAX) |
2373 | return -EINVAL; | 2374 | return -EINVAL; |
2374 | 2375 | ||
2375 | if (down_interruptible(&mv64xxx_hs_lock)) | 2376 | if (mutex_lock_interruptible(&mv64xxx_hs_lock)) |
2376 | return -ERESTARTSYS; | 2377 | return -ERESTARTSYS; |
2377 | save_exclude = mv64x60_pci_exclude_bridge; | 2378 | save_exclude = mv64x60_pci_exclude_bridge; |
2378 | mv64x60_pci_exclude_bridge = 0; | 2379 | mv64x60_pci_exclude_bridge = 0; |
2379 | early_read_config_dword(&sysfs_hose_a, 0, PCI_DEVFN(0, 0), | 2380 | early_read_config_dword(&sysfs_hose_a, 0, PCI_DEVFN(0, 0), |
2380 | MV64360_PCICFG_CPCI_HOTSWAP, &v); | 2381 | MV64360_PCICFG_CPCI_HOTSWAP, &v); |
2381 | mv64x60_pci_exclude_bridge = save_exclude; | 2382 | mv64x60_pci_exclude_bridge = save_exclude; |
2382 | up(&mv64xxx_hs_lock); | 2383 | mutex_unlock(&mv64xxx_hs_lock); |
2383 | 2384 | ||
2384 | return sprintf(buf, "0x%08x\n", v); | 2385 | return sprintf(buf, "0x%08x\n", v); |
2385 | } | 2386 | } |
@@ -2396,14 +2397,14 @@ mv64xxx_hs_reg_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
2396 | return -EINVAL; | 2397 | return -EINVAL; |
2397 | 2398 | ||
2398 | if (sscanf(buf, "%i", &v) == 1) { | 2399 | if (sscanf(buf, "%i", &v) == 1) { |
2399 | if (down_interruptible(&mv64xxx_hs_lock)) | 2400 | if (mutex_lock_interruptible(&mv64xxx_hs_lock)) |
2400 | return -ERESTARTSYS; | 2401 | return -ERESTARTSYS; |
2401 | save_exclude = mv64x60_pci_exclude_bridge; | 2402 | save_exclude = mv64x60_pci_exclude_bridge; |
2402 | mv64x60_pci_exclude_bridge = 0; | 2403 | mv64x60_pci_exclude_bridge = 0; |
2403 | early_write_config_dword(&sysfs_hose_a, 0, PCI_DEVFN(0, 0), | 2404 | early_write_config_dword(&sysfs_hose_a, 0, PCI_DEVFN(0, 0), |
2404 | MV64360_PCICFG_CPCI_HOTSWAP, v); | 2405 | MV64360_PCICFG_CPCI_HOTSWAP, v); |
2405 | mv64x60_pci_exclude_bridge = save_exclude; | 2406 | mv64x60_pci_exclude_bridge = save_exclude; |
2406 | up(&mv64xxx_hs_lock); | 2407 | mutex_unlock(&mv64xxx_hs_lock); |
2407 | } | 2408 | } |
2408 | else | 2409 | else |
2409 | count = -EINVAL; | 2410 | count = -EINVAL; |
@@ -2433,10 +2434,10 @@ mv64xxx_hs_reg_valid_show(struct device *dev, struct device_attribute *attr, | |||
2433 | pdev = container_of(dev, struct platform_device, dev); | 2434 | pdev = container_of(dev, struct platform_device, dev); |
2434 | pdp = (struct mv64xxx_pdata *)pdev->dev.platform_data; | 2435 | pdp = (struct mv64xxx_pdata *)pdev->dev.platform_data; |
2435 | 2436 | ||
2436 | if (down_interruptible(&mv64xxx_hs_lock)) | 2437 | if (mutex_lock_interruptible(&mv64xxx_hs_lock)) |
2437 | return -ERESTARTSYS; | 2438 | return -ERESTARTSYS; |
2438 | v = pdp->hs_reg_valid; | 2439 | v = pdp->hs_reg_valid; |
2439 | up(&mv64xxx_hs_lock); | 2440 | mutex_unlock(&mv64xxx_hs_lock); |
2440 | 2441 | ||
2441 | return sprintf(buf, "%i\n", v); | 2442 | return sprintf(buf, "%i\n", v); |
2442 | } | 2443 | } |