Skip to content

Commit

Permalink
mfd: Remove unneeded io_mutex from struct twl6040
Browse files Browse the repository at this point in the history
Current code has been converted to use regmap APIs, the io_mutex is not needed.
Thus remove the io_mutex.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Axel Lin authored and Samuel Ortiz committed Jul 16, 2012
1 parent 706c96b commit c600040
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
23 changes: 3 additions & 20 deletions drivers/mfd/twl6040-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,15 @@ int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg)
int ret;
unsigned int val;

mutex_lock(&twl6040->io_mutex);
/* Vibra control registers from cache */
if (unlikely(reg == TWL6040_REG_VIBCTLL ||
reg == TWL6040_REG_VIBCTLR)) {
val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)];
} else {
ret = regmap_read(twl6040->regmap, reg, &val);
if (ret < 0) {
mutex_unlock(&twl6040->io_mutex);
if (ret < 0)
return ret;
}
}
mutex_unlock(&twl6040->io_mutex);

return val;
}
Expand All @@ -86,36 +82,24 @@ int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg, u8 val)
{
int ret;

mutex_lock(&twl6040->io_mutex);
ret = regmap_write(twl6040->regmap, reg, val);
/* Cache the vibra control registers */
if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR)
twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val;
mutex_unlock(&twl6040->io_mutex);

return ret;
}
EXPORT_SYMBOL(twl6040_reg_write);

int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask)
{
int ret;

mutex_lock(&twl6040->io_mutex);
ret = regmap_update_bits(twl6040->regmap, reg, mask, mask);
mutex_unlock(&twl6040->io_mutex);
return ret;
return regmap_update_bits(twl6040->regmap, reg, mask, mask);
}
EXPORT_SYMBOL(twl6040_set_bits);

int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask)
{
int ret;

mutex_lock(&twl6040->io_mutex);
ret = regmap_update_bits(twl6040->regmap, reg, mask, 0);
mutex_unlock(&twl6040->io_mutex);
return ret;
return regmap_update_bits(twl6040->regmap, reg, mask, 0);
}
EXPORT_SYMBOL(twl6040_clear_bits);

Expand Down Expand Up @@ -573,7 +557,6 @@ static int __devinit twl6040_probe(struct i2c_client *client,
twl6040->irq = client->irq;

mutex_init(&twl6040->mutex);
mutex_init(&twl6040->io_mutex);
init_completion(&twl6040->ready);

twl6040->rev = twl6040_reg_read(twl6040, TWL6040_REG_ASICREV);
Expand Down
1 change: 0 additions & 1 deletion include/linux/mfd/twl6040.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ struct twl6040 {
struct regmap *regmap;
struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */
struct mutex mutex;
struct mutex io_mutex;
struct mutex irq_mutex;
struct mfd_cell cells[TWL6040_CELLS];
struct completion ready;
Expand Down

0 comments on commit c600040

Please sign in to comment.