Commit c600040f authored by Axel Lin's avatar Axel Lin Committed by Samuel Ortiz
Browse files

mfd: Remove unneeded io_mutex from struct twl6040



Current code has been converted to use regmap APIs, the io_mutex is not needed.
Thus remove the io_mutex.

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 706c96b7
Loading
Loading
Loading
Loading
+3 −20
Original line number Diff line number Diff line
@@ -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;
}
@@ -86,12 +82,10 @@ 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;
}
@@ -99,23 +93,13 @@ 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);

@@ -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);
+0 −1
Original line number Diff line number Diff line
@@ -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;