linux-next: build failure after merge of the driver-core tree

Stephen Rothwell
2025-01-06T04:53:37Z

[-- Attachment #1: Type: text/plain, Size: 2666 bytes --]

Hi all,

After merging the driver-core tree, today's linux-next build (powerpc
ppc64_defconfig) failed like this:

drivers/i2c/i2c-core-base.c: In function 'delete_device_store':
drivers/i2c/i2c-core-base.c:1350:58: error: passing argument 3 of 'device_find_child' from incompatible pointer type [-Wincompatible-pointer-types]
1350 | child_dev = device_find_child(&adap->dev, &addr, __i2c_find_user_addr);
| ^~~~~~~~~~~~~~~~~~~~
| |
| int (*)(struct device *, void *)
In file included from include/linux/acpi.h:14,
from drivers/i2c/i2c-core-base.c:16:
include/linux/device.h:1085:49: note: expected 'device_match_t' {aka 'int (*)(struct device *, const void *)'} but argument is of type 'int (*)(struct device *, void *)'
1085 | device_match_t match);
| ~~~~~~~~~~~~~~~^~~~~

Caused by commit

f1e8bf56320a ("driver core: Constify API device_find_child() and adapt for various usages")

interacting with commit

3cfe39b3a845 ("i2c: Replace list-based mechanism for handling userspace-created clients")

from the i2c tree.

I have applied the following merge fix patch.

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Mon, 6 Jan 2025 15:33:36 +1100
Subject: [PATCH] fix up for "driver core: Constify API device_find_child() and
adapt for various usages"

interacting with commit

3cfe39b3a845 ("i2c: Replace list-based mechanism for handling userspace-created clients")

from the i2c tree.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
drivers/i2c/i2c-core-base.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index bd90a6084fc0..c21a16aa96dc 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -1306,10 +1306,10 @@ new_device_store(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR_WO(new_device);

-static int __i2c_find_user_addr(struct device *dev, void *addrp)
+static int __i2c_find_user_addr(struct device *dev, const void *addrp)
{
struct i2c_client *client = i2c_verify_client(dev);
- unsigned short addr = *(unsigned short *)addrp;
+ unsigned short addr = *(const unsigned short *)addrp;

return client && client->flags & I2C_CLIENT_USER &&
i2c_encode_flags_to_addr(client) == addr;
--
2.45.2

--
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]