linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Baptiste Mansuy <bmansuy@invensense.com>,
	Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 08/12] iio:imu:inv_mpu6050: Suppress clang W=1 warning about pointer to enum conversion.
Date: Sun, 28 Nov 2021 17:24:41 +0000	[thread overview]
Message-ID: <20211128172445.2616166-9-jic23@kernel.org> (raw)
In-Reply-To: <20211128172445.2616166-1-jic23@kernel.org>

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Cast to a uintptr_t rather than directly to the enum.

As per the discussion in below linked media patch.

Link: https://lore.kernel.org/linux-media/CAK8P3a2ez6nEw4d+Mqa3XXAz0RFTZHunqqRj6sCt7Y_Eqqs0rw@mail.gmail.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Baptiste Mansuy <bmansuy@invensense.com>
Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 2 +-
 drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
index 3ef17e3f50e2..fe03707ec2d3 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
@@ -110,7 +110,7 @@ static int inv_mpu_probe(struct i2c_client *client,
 
 	match = device_get_match_data(&client->dev);
 	if (match) {
-		chip_type = (enum inv_devices)match;
+		chip_type = (uintptr_t)match;
 		name = client->name;
 	} else if (id) {
 		chip_type = (enum inv_devices)
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
index b056f3fe2561..6800356b25fb 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
@@ -45,7 +45,7 @@ static int inv_mpu_probe(struct spi_device *spi)
 		chip_type = (enum inv_devices)spi_id->driver_data;
 		name = spi_id->name;
 	} else if ((match = device_get_match_data(&spi->dev))) {
-		chip_type = (enum inv_devices)match;
+		chip_type = (uintptr_t)match;
 		name = dev_name(&spi->dev);
 	} else {
 		return -ENODEV;
-- 
2.34.1


  parent reply	other threads:[~2021-11-28 17:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-28 17:24 [PATCH 00/12] IIO: clang W=1 warning cleanup Jonathan Cameron
2021-11-28 17:24 ` [PATCH 01/12] iio:accel:bma180: Suppress clang W=1 warning about pointer to enum conversion Jonathan Cameron
2021-11-28 17:24 ` [PATCH 02/12] iio:dc:ina2xx-adc: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 03/12] iio:adc:rcar: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 04/12] iio:adc:ti-ads1015: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 05/12] iio:amplifiers:hmc425a: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 06/12] iio:dac:mcp4725: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 07/12] iio:imu:inv_icm42600: " Jonathan Cameron
2021-11-28 17:24 ` Jonathan Cameron [this message]
2021-11-28 17:24 ` [PATCH 09/12] iio:magn:ak8975: " Jonathan Cameron
2021-11-28 17:24 ` [PATCH 10/12] iio:dummy: Drop set but unused variable len Jonathan Cameron
2021-11-28 17:24 ` [PATCH 11/12] iio:accel:bmc150: Mark structure __maybe_unused as only needed with for pm ops Jonathan Cameron
2021-11-28 17:24 ` [PATCH 12/12] iio:accel:kxcjk-1013: Mark struct __maybe_unused to avoid warning Jonathan Cameron
2021-12-06 18:18 ` [PATCH 00/12] IIO: clang W=1 warning cleanup Nathan Chancellor
2021-12-16 18:03   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211128172445.2616166-9-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=arnd@arndb.de \
    --cc=bmansuy@invensense.com \
    --cc=jmaneyrol@invensense.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=mchehab+huawei@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).