2023-08-10 11:15:46

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 1/9] mfd: stmpe: Fix Wvoid-pointer-to-enum-cast warning

'partnum' is an enum, thus cast of pointer on 64-bit compile test with W=1
causes:

stmpe-i2c.c:90:13: error: cast to smaller integer type 'enum stmpe_partnum' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/mfd/stmpe-i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c
index 1d7b401776d1..fe018bedab98 100644
--- a/drivers/mfd/stmpe-i2c.c
+++ b/drivers/mfd/stmpe-i2c.c
@@ -87,7 +87,7 @@ stmpe_i2c_probe(struct i2c_client *i2c)
dev_info(&i2c->dev, "matching on node name, compatible is preferred\n");
partnum = id->driver_data;
} else
- partnum = (enum stmpe_partnum)of_id->data;
+ partnum = (uintptr_t)of_id->data;

return stmpe_probe(&i2c_ci, partnum);
}
--
2.34.1



2023-08-10 11:19:25

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 9/9] mfd: mxs-lradc: Fix Wvoid-pointer-to-enum-cast warning

'soc' is an enum, thus cast of pointer on 64-bit compile test with W=1
causes:

mxs-lradc.c:145:15: error: cast to smaller integer type 'enum mxs_lradc_id' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/mfd/mxs-lradc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c
index 111d11fd25aa..21f3033d6eb5 100644
--- a/drivers/mfd/mxs-lradc.c
+++ b/drivers/mfd/mxs-lradc.c
@@ -142,7 +142,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
if (!of_id)
return -EINVAL;

- lradc->soc = (enum mxs_lradc_id)of_id->data;
+ lradc->soc = (uintptr_t)of_id->data;

lradc->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(lradc->clk)) {
--
2.34.1


2023-08-10 11:20:32

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 3/9] mfd: max77541: Fix Wvoid-pointer-to-enum-cast warning

'id' is an enum, thus cast of pointer on 64-bit compile test with W=1
causes:

max77541.c:176:18: error: cast to smaller integer type 'enum max7754x_ids' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/mfd/max77541.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/max77541.c b/drivers/mfd/max77541.c
index e147e949c2b3..10c2e274b4af 100644
--- a/drivers/mfd/max77541.c
+++ b/drivers/mfd/max77541.c
@@ -173,7 +173,7 @@ static int max77541_probe(struct i2c_client *client)
i2c_set_clientdata(client, max77541);
max77541->i2c = client;

- max77541->id = (enum max7754x_ids)device_get_match_data(dev);
+ max77541->id = (uintptr_t)device_get_match_data(dev);
if (!max77541->id)
max77541->id = (enum max7754x_ids)id->driver_data;

--
2.34.1


2023-08-10 12:12:39

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 8/9] mfd: wm31x: Fix Wvoid-pointer-to-enum-cast warning

'type' is an enum, thus cast of pointer on 64-bit compile test with
W=1 causes:

wm831x-spi.c:36:10: error: cast to smaller integer type 'enum wm831x_parent' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/mfd/wm831x-i2c.c | 2 +-
drivers/mfd/wm831x-spi.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/wm831x-i2c.c b/drivers/mfd/wm831x-i2c.c
index 997837f13180..694ddbbf0372 100644
--- a/drivers/mfd/wm831x-i2c.c
+++ b/drivers/mfd/wm831x-i2c.c
@@ -36,7 +36,7 @@ static int wm831x_i2c_probe(struct i2c_client *i2c)
dev_err(&i2c->dev, "Failed to match device\n");
return -ENODEV;
}
- type = (enum wm831x_parent)of_id->data;
+ type = (uintptr_t)of_id->data;
} else {
type = (enum wm831x_parent)id->driver_data;
}
diff --git a/drivers/mfd/wm831x-spi.c b/drivers/mfd/wm831x-spi.c
index 7bcddccbf155..76be7ef5c970 100644
--- a/drivers/mfd/wm831x-spi.c
+++ b/drivers/mfd/wm831x-spi.c
@@ -33,7 +33,7 @@ static int wm831x_spi_probe(struct spi_device *spi)
dev_err(&spi->dev, "Failed to match device\n");
return -ENODEV;
}
- type = (enum wm831x_parent)of_id->data;
+ type = (uintptr_t)of_id->data;
} else {
type = (enum wm831x_parent)id->driver_data;
}
--
2.34.1


2023-08-19 12:30:02

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 1/9] mfd: stmpe: Fix Wvoid-pointer-to-enum-cast warning

On Thu, 10 Aug 2023 11:58:41 +0200, Krzysztof Kozlowski wrote:
> 'partnum' is an enum, thus cast of pointer on 64-bit compile test with W=1
> causes:
>
> stmpe-i2c.c:90:13: error: cast to smaller integer type 'enum stmpe_partnum' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
>
>

Applied, thanks!

[1/9] mfd: stmpe: Fix Wvoid-pointer-to-enum-cast warning
commit: ee1a91ee7729b56535bce753c5a8146ec58aa0c6
[2/9] mfd: max14577: Fix Wvoid-pointer-to-enum-cast warning
commit: e3569bd687ebbb35339aa8699311c28770d3a3b6
[3/9] mfd: max77541: Fix Wvoid-pointer-to-enum-cast warning
commit: d964ac59516ca77c0761d73681d7975e33ddfeae
[4/9] mfd: hi6421-pmic: Fix Wvoid-pointer-to-enum-cast warning
commit: bbf26b17476c8528a3dc903f5550e89bdca7aa72
[5/9] mfd: lp87565: Fix Wvoid-pointer-to-enum-cast warning
commit: d3cf4d705563d26e02e8997cc2cf297542abdadf
[6/9] mfd: tc3589: Fix Wvoid-pointer-to-enum-cast warning
commit: 499e6c7904a5d1860651ec2437a9873e2b9aa1f0
[7/9] mfd: wm8994: Fix Wvoid-pointer-to-enum-cast warning
commit: b53cd2fb2769dd8c082adaaa8f1746265a9ca732
[8/9] mfd: wm31x: Fix Wvoid-pointer-to-enum-cast warning
commit: a79c1c76d726c5af9cf925ee0a5b934bd17c1496
[9/9] mfd: mxs-lradc: Fix Wvoid-pointer-to-enum-cast warning
commit: 243cd47f753d57e1d6d11449056a437052560b84

--
Lee Jones [李琼斯]