Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bernd Kuhls <bernd@kuhls.net>
To: buildroot@buildroot.org
Cc: "Yann E . MORIN" <yann.morin.1998@free.fr>
Subject: [Buildroot] [PATCH 1/1] package/dahdi-linux: fix build with kernel >= 6.3
Date: Sat, 24 Jun 2023 09:52:07 +0200	[thread overview]
Message-ID: <20230624075207.403264-1-bernd@kuhls.net> (raw)

Fixes:
http://autobuild.buildroot.net/results/2bb/2bb8a38b12cb3a7650162f1f7f65b56b20711d64/

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
 ...rivers-dahdi-fix-build-with-clang-16.patch | 106 ++++++++++++++++++
 1 file changed, 106 insertions(+)
 create mode 100644 package/dahdi-linux/0005-drivers-dahdi-fix-build-with-clang-16.patch

diff --git a/package/dahdi-linux/0005-drivers-dahdi-fix-build-with-clang-16.patch b/package/dahdi-linux/0005-drivers-dahdi-fix-build-with-clang-16.patch
new file mode 100644
index 0000000000..535e1628c9
--- /dev/null
+++ b/package/dahdi-linux/0005-drivers-dahdi-fix-build-with-clang-16.patch
@@ -0,0 +1,106 @@
+From d51c10dae5a06709983b929fc6f9fb18eec41951 Mon Sep 17 00:00:00 2001
+From: Brahmajit Das <brahmajit.xyz@gmail.com>
+Date: Thu, 22 Jun 2023 15:52:18 +0000
+Subject: [PATCH] drivers/dahdi: fix build with clang-16
+
+clang-16 enables -Werror=incompatible-pointer-types (along with buch of
+other warnings) by default, thus resulting in errors such as:
+
+/var/tmp/portage/net-misc/dahdi-3.2.0/work/dahdi-linux-3.2.0/drivers/dahdi/dahdi-sysfs.c:272:20: error: incompatible function
+      pointer types initializing 'int (*)(const struct device *, struct kobj_uevent_env *)' with an expression of type
+      'int (struct device *, struct kobj_uevent_env *)' [-Wincompatible-function-pointer-types]
+        .uevent         = span_uevent,
+                          ^~~~~~~~~~~
+/var/tmp/portage/net-misc/dahdi-3.2.0/work/dahdi-linux-3.2.0/drivers/dahdi/dahdi-sysfs.c:709:20: error: incompatible function
+      pointer types initializing 'int (*)(const struct device *, struct kobj_uevent_env *)' with an expression of type
+      'int (struct device *, struct kobj_uevent_env *)' [-Wincompatible-function-pointer-types]
+        .uevent         = device_uevent,
+                          ^~~~~~~~~~~~~
+2 errors generated.
+
+This is due the change in bus_type strcut made in upstream commit
+https://github.com/torvalds/linux/commit/2a81ada32f0e584fc0c943e0d3a8c9f4fae411d6.
+Where they make uevent take a const *, as the strcut should not be
+modifying the device that is passed into it.
+
+This patch modifes some of the fucntions parameter types, making dahdi
+possible to be built with clang-16.
+
+Bug: https://bugs.gentoo.org/906179
+Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
+
+Upstream: https://github.com/asterisk/dahdi-linux/pull/21
+
+Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
+---
+ drivers/dahdi/dahdi-sysfs.c    | 8 ++++----
+ drivers/dahdi/wctc4xxp/base.c  | 2 +-
+ drivers/dahdi/xpp/xbus-sysfs.c | 2 +-
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c
+index ca29ddba..0c5bd982 100644
+--- a/drivers/dahdi/dahdi-sysfs.c
++++ b/drivers/dahdi/dahdi-sysfs.c
+@@ -47,7 +47,7 @@ static int span_match(struct device *dev, struct device_driver *driver)
+ 	return 1;
+ }
+ 
+-static inline struct dahdi_span *dev_to_span(struct device *dev)
++static inline struct dahdi_span *dev_to_span(const struct device *dev)
+ {
+ 	return dev_get_drvdata(dev);
+ }
+@@ -68,7 +68,7 @@ static inline struct dahdi_span *dev_to_span(struct device *dev)
+ 			return err;				\
+ 	} while (0)
+ 
+-static int span_uevent(struct device *dev, struct kobj_uevent_env *kenv)
++static int span_uevent(const struct device *dev, struct kobj_uevent_env *kenv)
+ {
+ 	struct dahdi_span *span;
+ 
+@@ -415,7 +415,7 @@ static struct {
+ 	unsigned int clean_chardev:1;
+ } should_cleanup;
+ 
+-static inline struct dahdi_device *to_ddev(struct device *dev)
++static inline struct dahdi_device *to_ddev(const struct device *dev)
+ {
+ 	return container_of(dev, struct dahdi_device, dev);
+ }
+@@ -438,7 +438,7 @@ static inline struct dahdi_device *to_ddev(struct device *dev)
+ 			return err;				\
+ 	} while (0)
+ 
+-static int device_uevent(struct device *dev, struct kobj_uevent_env *kenv)
++static int device_uevent(const struct device *dev, struct kobj_uevent_env *kenv)
+ {
+ 	struct dahdi_device *ddev;
+ 
+diff --git a/drivers/dahdi/wctc4xxp/base.c b/drivers/dahdi/wctc4xxp/base.c
+index ec6fc436..db70ea7e 100644
+--- a/drivers/dahdi/wctc4xxp/base.c
++++ b/drivers/dahdi/wctc4xxp/base.c
+@@ -643,7 +643,7 @@ wctc4xxp_net_register(struct wcdte *wc)
+ 		return -ENOMEM;
+ 	priv = netdev_priv(netdev);
+ 	priv->wc = wc;
+-	memcpy(netdev->dev_addr, our_mac, sizeof(our_mac));
++	memcpy((void *)netdev->dev_addr, our_mac, sizeof(our_mac));
+ 
+ #	ifdef HAVE_NET_DEVICE_OPS
+ 	netdev->netdev_ops = &wctc4xxp_netdev_ops;
+diff --git a/drivers/dahdi/xpp/xbus-sysfs.c b/drivers/dahdi/xpp/xbus-sysfs.c
+index d8c11dc3..29ad3619 100644
+--- a/drivers/dahdi/xpp/xbus-sysfs.c
++++ b/drivers/dahdi/xpp/xbus-sysfs.c
+@@ -418,7 +418,7 @@ static int astribank_match(struct device *dev, struct device_driver *driver)
+ 			return err;				\
+ 	} while (0)
+ 
+-static int astribank_uevent(struct device *dev, struct kobj_uevent_env *kenv)
++static int astribank_uevent(const struct device *dev, struct kobj_uevent_env *kenv)
+ {
+ 	xbus_t *xbus;
+ 	extern char *initdir;
-- 
2.39.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

             reply	other threads:[~2023-06-24  7:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-24  7:52 Bernd Kuhls [this message]
2023-06-24 14:04 ` [Buildroot] [PATCH 1/1] package/dahdi-linux: fix build with kernel >= 6.3 Yann E. MORIN
2023-07-06 11:49 ` Peter Korsgaard
  -- strict thread matches above, loose matches on Subject: below --
2023-07-09 18:02 [Buildroot] [PATCH 1/1] package/dahdi-linux: fix build with kernel < 6.3 Bernd Kuhls
2023-07-10 16:14 ` Thomas Petazzoni via buildroot
2023-07-17 14:33 ` Peter Korsgaard

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=20230624075207.403264-1-bernd@kuhls.net \
    --to=bernd@kuhls.net \
    --cc=buildroot@buildroot.org \
    --cc=yann.morin.1998@free.fr \
    /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