linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] iio: pressure: bmp280: fix error message for wrong chip id
@ 2016-04-28 14:39 Akinobu Mita
  2016-05-14 18:03 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Akinobu Mita @ 2016-04-28 14:39 UTC (permalink / raw)
  To: linux-iio
  Cc: Akinobu Mita, Matt Ranostay, Vlad Dogaru, Christoph Mair,
	Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald

The bmp280 driver also supports BMP180 which has a different chip id
with BMP280.  The probe routine verifies that the device reports the
correct chip id but the error message is confusing as if BMP280's chip
id is always expected.

Reported-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Matt Ranostay <mranostay@gmail.com>
Cc: Vlad Dogaru <vlad.dogaru@intel.com>
Cc: Christoph Mair <christoph.mair@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
---
 drivers/iio/pressure/bmp280.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/pressure/bmp280.c b/drivers/iio/pressure/bmp280.c
index 2f1498e..724452d 100644
--- a/drivers/iio/pressure/bmp280.c
+++ b/drivers/iio/pressure/bmp280.c
@@ -879,8 +879,8 @@ static int bmp280_probe(struct i2c_client *client,
 	if (ret < 0)
 		return ret;
 	if (chip_id != id->driver_data) {
-		dev_err(&client->dev, "bad chip id.  expected %x got %x\n",
-			BMP280_CHIP_ID, chip_id);
+		dev_err(&client->dev, "bad chip id.  expected %lx got %x\n",
+			id->driver_data, chip_id);
 		return -EINVAL;
 	}
 
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] iio: pressure: bmp280: fix error message for wrong chip id
  2016-04-28 14:39 [PATCH -next] iio: pressure: bmp280: fix error message for wrong chip id Akinobu Mita
@ 2016-05-14 18:03 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2016-05-14 18:03 UTC (permalink / raw)
  To: Akinobu Mita, linux-iio
  Cc: Matt Ranostay, Vlad Dogaru, Christoph Mair, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald

On 28/04/16 15:39, Akinobu Mita wrote:
> The bmp280 driver also supports BMP180 which has a different chip id
> with BMP280.  The probe routine verifies that the device reports the
> correct chip id but the error message is confusing as if BMP280's chip
> id is always expected.
> 
> Reported-by: Matt Ranostay <mranostay@gmail.com>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Cc: Matt Ranostay <mranostay@gmail.com>
> Cc: Vlad Dogaru <vlad.dogaru@intel.com>
> Cc: Christoph Mair <christoph.mair@gmail.com>
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Hartmut Knaack <knaack.h@gmx.de>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Cc: Peter Meerwald <pmeerw@pmeerw.net>
Applied to the fixes-togreg-post-rc1 branch of iio.git
Clue to what happens next with this is in the branch name ;)

Thanks,

Jonathan
> ---
>  drivers/iio/pressure/bmp280.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/pressure/bmp280.c b/drivers/iio/pressure/bmp280.c
> index 2f1498e..724452d 100644
> --- a/drivers/iio/pressure/bmp280.c
> +++ b/drivers/iio/pressure/bmp280.c
> @@ -879,8 +879,8 @@ static int bmp280_probe(struct i2c_client *client,
>  	if (ret < 0)
>  		return ret;
>  	if (chip_id != id->driver_data) {
> -		dev_err(&client->dev, "bad chip id.  expected %x got %x\n",
> -			BMP280_CHIP_ID, chip_id);
> +		dev_err(&client->dev, "bad chip id.  expected %lx got %x\n",
> +			id->driver_data, chip_id);
>  		return -EINVAL;
>  	}
>  
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-14 18:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-28 14:39 [PATCH -next] iio: pressure: bmp280: fix error message for wrong chip id Akinobu Mita
2016-05-14 18:03 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).