Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359776
b: refs/heads/master
c: b2bbc6a
h: refs/heads/master
v: v3
  • Loading branch information
Kuninori Morimoto authored and Zhang Rui committed Feb 6, 2013
1 parent 2a8828d commit 5d233c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f8f53e1874c2dfddf4c6dc69008ba85d6de4d944
refs/heads/master: b2bbc6a2ace78eaca2f6482b58b984519aa783ac
30 changes: 7 additions & 23 deletions trunk/drivers/thermal/rcar_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
struct rcar_thermal_priv {
void __iomem *base;
struct device *dev;
spinlock_t lock;
struct mutex lock;
};

#define MCELSIUS(temp) ((temp) * 1000)
Expand All @@ -54,46 +54,26 @@ struct rcar_thermal_priv {
*/
static u32 rcar_thermal_read(struct rcar_thermal_priv *priv, u32 reg)
{
unsigned long flags;
u32 ret;

spin_lock_irqsave(&priv->lock, flags);

ret = ioread32(priv->base + reg);

spin_unlock_irqrestore(&priv->lock, flags);

return ret;
return ioread32(priv->base + reg);
}

#if 0 /* no user at this point */
static void rcar_thermal_write(struct rcar_thermal_priv *priv,
u32 reg, u32 data)
{
unsigned long flags;

spin_lock_irqsave(&priv->lock, flags);

iowrite32(data, priv->base + reg);

spin_unlock_irqrestore(&priv->lock, flags);
}
#endif

static void rcar_thermal_bset(struct rcar_thermal_priv *priv, u32 reg,
u32 mask, u32 data)
{
unsigned long flags;
u32 val;

spin_lock_irqsave(&priv->lock, flags);

val = ioread32(priv->base + reg);
val &= ~mask;
val |= (data & mask);
iowrite32(val, priv->base + reg);

spin_unlock_irqrestore(&priv->lock, flags);
}

/*
Expand All @@ -107,6 +87,8 @@ static int rcar_thermal_get_temp(struct thermal_zone_device *zone,
int i;
int ctemp, old, new;

mutex_lock(&priv->lock);

/*
* TSC decides a value of CPTAP automatically,
* and this is the conditions which validate interrupt.
Expand Down Expand Up @@ -138,6 +120,8 @@ static int rcar_thermal_get_temp(struct thermal_zone_device *zone,

*temp = MCELSIUS((ctemp * 5) - 65);

mutex_unlock(&priv->lock);

return 0;
}

Expand Down Expand Up @@ -225,7 +209,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
}

priv->dev = &pdev->dev;
spin_lock_init(&priv->lock);
mutex_init(&priv->lock);
priv->base = devm_ioremap_nocache(&pdev->dev,
res->start, resource_size(res));
if (!priv->base) {
Expand Down

0 comments on commit 5d233c8

Please sign in to comment.