diff options
-rw-r--r-- | .SRCINFO | 5 | ||||
-rw-r--r-- | 0009-kernel-5.14-task_struct.state-unsigned-tty.patch | 174 | ||||
-rw-r--r-- | PKGBUILD | 12 |
3 files changed, 189 insertions, 2 deletions
@@ -1,7 +1,7 @@ pkgbase = npreal2 pkgdesc = real tty driver for Moxa NPort serial console terminal server pkgver = 5.0 - pkgrel = 5 + pkgrel = 6 url = https://www.moxa.com/en/products/industrial-edge-connectivity/serial-device-servers/terminal-servers/nport-6100-6200-series install = npreal2-install.sh arch = i686 @@ -26,6 +26,7 @@ pkgbase = npreal2 source = 0006-kernel-5.12-tty-low_latency.patch source = 0007-tty_unregister_driver-void.patch source = 0008-kernel-5.13-dropped-tty_check_change.patch + source = 0009-kernel-5.14-task_struct.state-unsigned-tty.patch source = npreal2.sh md5sums = 4ba260f2e3b2b25419bd40a5f030d926 md5sums = 043dac91330a15c38e41bb2e2e1d5598 @@ -36,6 +37,7 @@ pkgbase = npreal2 md5sums = d8a5ab4731575a4ffe90656e1793b46b md5sums = e8c288232d6e2174c165e8f5e098a05d md5sums = d5da78ee96047557af03b6e496164160 + md5sums = 16504fb58a0416a26fe04e8e3d9867a7 md5sums = 90ac27b669542c11b0a9b6763f6e0d9b sha256sums = 33da5d4b1ff9853e9d58c7905f1fdf09a3e284658f42437210155c4c913f4dad sha256sums = 7039ca0740be34a641424e3f57b896902f61fdfd2bfcc26e8e954035849e9605 @@ -46,6 +48,7 @@ pkgbase = npreal2 sha256sums = 252ce8e55b835c22e6fdf4e3c661ef906be41fdf9dfc76900d787907892e6f21 sha256sums = d35d49ab325a17976d26d64661a235fc5c8f0e0ce6c7e86483607654e94d5b22 sha256sums = f8496f2e62a4e57d57df5ce27d2bd92eed234581331c8ee6b7b9e139e0e7ac13 + sha256sums = 7c9380a794725418015d62411f697850096b3c8a62666f5ec9e562e93ba3ee4c sha256sums = 13e297691ba1b6504f66ef98e072194343321d2a47928c3964e315160b246153 pkgname = npreal2 diff --git a/0009-kernel-5.14-task_struct.state-unsigned-tty.patch b/0009-kernel-5.14-task_struct.state-unsigned-tty.patch new file mode 100644 index 000000000000..ae32fa3e2872 --- /dev/null +++ b/0009-kernel-5.14-task_struct.state-unsigned-tty.patch @@ -0,0 +1,174 @@ +--- npreal2.c.orig 2021-09-12 22:09:13.005831652 -0400 ++++ npreal2.c 2021-09-12 22:09:48.825927630 -0400 +@@ -406,14 +406,22 @@ static int npreal_init_tty(void); + static void npreal_do_softint(struct work_struct *work); + static void npreal_flush_to_ldisc(struct work_struct *work); + static int npreal_open(struct tty_struct *,struct file *); + static void npreal_close(struct tty_struct *,struct file *); + static int npreal_write(struct tty_struct *,const unsigned char *,int); ++#if LINUX_VERSION_CODE >= VERSION_CODE(5,14,0) ++static unsigned int npreal_write_room(struct tty_struct *); ++#else + static int npreal_write_room(struct tty_struct *); ++#endif + static void npreal_flush_buffer(struct tty_struct *); + static void npreal_ldisc_flush_buffer(struct tty_struct *); ++#if LINUX_VERSION_CODE >= VERSION_CODE(5,14,0) ++static unsigned int npreal_chars_in_buffer(struct tty_struct *); ++#else + static int npreal_chars_in_buffer(struct tty_struct *); ++#endif + static void npreal_flush_chars(struct tty_struct *); + static int npreal_put_char(struct tty_struct *,unsigned char); + static int npreal_ioctl(struct tty_struct *,uint,ulong); + static void npreal_throttle(struct tty_struct *); + static void npreal_unthrottle(struct tty_struct *); +@@ -1054,11 +1062,11 @@ npreal_close( + } + else if (ret < 0) + break; + else + cnt = 0; +- current->state = TASK_INTERRUPTIBLE; ++ set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(HZ/100); + } + } + npreal_flush_buffer(tty); + if ( tty->ldisc->ops->flush_buffer ) +@@ -1205,11 +1213,15 @@ static void npreal_wait_until_sent(struc + if ((info = (struct npreal_struct *)tty->driver_data)) + npreal_wait_oqueue(info,timeout); + + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) ++static unsigned int npreal_write_room(struct tty_struct * tty) ++#else + static int npreal_write_room(struct tty_struct * tty) ++#endif + { + struct npreal_struct *info = (struct npreal_struct *)tty->driver_data; + int ret; + + DBGPRINT(MX_DEBUG_LOUD, "(Entry)\n"); +@@ -1222,11 +1234,15 @@ static int npreal_write_room(struct tty_ + if ( ret < 0 ) + ret = 0; + return(ret); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) ++static unsigned int npreal_chars_in_buffer(struct tty_struct * tty) ++#else + static int npreal_chars_in_buffer(struct tty_struct * tty) ++#endif + { + struct npreal_struct *info = (struct npreal_struct *)tty->driver_data; + + DBGPRINT(MX_DEBUG_LOUD, "(Entry)\n"); + +@@ -1315,11 +1331,11 @@ static void npreal_ldisc_flush_buffer(st + nd->cmd_ready = 1; + if ( waitqueue_active(&nd->select_ex_wait)) + { + wake_up_interruptible( &nd->select_ex_wait ); + } +- current->state = TASK_INTERRUPTIBLE; ++ set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(HZ/100); + } + + #if LINUX_VERSION_CODE >= VERSION_CODE(5,13,0) + int tty_check_change(struct tty_struct *tty); +@@ -1471,11 +1487,11 @@ static int npreal_ioctl(struct tty_struc + cprev = cnow; + // Scott: 2005-09-04 add begin + schedule(); + // Scott: 2005-09-04 add end + } +- current->state = TASK_RUNNING; ++ set_current_state(TASK_RUNNING); + remove_wait_queue(&info->delta_msr_wait, &wait); + // Scott: 2005-09-04 + // Scott break; + return ret; + } +@@ -1807,11 +1823,11 @@ retval = -EAGAIN; + retval = -EIO; + break; + } + schedule(); + } +- current->state = TASK_RUNNING; ++ set_current_state(TASK_RUNNING); + remove_wait_queue(&info->open_wait, &wait); + if ( retval ) + return(retval); + info->flags |= ASYNC_NORMAL_ACTIVE; + return(0); +@@ -1844,11 +1860,11 @@ static int npreal_startup(struct npreal_ + DBGPRINT(MX_DEBUG_ERROR, "signal_pending break\n"); + break; + } + schedule(); + } +- current->state = TASK_RUNNING; ++ set_current_state(TASK_RUNNING); + remove_wait_queue(&nd->initialize_wait, &wait); + + // Scott: 2005/07/13 + // Set tty->driver_data before entering npreal_startup(), so that the tty driver + // can decrease refcount if npreal_startup() failed, by calling npreal_close(). +@@ -1991,11 +2007,11 @@ static int npreal_startup(struct npreal_ + goto startup_err; + } + + while ((nd->cmd_ready == 1)&&(cnt++ < 10)) + { +- current->state = TASK_INTERRUPTIBLE; ++ set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(HZ/100); + } + } + /* + * and set the speed of the serial port +@@ -2104,11 +2120,11 @@ static void npreal_shutdown(struct nprea + + while (test_and_set_bit(NPREAL_NET_DO_INITIALIZE,&nd->flag)) + { + if ( signal_pending(current) ) + break; +- current->state = TASK_INTERRUPTIBLE; ++ set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(HZ/100); + } + + + if ( !(info->flags & ASYNC_INITIALIZED) ) +@@ -3067,11 +3083,11 @@ static void npreal_send_break(struct npr + if (!(nd = info->net_node)) + return; + + npreal_start_break(nd); + +- current->state = TASK_INTERRUPTIBLE; ++ set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(duration); + + npreal_stop_break(nd); + + } +@@ -4095,11 +4111,11 @@ npreal_wait_and_set_command( + return (0); + } + else + { + up (&nd->cmd_semaphore); +- current->state = TASK_INTERRUPTIBLE; ++ set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(1); + } + } + } + /* @@ -81,7 +81,7 @@ set -u pkgname='npreal2' #pkgver='1.18.49'; _commit='6d9ef0dbafd487595c4f5e4e5e64c1faba98d060' pkgver='5.0'; # _build='17110917' -pkgrel='5' +pkgrel='6' pkgdesc='real tty driver for Moxa NPort serial console terminal server' _pkgdescshort="Moxa NPort ${pkgname} TTY driver" arch=('i686' 'x86_64') @@ -105,6 +105,7 @@ source=( '0006-kernel-5.12-tty-low_latency.patch' '0007-tty_unregister_driver-void.patch' '0008-kernel-5.13-dropped-tty_check_change.patch' + '0009-kernel-5.14-task_struct.state-unsigned-tty.patch' 'npreal2.sh' ) #_srcdir="${pkgname}" @@ -120,6 +121,7 @@ md5sums=('4ba260f2e3b2b25419bd40a5f030d926' 'd8a5ab4731575a4ffe90656e1793b46b' 'e8c288232d6e2174c165e8f5e098a05d' 'd5da78ee96047557af03b6e496164160' + '16504fb58a0416a26fe04e8e3d9867a7' '90ac27b669542c11b0a9b6763f6e0d9b') sha256sums=('33da5d4b1ff9853e9d58c7905f1fdf09a3e284658f42437210155c4c913f4dad' '7039ca0740be34a641424e3f57b896902f61fdfd2bfcc26e8e954035849e9605' @@ -130,6 +132,7 @@ sha256sums=('33da5d4b1ff9853e9d58c7905f1fdf09a3e284658f42437210155c4c913f4dad' '252ce8e55b835c22e6fdf4e3c661ef906be41fdf9dfc76900d787907892e6f21' 'd35d49ab325a17976d26d64661a235fc5c8f0e0ce6c7e86483607654e94d5b22' 'f8496f2e62a4e57d57df5ce27d2bd92eed234581331c8ee6b7b9e139e0e7ac13' + '7c9380a794725418015d62411f697850096b3c8a62666f5ec9e562e93ba3ee4c' '13e297691ba1b6504f66ef98e072194343321d2a47928c3964e315160b246153') if [ "${_opt_DKMS}" -ne 0 ]; then @@ -271,6 +274,13 @@ prepare() { #diff -pNau5 'npreal2.c'{.orig,} > '0008-kernel-5.13-dropped-tty_check_change.patch' patch -Nbup0 -i "${srcdir}/0008-kernel-5.13-dropped-tty_check_change.patch" + # unsigned write_room https://www.spinics.net/lists/linux-serial/msg42297.html + # unsigned chars_in_buffer https://www.spinics.net/lists/linux-serial/msg42299.html + # set_current_state https://linux-kernel.vger.kernel.narkive.com/xnPfKhYP/patch-2-5-52-use-set-current-state-instead-of-current-state-take-1 + #rm -f *.orig; cp -p 'npreal2.c'{,.orig}; false + #diff -pNau5 'npreal2.c'{.orig,} > '0009-kernel-5.14-task_struct.state-unsigned-tty.patch' + patch -Nbup0 -i "${srcdir}/0009-kernel-5.14-task_struct.state-unsigned-tty.patch" + # Apply PKGBUILD options sed -e 's:^\(ttymajor\)=.*:'"\1=${_opt_ttymajor}:g" \ -e 's:^\(calloutmajor\)=.*:'"\1=${_opt_calloutmajor}:g" \ |