Skip to content

New Config #1

@satiowadahc

Description

@satiowadahc

Git won't let me push but for a newer kernel:

diff --git a/Exar_USB_Serial_Kernel_Driver/modules.order b/Exar_USB_Serial_Kernel_Driver/modules.order
index 2b22310..02a727d 100644
--- a/Exar_USB_Serial_Kernel_Driver/modules.order
+++ b/Exar_USB_Serial_Kernel_Driver/modules.order
@@ -1 +1 @@
-kernel//mnt/Xavier_SSD/Ros_Workspace/Teknic-ClearPath-SC-ROS/Exar_USB_Serial_Kernel_Driver/xr_usb_serial_common.ko
+/home/artie/Documents/Teknic-ClearPath-SC-ROS/Exar_USB_Serial_Kernel_Driver/xr_usb_serial_common.ko
diff --git a/Exar_USB_Serial_Kernel_Driver/xr_usb_serial_common.c b/Exar_USB_Serial_Kernel_Driver/xr_usb_serial_common.c
index f8fe9e5..e914f5c 100644
--- a/Exar_USB_Serial_Kernel_Driver/xr_usb_serial_common.c
+++ b/Exar_USB_Serial_Kernel_Driver/xr_usb_serial_common.c
@@ -690,7 +690,11 @@ static int xr_usb_serial_tty_write(struct tty_struct *tty,
 	return count;
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0)
+static unsigned int xr_usb_serial_tty_write_room(struct tty_struct *tty) 
+#else
 static int xr_usb_serial_tty_write_room(struct tty_struct *tty)
+#endif
 {
 	struct xr_usb_serial *xr_usb_serial = tty->driver_data;
 	/*
@@ -700,7 +704,11 @@ static int xr_usb_serial_tty_write_room(struct tty_struct *tty)
 	return xr_usb_serial_wb_is_avail(xr_usb_serial) ? xr_usb_serial->writesize : 0;
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0)
+static unsigned int xr_usb_serial_tty_chars_in_buffer(struct tty_struct *tty)
+#else
 static int xr_usb_serial_tty_chars_in_buffer(struct tty_struct *tty)
+#endif
 {
 	struct xr_usb_serial *xr_usb_serial = tty->driver_data;
 	/*
@@ -1771,9 +1779,15 @@ static const struct tty_operations xr_usb_serial_ops = {
 static int __init xr_usb_serial_init(void)
 {
 	int retval;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
+	xr_usb_serial_tty_driver = tty_alloc_driver(XR_USB_SERIAL_TTY_MINORS, 0);
+	if (IS_ERR(xr_usb_serial_tty_driver))
+		return PTR_ERR(xr_usb_serial_tty_driver);
+#else
 	xr_usb_serial_tty_driver = alloc_tty_driver(XR_USB_SERIAL_TTY_MINORS);
 	if (!xr_usb_serial_tty_driver)
 		return -ENOMEM;
+#endif
 	xr_usb_serial_tty_driver->driver_name = "xr_usb_serial",
 	xr_usb_serial_tty_driver->name = "ttyXRUSB",
 	xr_usb_serial_tty_driver->major = XR_USB_SERIAL_TTY_MAJOR,
@@ -1788,14 +1802,22 @@ static int __init xr_usb_serial_init(void)
 
 	retval = tty_register_driver(xr_usb_serial_tty_driver);
 	if (retval) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
+		tty_driver_kref_put(xr_usb_serial_tty_driver);
+#else
 		put_tty_driver(xr_usb_serial_tty_driver);
+#endif
 		return retval;
 	}
 
 	retval = usb_register(&xr_usb_serial_driver);
 	if (retval) {
 		tty_unregister_driver(xr_usb_serial_tty_driver);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
+		tty_driver_kref_put(xr_usb_serial_tty_driver);
+#else
 		put_tty_driver(xr_usb_serial_tty_driver);
+#endif
 		return retval;
 	}
 
@@ -1808,7 +1830,11 @@ static void __exit xr_usb_serial_exit(void)
 {
 	usb_deregister(&xr_usb_serial_driver);
 	tty_unregister_driver(xr_usb_serial_tty_driver);
-	put_tty_driver(xr_usb_serial_tty_driver);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
+		tty_driver_kref_put(xr_usb_serial_tty_driver);
+#else
+		put_tty_driver(xr_usb_serial_tty_driver);
+#endif
 }
 
 module_init(xr_usb_serial_init);

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions