xr_usb_serial_common: fix compilation warning
authorChristian Marangi <redacted>
Sun, 14 May 2023 14:48:38 +0000 (16:48 +0200)
committerChristian Marangi <redacted>
Sun, 14 May 2023 14:51:49 +0000 (16:51 +0200)
Add patch fixing compilation warning due to unused function.
Fix compilation warning:
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/usb-serial-xr_usb_serial_common-2022-03-30-ecc6ebe0/xr_usb_serial_common-1a/xr_usb_serial_common.c: In function 'xr_usb_serial_ctrl_irq':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/usb-serial-xr_usb_serial_common-2022-03-30-ecc6ebe0/xr_usb_serial_common-1a/xr_usb_serial_common.c:261:28: error: unused variable 'tty' [-Werror=unused-variable]
  261 |         struct tty_struct *tty;
      |                            ^~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/usb-serial-xr_usb_serial_common-2022-03-30-ecc6ebe0/xr_usb_serial_common-1a/xr_usb_serial_common.c: In function 'xr_usb_serial_process_read_urb':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/usb-serial-xr_usb_serial_common-2022-03-30-ecc6ebe0/xr_usb_serial_common-1a/xr_usb_serial_common.c:393:28: error: unused variable 'tty' [-Werror=unused-variable]
  393 |         struct tty_struct *tty;
      |                            ^~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/usb-serial-xr_usb_serial_common-2022-03-30-ecc6ebe0/xr_usb_serial_common-1a/xr_usb_serial_common.c: In function 'xr_usb_serial_softint':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/usb-serial-xr_usb_serial_common-2022-03-30-ecc6ebe0/xr_usb_serial_common-1a/xr_usb_serial_common.c:468:28: error: unused variable 'tty' [-Werror=unused-variable]
  468 |         struct tty_struct *tty;
      |                            ^~~
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/usb-serial-xr_usb_serial_common-2022-03-30-ecc6ebe0/xr_usb_serial_common-1a/xr_usb_serial_common.c: In function 'xr_usb_serial_reset_resume':
/home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/usb-serial-xr_usb_serial_common-2022-03-30-ecc6ebe0/xr_usb_serial_common-1a/xr_usb_serial_common.c:1634:28: error: unused variable 'tty' [-Werror=unused-variable]
 1634 |         struct tty_struct *tty;
      |                            ^~~
cc1: all warnings being treated as errors

Signed-off-by: Christian Marangi <redacted>
libs/xr_usb_serial_common/patches/100-fix-compilation-warning-unused-function.patch [new file with mode: 0644]

diff --git a/libs/xr_usb_serial_common/patches/100-fix-compilation-warning-unused-function.patch b/libs/xr_usb_serial_common/patches/100-fix-compilation-warning-unused-function.patch
new file mode 100644 (file)
index 0000000..4e92f7a
--- /dev/null
@@ -0,0 +1,42 @@
+--- a/xr_usb_serial_common-1a/xr_usb_serial_common.c
++++ b/xr_usb_serial_common-1a/xr_usb_serial_common.c
+@@ -258,7 +258,9 @@ static void xr_usb_serial_ctrl_irq(struct urb *urb)
+ {
+       struct xr_usb_serial *xr_usb_serial = urb->context;
+       struct usb_cdc_notification *dr = urb->transfer_buffer;
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 9, 0)
+       struct tty_struct *tty;
++#endif
+       unsigned char *data;
+       int newctrl;
+       int retval;
+@@ -390,7 +392,9 @@ static int xr_usb_serial_submit_read_urbs(struct xr_usb_serial *xr_usb_serial, g
+ }
+ static void xr_usb_serial_process_read_urb(struct xr_usb_serial *xr_usb_serial, struct urb *urb)
+ {
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 9, 0)
+       struct tty_struct *tty;
++#endif
+       if (!urb->actual_length)
+               return;
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(3, 9, 0)    
+@@ -465,7 +469,9 @@ static void xr_usb_serial_write_bulk(struct urb *urb)
+ static void xr_usb_serial_softint(struct work_struct *work)
+ {
+       struct xr_usb_serial *xr_usb_serial = container_of(work, struct xr_usb_serial, work);
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 9, 0)
+       struct tty_struct *tty;
++#endif
+       
+       dev_vdbg(&xr_usb_serial->data->dev, "%s\n", __func__);
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(3, 9, 0)
+@@ -1631,7 +1637,9 @@ err_out:
+ static int xr_usb_serial_reset_resume(struct usb_interface *intf)
+ {
+       struct xr_usb_serial *xr_usb_serial = usb_get_intfdata(intf);
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 9, 0)
+       struct tty_struct *tty;
++#endif
+       if (tty_port_initialized(&xr_usb_serial->port)){
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(3, 9, 0)      
+       tty_port_tty_hangup(&xr_usb_serial->port, false);
git clone https://git.99rst.org/PROJECT