[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20100405135657.GI6580@rakim.wolfsonmicro.main>
Date: Mon, 5 Apr 2010 14:56:58 +0100
From: Mark Brown <broonie@...nsource.wolfsonmicro.com>
To: Todd Fischer <todd.fischer@...gerun.com>
Cc: linux-kernel@...r.kernel.org,
davinci-linux-open-source@...ux.davincidsp.com,
sameo@...ux.intel.com, lrg@...mlogic.co.uk
Subject: Re: [PATCH 4/4]-V2 Add MFD driver for TPS6507x family of
multi-function chips and move TPS6507x regulator driver from being
stand-alone to using the MFD driver.
On Fri, Apr 02, 2010 at 03:37:33PM -0600, Todd Fischer wrote:
> Add MFD driver for TPS6507x family of multi-function chips. Move TPS6507x
> regulator driver from being stand-alone driver to using the MFD TPS6507x driver.
>
> Signed-off-by: Todd Fischer <todd.fischer@...gerun.com>
One issue...
> +static int tps6507x_i2c_read_device(struct tps6507x_dev *tps6507x, char reg,
> + int bytes, void *dest)
> +{
> + struct i2c_client *i2c = tps6507x->i2c_client;
> + int ret;
> +
> + ret = i2c_master_send(i2c, ®, 1);
> + if (ret < 0)
> + return ret;
> +
> + ret = i2c_master_recv(i2c, dest, bytes);
> + if (ret < 0)
> + return ret;
> + if (ret != bytes)
> + return -EIO;
> + return 0;
> +}
Your register I/O functions don't have anything protecting them against
concurrent access. This isn't really an issue for the writes by
themselves since they do a single transaction on the I2C bus so the I2C
layer concurrency protection ought to be enough but for reads you need
to send the register address first then read back the data, opening up
an issue. A simple mutex in the read and write functions ought to cover
this.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists