Subject: Re: linux-next: Tree for Apr 3

From: Nathan Chancellor <[email-masked]>
Date: Mon, 3 Apr 2023 08:51:47 -0700

Hi Stephen (and Greg, just as an FYI):

On Mon, Apr 03, 2023 at 08:24:12PM +1000, Stephen Rothwell wrote:

...

> Merging driver-core/driver-core-next (43ba3d4af7a7 pktcdvd: simplify the class_pktcdvd logic)

...

> Merging char-misc/char-misc-next (48a6c7bced2a cdx: add device attributes)

There is a semantic conflict between these two trees:

  drivers/cdx/cdx.c:393:8: error: incompatible function pointer types initializing 'ssize_t (*)(const struct bus_type *, const char *, size_t)' (aka 'long (*)(const struct bus_type *, const char *, unsigned long)') with an expression of type
   'ssize_t (struct bus_type *, const char *, size_t)' (aka 'long (struct bus_type *, const char *, unsigned long)') [-Wincompatible-function-pointer-types]
  static BUS_ATTR_WO(rescan);
         ^~~~~~~~~~~~~~~~~~~
  include/linux/device/bus.h:129:42: note: expanded from macro 'BUS_ATTR_WO'
          struct bus_attribute bus_attr_##_name = __ATTR_WO(_name)
                                                  ^~~~~~~~~~~~~~~~
  include/linux/sysfs.h:135:11: note: expanded from macro '__ATTR_WO'
          .store  = _name##_store,                                        \
                    ^~~~~~~~~~~~~
  <scratch space>:30:1: note: expanded from here
  rescan_store
  ^~~~~~~~~~~~
  1 error generated.

caused by commit 75cff725d956 ("driver core: bus: mark the struct
bus_type for sysfs callbacks as constant") in the driver-core tree
interacting with commit 2959ab247061 ("cdx: add the cdx bus driver") in
the char-misc tree. The following diff fixes it for me, could it be
applied to the merge of the char-misc tree (if I am reading the order of
your merges correctly)?

If there is a better or more appropriate way to report this, please let
me know.

Cheers,
Nathan

diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c
index 67c32cb2c006..38511fd36325 100644
--- a/drivers/cdx/cdx.c
+++ b/drivers/cdx/cdx.c
@@ -363,7 +363,7 @@ static struct attribute *cdx_dev_attrs[] = {
 };
 ATTRIBUTE_GROUPS(cdx_dev);
 
-static ssize_t rescan_store(struct bus_type *bus,
+static ssize_t rescan_store(const struct bus_type *bus,
 			    const char *buf, size_t count)
 {
 	struct cdx_controller *cdx;