summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/l440gx.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2012-04-07 03:48:59 +0200
committerLen Brown <len.brown@intel.com>2012-04-07 03:48:59 +0200
commiteeaab2d8af2cf1d36d7086f22e9de42d6dd2995c (patch)
tree369b9c91a6d808944f07d2290fec6f9fe2731904 /drivers/mtd/maps/l440gx.c
parentcpuidle: Fix panic in CPU off-lining with no idle driver (diff)
parentMAINTAINERS: Update git url for ACPI (diff)
downloadlinux-eeaab2d8af2cf1d36d7086f22e9de42d6dd2995c.tar.xz
linux-eeaab2d8af2cf1d36d7086f22e9de42d6dd2995c.zip
Merge branches 'idle-fix' and 'misc' into release
Diffstat (limited to 'drivers/mtd/maps/l440gx.c')
-rw-r--r--drivers/mtd/maps/l440gx.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/mtd/maps/l440gx.c b/drivers/mtd/maps/l440gx.c
index dd0360ba2412..74bd98ee635f 100644
--- a/drivers/mtd/maps/l440gx.c
+++ b/drivers/mtd/maps/l440gx.c
@@ -27,17 +27,21 @@ static struct mtd_info *mymtd;
/* Is this really the vpp port? */
+static DEFINE_SPINLOCK(l440gx_vpp_lock);
+static int l440gx_vpp_refcnt;
static void l440gx_set_vpp(struct map_info *map, int vpp)
{
- unsigned long l;
+ unsigned long flags;
- l = inl(VPP_PORT);
+ spin_lock_irqsave(&l440gx_vpp_lock, flags);
if (vpp) {
- l |= 1;
+ if (++l440gx_vpp_refcnt == 1) /* first nested 'on' */
+ outl(inl(VPP_PORT) | 1, VPP_PORT);
} else {
- l &= ~1;
+ if (--l440gx_vpp_refcnt == 0) /* last nested 'off' */
+ outl(inl(VPP_PORT) & ~1, VPP_PORT);
}
- outl(l, VPP_PORT);
+ spin_unlock_irqrestore(&l440gx_vpp_lock, flags);
}
static struct map_info l440gx_map = {