0003-xpp-sysfs-Use-const-struct-device_device-if-needed.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. From ce9de5d1bf9d21c088b01ce9da6f7ff02b0d863d Mon Sep 17 00:00:00 2001
  2. From: InterLinked1 <24227567+InterLinked1@users.noreply.github.com>
  3. Date: Mon, 23 Sep 2024 08:04:54 -0400
  4. Subject: [PATCH] xpp, sysfs: Use const struct device_device if needed.
  5. Kernel commit d69d804845985c29ab5be5a4b3b1f4787893daf8
  6. changed struct device_driver to be const, so make the
  7. arguments const on kernels 6.11 and newer.
  8. Resolves: #63
  9. Upstream: https://github.com/asterisk/dahdi-linux/pull/64
  10. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  11. ---
  12. drivers/dahdi/dahdi-sysfs-chan.c | 4 ++++
  13. drivers/dahdi/dahdi-sysfs.c | 4 ++++
  14. drivers/dahdi/xpp/xbus-sysfs.c | 8 ++++++++
  15. 3 files changed, 16 insertions(+)
  16. diff --git a/drivers/dahdi/dahdi-sysfs-chan.c b/drivers/dahdi/dahdi-sysfs-chan.c
  17. index 09d7317..35b7bd4 100644
  18. --- a/drivers/dahdi/dahdi-sysfs-chan.c
  19. +++ b/drivers/dahdi/dahdi-sysfs-chan.c
  20. @@ -220,7 +220,11 @@ static void chan_release(struct device *dev)
  21. chan_dbg(DEVICES, chan, "SYSFS\n");
  22. }
  23. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
  24. +static int chan_match(struct device *dev, const struct device_driver *driver)
  25. +#else
  26. static int chan_match(struct device *dev, struct device_driver *driver)
  27. +#endif /* LINUX_VERSION_CODE */
  28. {
  29. struct dahdi_chan *chan;
  30. diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c
  31. index 7477ebc..246514c 100644
  32. --- a/drivers/dahdi/dahdi-sysfs.c
  33. +++ b/drivers/dahdi/dahdi-sysfs.c
  34. @@ -42,7 +42,11 @@ module_param(tools_rootdir, charp, 0444);
  35. MODULE_PARM_DESC(tools_rootdir,
  36. "root directory of all tools paths (default /)");
  37. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
  38. +static int span_match(struct device *dev, const struct device_driver *driver)
  39. +#else
  40. static int span_match(struct device *dev, struct device_driver *driver)
  41. +#endif /* LINUX_VERSION_CODE */
  42. {
  43. return 1;
  44. }
  45. diff --git a/drivers/dahdi/xpp/xbus-sysfs.c b/drivers/dahdi/xpp/xbus-sysfs.c
  46. index 177048b..f78a15e 100644
  47. --- a/drivers/dahdi/xpp/xbus-sysfs.c
  48. +++ b/drivers/dahdi/xpp/xbus-sysfs.c
  49. @@ -397,7 +397,11 @@ static struct attribute *xbus_dev_attrs[] = {
  50. ATTRIBUTE_GROUPS(xbus_dev);
  51. #endif
  52. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
  53. +static int astribank_match(struct device *dev, const struct device_driver *driver)
  54. +#else
  55. static int astribank_match(struct device *dev, struct device_driver *driver)
  56. +#endif /* LINUX_VERSION_CODE */
  57. {
  58. DBG(DEVICES, "SYSFS MATCH: dev->bus_id = %s, driver->name = %s\n",
  59. dev_name(dev), driver->name);
  60. @@ -771,7 +775,11 @@ static DEVICE_ATTR_READER(refcount_xpd_show, dev, buf)
  61. return len;
  62. }
  63. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
  64. +static int xpd_match(struct device *dev, const struct device_driver *driver)
  65. +#else
  66. static int xpd_match(struct device *dev, struct device_driver *driver)
  67. +#endif /* LINUX_VERSION_CODE */
  68. {
  69. struct xpd_driver *xpd_driver;
  70. xpd_t *xpd;
  71. --
  72. 2.39.5