From patchwork Thu Aug 8 10:35:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13757233 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8116718CBEF; Thu, 8 Aug 2024 10:36:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723113366; cv=none; b=QHJes9VTvTwFJ19yiSPWZHbudXkW1Ns4VTWptpQkLs+rZsNwHZXoYnvntQ1V2KrDM9SVaJCc4XE0p6Z9n7z9gOg5bNZK2eMLBiqJvWvmeUqur8CUakqCdGgyD/P31kEMCMMTAOQ2uXIl7FWV2AHXOMVe3o6G/8jjbS6KqN5uR1o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723113366; c=relaxed/simple; bh=XMtS7BNBLhEAuyOCgzkGacTJE3MPL9++t9/+8In/5Vw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VO/l+y0tr4mdN+BEjvfMmjeUWy3z7qKqNCv0EyTWEGAXVD24Sgo40PAOO9kSlRtZWEF780Uinyp8NoRnjHdWtRI/RlxNFhRy0wqDlMHoxA0ShQ+TnMMSsdNQ9tvUtA3oY1to/npvD0GjPRwKjghUJLmJx/7xUd3FxX7s5sCENVY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jT4hN861; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jT4hN861" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEB0AC4AF0D; Thu, 8 Aug 2024 10:36:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723113366; bh=XMtS7BNBLhEAuyOCgzkGacTJE3MPL9++t9/+8In/5Vw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jT4hN8619cQ3Q6bDgfAaSHdLt1SK/2IahR36hh7yUXRPGTTjw/TSwkNoT1+ehi562 iFXRTEJRRtyfxaxYOcDpFiKCtlrF+PcvwYuWLLkbe2U/Ulpze+L+MyZkYUgUpL29oO o8I+o/OXIwGpcitCHKIiJb9yk237grDSecLBc7AyOp0Ryez3jLVdxeKwHMg+Amly9e genIxkal3CsuwJPg5HCxIvayLp1CL13RgPK6XEWQ30U4GWc6Sy22QI7/h3Q0tn/q9R 7eoRooIgHPAR6cDKs1hI7eTMy7V110AN3X4JTED6Xu2GTStp23Ajx73sBU1tLcMOYT XXmY/QVSiefsg== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Jeremy Kerr , Matt Johnston , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Subject: [PATCH v2 06/11] mctp: serial: propagage new tty types Date: Thu, 8 Aug 2024 12:35:42 +0200 Message-ID: <20240808103549.429349-7-jirislaby@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240808103549.429349-1-jirislaby@kernel.org> References: <20240808103549.429349-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org In tty, u8 is now used for data, ssize_t for sizes (with possible negative error codes). Propagate these types (and use unsigned in next_chunk_len()) to mctp. Signed-off-by: Jiri Slaby (SUSE) Reviewed-by: Jeremy Kerr Cc: Greg Kroah-Hartman Cc: Jeremy Kerr Cc: Matt Johnston Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: netdev@vger.kernel.org --- drivers/net/mctp/mctp-serial.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/net/mctp/mctp-serial.c b/drivers/net/mctp/mctp-serial.c index 5bf6fdff701c..78bd59b0930d 100644 --- a/drivers/net/mctp/mctp-serial.c +++ b/drivers/net/mctp/mctp-serial.c @@ -64,18 +64,18 @@ struct mctp_serial { u16 txfcs, rxfcs, rxfcs_rcvd; unsigned int txlen, rxlen; unsigned int txpos, rxpos; - unsigned char txbuf[BUFSIZE], + u8 txbuf[BUFSIZE], rxbuf[BUFSIZE]; }; -static bool needs_escape(unsigned char c) +static bool needs_escape(u8 c) { return c == BYTE_ESC || c == BYTE_FRAME; } -static int next_chunk_len(struct mctp_serial *dev) +static unsigned int next_chunk_len(struct mctp_serial *dev) { - int i; + unsigned int i; /* either we have no bytes to send ... */ if (dev->txpos == dev->txlen) @@ -99,7 +99,7 @@ static int next_chunk_len(struct mctp_serial *dev) return i; } -static int write_chunk(struct mctp_serial *dev, unsigned char *buf, int len) +static ssize_t write_chunk(struct mctp_serial *dev, u8 *buf, size_t len) { return dev->tty->ops->write(dev->tty, buf, len); } @@ -108,9 +108,10 @@ static void mctp_serial_tx_work(struct work_struct *work) { struct mctp_serial *dev = container_of(work, struct mctp_serial, tx_work); - unsigned char c, buf[3]; unsigned long flags; - int len, txlen; + ssize_t txlen; + unsigned int len; + u8 c, buf[3]; spin_lock_irqsave(&dev->lock, flags); @@ -293,7 +294,7 @@ static void mctp_serial_rx(struct mctp_serial *dev) dev->netdev->stats.rx_bytes += dev->rxlen; } -static void mctp_serial_push_header(struct mctp_serial *dev, unsigned char c) +static void mctp_serial_push_header(struct mctp_serial *dev, u8 c) { switch (dev->rxpos) { case 0: @@ -323,7 +324,7 @@ static void mctp_serial_push_header(struct mctp_serial *dev, unsigned char c) } } -static void mctp_serial_push_trailer(struct mctp_serial *dev, unsigned char c) +static void mctp_serial_push_trailer(struct mctp_serial *dev, u8 c) { switch (dev->rxpos) { case 0: @@ -347,7 +348,7 @@ static void mctp_serial_push_trailer(struct mctp_serial *dev, unsigned char c) } } -static void mctp_serial_push(struct mctp_serial *dev, unsigned char c) +static void mctp_serial_push(struct mctp_serial *dev, u8 c) { switch (dev->rxstate) { case STATE_IDLE: @@ -394,7 +395,7 @@ static void mctp_serial_tty_receive_buf(struct tty_struct *tty, const u8 *c, const u8 *f, size_t len) { struct mctp_serial *dev = tty->disc_data; - int i; + size_t i; if (!netif_running(dev->netdev)) return; From patchwork Thu Aug 8 10:35:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13757234 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57CE918CC16; Thu, 8 Aug 2024 10:36:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723113369; cv=none; b=S2Jy8sZT4cZgPi7JKFIQxrE1BNnhIkr3v9eTgGPTFynJWeCfvQnMVnZlkacIZvYgx1rJbFYjFKEMDkexS2hwJFuGEi3O9Lxhrs3WwN4WOKI9aJpbMs+ZktryP4CaVAycFky1AiMcGTa+hC2WAGgkVsRmMhQ6Xr0qTitSA7ipmGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723113369; c=relaxed/simple; bh=/O2/TlWp3zMCUKUw2fsXXmxsmDVNGJDzCxv0rpypKf4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D5UfK8X/rj+JEKXXkRP78Ito+4NAQIOQS6SeGxWYvdCkvO3s2QZHJj8ryv/HCZe4sDFWn4Wl7Vrvf1E8GlhoA+9HppQniklE00SK7+Vg4mEl3aCWT0ZIj+AK8Teg+SZUK5qJFkrpcyYSnyae1Yok/VyAA8oJ3lPWo9B3scsIUMA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mdXVePb6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mdXVePb6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DD53C4AF0E; Thu, 8 Aug 2024 10:36:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723113368; bh=/O2/TlWp3zMCUKUw2fsXXmxsmDVNGJDzCxv0rpypKf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mdXVePb6Di/RNjoDYR5nYcSdStYML/nClj+vPvH71JFE8fbx2mLJZxbvmXmj8z4AY HpKn3mjVAD8VdATVmE6XhMdVr5Ow2LEDt12Y6P3zj73fnMwd7expUInpUi1gm35PDj VEJNsUyvWDCbd33bFyqL2BVrqsqTyzoOJQBZKCqVLX1rIP4wfDBSM+txgQocIO99tS bV1tiQdnqag99+u1NySc+u/PdFheuot0f0XvVHMU8/d0I/k7YjTuFCL/G8N8GW8C34 wPIoOb88vIHOQvAWGCpJJnjbV0RXTJ4HslocuTOpJ35W1GZGfPYa0d0LfS03WetjhQ NB0LwL0OGbJog== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Andreas Koensgen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-hams@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2 07/11] 6pack: remove sixpack::rbuff Date: Thu, 8 Aug 2024 12:35:43 +0200 Message-ID: <20240808103549.429349-8-jirislaby@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240808103549.429349-1-jirislaby@kernel.org> References: <20240808103549.429349-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org It's unused (except allocation and free). Signed-off-by: Jiri Slaby (SUSE) Cc: Greg Kroah-Hartman Cc: Andreas Koensgen Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: linux-hams@vger.kernel.org Cc: netdev@vger.kernel.org --- drivers/net/hamradio/6pack.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 6ed38a3cdd73..29906901a734 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c @@ -88,7 +88,6 @@ struct sixpack { struct net_device *dev; /* easy for intr handling */ /* These are pointers to the malloc()ed frame buffers. */ - unsigned char *rbuff; /* receiver buffer */ int rcount; /* received chars counter */ unsigned char *xbuff; /* transmitter buffer */ unsigned char *xhead; /* next byte to XMIT */ @@ -544,7 +543,7 @@ static inline int tnc_init(struct sixpack *sp) */ static int sixpack_open(struct tty_struct *tty) { - char *rbuff = NULL, *xbuff = NULL; + char *xbuff = NULL; struct net_device *dev; struct sixpack *sp; unsigned long len; @@ -574,10 +573,8 @@ static int sixpack_open(struct tty_struct *tty) len = dev->mtu * 2; - rbuff = kmalloc(len + 4, GFP_KERNEL); xbuff = kmalloc(len + 4, GFP_KERNEL); - - if (rbuff == NULL || xbuff == NULL) { + if (xbuff == NULL) { err = -ENOBUFS; goto out_free; } @@ -586,7 +583,6 @@ static int sixpack_open(struct tty_struct *tty) sp->tty = tty; - sp->rbuff = rbuff; sp->xbuff = xbuff; sp->mtu = AX25_MTU + 73; @@ -631,7 +627,6 @@ static int sixpack_open(struct tty_struct *tty) out_free: kfree(xbuff); - kfree(rbuff); free_netdev(dev); @@ -676,7 +671,6 @@ static void sixpack_close(struct tty_struct *tty) del_timer_sync(&sp->resync_t); /* Free all 6pack frame buffers after unreg. */ - kfree(sp->rbuff); kfree(sp->xbuff); free_netdev(sp->dev); From patchwork Thu Aug 8 10:35:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13757235 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD12618DF83; Thu, 8 Aug 2024 10:36:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723113371; cv=none; b=FQ9BtLP0lFPpr8wzaIZt8KCLgf34qYOzzUhQsvt/iAb1lDPHCYOanUJCjDpPed78fXU4Em2F/3kCfJTdOfTyubMV2uikq2nV/t7eV7bTaQ0eCP7REdcnjdaiBFtPQrWjVKm0erYJ69zINfzA4hV9oHxxsfkTbNKrsvefQhFjjNs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723113371; c=relaxed/simple; bh=Y/kZ6pKUemi1ebXpTMHlyUEYKL9YeGqV57QiLnAlE98=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V7XcC7JPPNkX+h+z8nHvnkbOOts2AmMUXYjIbPCnqHkn1ekh+5exqtZanFf3U7QQ0ZbJTiP1GTve4Qbh4A2N4gZFEGVhFs6MHGqVuGRgUKUbvF/KmxgseRaNycPRAjUH10G/ajGIb2sG20FXx+yOki5r9Y5NF+wmooGWkIUoXqA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=It5DTZ7l; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="It5DTZ7l" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C7F2C4AF0D; Thu, 8 Aug 2024 10:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723113371; bh=Y/kZ6pKUemi1ebXpTMHlyUEYKL9YeGqV57QiLnAlE98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=It5DTZ7l/sA5ueD/unBsBOvGe19RYLsCYi+EtQwfEWNjolcw6/KF8r0KHDJd7S+Ro ObKgy0j2U2OUvPYa2Hag9OSr4mpqjV6i39V/zaQTGH/sCfZA0Fje+JKMElUmWwKgQs MSsNFCtZzX7keFFx+FCh82H9SE41Kko/rZ3TPb3i1fk+vRzb9Yn3S16CuIdt8IRXWa kvcIC4iVZ4J5x2sV4yZNBlva39jbLZjp2/V7hJy9o2iyXhhV2A2TeKxroTzeOtWQ3R UEdGCHD9cNqu0iajGfKB6XI6Fz0xEqLHg5tHazqlq7e7o3rSp0lOSjNoFxznEND7rY xkKAC1+LcBi8w== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Andreas Koensgen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-hams@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2 08/11] 6pack: drop sixpack::mtu Date: Thu, 8 Aug 2024 12:35:44 +0200 Message-ID: <20240808103549.429349-9-jirislaby@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240808103549.429349-1-jirislaby@kernel.org> References: <20240808103549.429349-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org It holds a constant (AX25_MTU + 73), so use that constant in place of the single use directly. And remove the stale comment. Signed-off-by: Jiri Slaby (SUSE) Cc: Greg Kroah-Hartman Cc: Andreas Koensgen Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: linux-hams@vger.kernel.org Cc: netdev@vger.kernel.org --- drivers/net/hamradio/6pack.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 29906901a734..f8235b1b60e9 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c @@ -100,7 +100,6 @@ struct sixpack { unsigned int rx_count_cooked; spinlock_t rxlock; - int mtu; /* Our mtu (to spot changes!) */ int buffsize; /* Max buffers sizes */ unsigned long flags; /* Flag values/ mode etc */ @@ -166,7 +165,7 @@ static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len) unsigned char *msg, *p = icp; int actual, count; - if (len > sp->mtu) { /* sp->mtu = AX25_MTU = max. PACLEN = 256 */ + if (len > AX25_MTU + 73) { msg = "oversized transmit packet!"; goto out_drop; } @@ -585,7 +584,6 @@ static int sixpack_open(struct tty_struct *tty) sp->xbuff = xbuff; - sp->mtu = AX25_MTU + 73; sp->buffsize = len; sp->rcount = 0; sp->rx_count = 0; From patchwork Thu Aug 8 10:35:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13757236 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D60A918E04B; Thu, 8 Aug 2024 10:36:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723113375; cv=none; b=SGBoixLieHBlsHQZ5wks7FpARuVdoYsO9glVhLlTd23Tiq4uQhqg+d/ocki3dFPirLUl+gccmRc49XZqL6gnIori7wLBxRWKA+r5CD9vHINwKDLuHJnEZBq6zSipb0uE6R54ODvF0xX32MtFnOoB+9ZMq37/bQfNtMEgwtgWZx0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723113375; c=relaxed/simple; bh=/bx8JyDtijw2rJHtb+tZ3h5JPdq8AmW/Z7d+AJaqE4k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YySURA2Fcw+4QL6FKCZSSqByfYEOSQ+ksFJ0G7hFIA0z0IEpQfTSqwS/woD79+aZAxcU7JVktd0Megy2rqEwM8YyIZyuyjDrNPZLzy3y09tLlJExvn4kKW/2OIuUyla+krhtCgX0J9Uf8w/KAF/dofHL+dgl4Fr93eHJML+Z+QA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lWKmgYYM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lWKmgYYM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CA52C4AF10; Thu, 8 Aug 2024 10:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723113374; bh=/bx8JyDtijw2rJHtb+tZ3h5JPdq8AmW/Z7d+AJaqE4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lWKmgYYMINBEXwVwfECdApHcr2t7E+C73AZJtQq0SJjGodndd+Tj/eK6GNoirpMzU aDmSf5Vz5isrbjOWEa7ZvLGIfMgzgmTggzgUDPsOYhXuBPBwXSOdG+2AlpBq362IHr NA8qbvYkgSvCIhU5XTxL/7dXfCD4uRohELQz7E7Iu/1BhgG1vD31CuNVfB99l8ACzA 65IzARmQbPCfzGkCgawMAEbce66WAA62jg5JjT9LARLgl4w9Vg2K21g15uqXBNaSdM 7q81tHqALjgcLrX4aX0CLMvBBIKMB80b9ag2pNG7MSOoOcv/0Z5RvSHbSDMa0BYdCv REkggDy4pl3ag== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Andreas Koensgen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-hams@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2 09/11] 6pack: drop sixpack::buffsize Date: Thu, 8 Aug 2024 12:35:45 +0200 Message-ID: <20240808103549.429349-10-jirislaby@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240808103549.429349-1-jirislaby@kernel.org> References: <20240808103549.429349-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org It's never read. Signed-off-by: Jiri Slaby (SUSE) Cc: Greg Kroah-Hartman Cc: Andreas Koensgen Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: linux-hams@vger.kernel.org Cc: netdev@vger.kernel.org --- drivers/net/hamradio/6pack.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index f8235b1b60e9..25d6d2308130 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c @@ -100,8 +100,6 @@ struct sixpack { unsigned int rx_count_cooked; spinlock_t rxlock; - int buffsize; /* Max buffers sizes */ - unsigned long flags; /* Flag values/ mode etc */ unsigned char mode; /* 6pack mode */ @@ -584,7 +582,6 @@ static int sixpack_open(struct tty_struct *tty) sp->xbuff = xbuff; - sp->buffsize = len; sp->rcount = 0; sp->rx_count = 0; sp->rx_count_cooked = 0; From patchwork Thu Aug 8 10:35:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13757237 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A5D718E76E; Thu, 8 Aug 2024 10:36:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723113377; cv=none; b=cUhiG4nPdnUj9bKtl94hK/ADIGJYtfjPoJQv8rVJAKfa9Gi2lwgscVq2FYif0pSY9z3x+imYS9bcXhDElgRmMgpKrHR3yb9n93FSm7ey4xBUFPYOL9jMEFrtVsxo+HGKrDfP0v1ZwAbK+ULBLeNaNqLpUZkvRCGDhcD8Ro7/6F0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723113377; c=relaxed/simple; bh=NHQzYLisZFxJp8w+mTR6u58VzbcedQc9/+93I90ZlQo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ud48QEOGK7wOzUUZ6vtGGyC4ilXMmy1ABBH2pg+GY28xk3ethfGGT2znxZhuHn30U6MG47u3yV/GWL6/dYMgTXYgi1mf90boWBlerDMCrAX4580Qinj7oc0AtdNrdjRlvAf+mcGtm9c+wSB0q+3z8pjJPUsj397OP1uGmR4ZeVM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hAb341py; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hAb341py" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF896C4AF09; Thu, 8 Aug 2024 10:36:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723113377; bh=NHQzYLisZFxJp8w+mTR6u58VzbcedQc9/+93I90ZlQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hAb341pyz+s3nsD9kdJ+a1lrA9XhPOHcA+Q1GrOBSymsTz8PUfOvAX6T688hI92WX a9aqjjM9xLG2A1NCfIDwVTnySxf8vq30c+vrDdZQoiP2hROcp/5ZdMc7CLAGdEpi9X Gr9AroIuK1TUkwayLuMNwhTD5sb8T/bNDe/yafhO2xEyW9wz6QDIuZbQfnT0O0KB3H 4oofAT6T6PDxKF5gAs9+YieGSOWDy/q2m65AgJhL5Exvg8KpuJK+4Y+TbbLE1YoXVm yxGiflXt1NHpNflv3k80wfKuk02g+Px1gHjWdxYQPhSNiPvY/C8U8dtR80geEOucE6 q1JVun6kUN3Zw== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Andreas Koensgen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-hams@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2 10/11] 6pack: remove global strings Date: Thu, 8 Aug 2024 12:35:46 +0200 Message-ID: <20240808103549.429349-11-jirislaby@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240808103549.429349-1-jirislaby@kernel.org> References: <20240808103549.429349-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org They are __init, so they are freed after init is done. But this obfuscates the code. Provided these days, we usually don't print anything if everything has gone fine, drop the info print completely (along with now unused and always artificial SIXPACK_VERSION). And move the other string into the printk proper (while converting from KERN_ERR to pr_err()). Signed-off-by: Jiri Slaby (SUSE) Cc: Greg Kroah-Hartman Cc: Andreas Koensgen Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: linux-hams@vger.kernel.org Cc: netdev@vger.kernel.org --- drivers/net/hamradio/6pack.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 25d6d2308130..5c47730f5d58 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c @@ -37,8 +37,6 @@ #include #include -#define SIXPACK_VERSION "Revision: 0.3.0" - /* sixpack priority commands */ #define SIXP_SEOF 0x40 /* start and end of a 6pack frame */ #define SIXP_TX_URUN 0x48 /* transmit overrun */ @@ -745,21 +743,14 @@ static struct tty_ldisc_ops sp_ldisc = { /* Initialize 6pack control device -- register 6pack line discipline */ -static const char msg_banner[] __initconst = KERN_INFO \ - "AX.25: 6pack driver, " SIXPACK_VERSION "\n"; -static const char msg_regfail[] __initconst = KERN_ERR \ - "6pack: can't register line discipline (err = %d)\n"; - static int __init sixpack_init_driver(void) { int status; - printk(msg_banner); - /* Register the provided line protocol discipline */ status = tty_register_ldisc(&sp_ldisc); if (status) - printk(msg_regfail, status); + pr_err("6pack: can't register line discipline (err = %d)\n", status); return status; } From patchwork Thu Aug 8 10:35:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13757238 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CDD918EFE1; Thu, 8 Aug 2024 10:36:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723113380; cv=none; b=tioPH1CT/erDfCeqA5tBLyVDHC/9zkyBRG6ZR5rnYUFr20khtx3cW3ZysrNMTACh2BQaTuvPU5jMojiP7siuoEbe5sVAYlJkoxxMoMWPV3GjVf7wj9w9HFCNyV7FhhpkijQ8vtwM3BEUtgVNf3dM3CyUb+zJ1JQFttW1YptmA/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723113380; c=relaxed/simple; bh=UTNt9b26mQWZHW0TPCLWfErk9+9NMWIJfFgYZHzW/Wc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tCdnhCXImR0+2NhAuAqHGwztqH6Bc7mNlLj863EwuODJCm+5coU4+FufXIEHcXsCEEqIObb61EmZoKvFMhNTU8FF+qvS3+QHIntmAWcmeLuAMDFNR5yWW7me6+YSuqaZzGUqaL3NuHU0tiFkGOemOSW8YNj3HRc9CVmLdwF/Y5k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CUwEiCit; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CUwEiCit" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF329C4AF0D; Thu, 8 Aug 2024 10:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723113380; bh=UTNt9b26mQWZHW0TPCLWfErk9+9NMWIJfFgYZHzW/Wc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CUwEiCitYIylr+5M3jrp3Z4J6CVEe0QMsRIGkFBkeQdlaSs3DNpxanZp2rKJpZEAg 86VjNof4pa2exOOEVqzYb+RuhPyrYKTcVE+ybGmXrf/2FEhuqgzq4qqVHef26RYbmD ls5f3rc/QpInIpT77cXA4vBRrEewr0Z/Y+43I6sjwSo92NTIcby/rlEowntvB6qtfF AYgTv4c9xJfx5RBP9Msb1ho8zBhazogkceD4cTnmUfbH0uwONNHregoWOZxdIwJegP U1gsnfOcfcXdZI5lBjCdcF0TZ0ezM3PybP00MtSF9rNVDXx4H0u9ujun5nIhwNSZtX HTVsiJnmLhgCA== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Andreas Koensgen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-hams@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2 11/11] 6pack: propagage new tty types Date: Thu, 8 Aug 2024 12:35:47 +0200 Message-ID: <20240808103549.429349-12-jirislaby@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240808103549.429349-1-jirislaby@kernel.org> References: <20240808103549.429349-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org In tty, u8 is now used for data, ssize_t for sizes (with possible negative error codes). Propagate these types to 6pack. Signed-off-by: Jiri Slaby (SUSE) Cc: Greg Kroah-Hartman Cc: Andreas Koensgen Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: linux-hams@vger.kernel.org Cc: netdev@vger.kernel.org --- drivers/net/hamradio/6pack.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 5c47730f5d58..3bf6785f9057 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c @@ -91,8 +91,8 @@ struct sixpack { unsigned char *xhead; /* next byte to XMIT */ int xleft; /* bytes left in XMIT queue */ - unsigned char raw_buf[4]; - unsigned char cooked_buf[400]; + u8 raw_buf[4]; + u8 cooked_buf[400]; unsigned int rx_count; unsigned int rx_count_cooked; @@ -107,8 +107,8 @@ struct sixpack { unsigned char slottime; unsigned char duplex; unsigned char led_state; - unsigned char status; - unsigned char status1; + u8 status; + u8 status1; unsigned char status2; unsigned char tx_enable; unsigned char tnc_state; @@ -122,7 +122,7 @@ struct sixpack { #define AX25_6PACK_HEADER_LEN 0 -static void sixpack_decode(struct sixpack *, const unsigned char[], int); +static void sixpack_decode(struct sixpack *, const u8 *, size_t); static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char); /* @@ -327,7 +327,7 @@ static void sp_bump(struct sixpack *sp, char cmd) { struct sk_buff *skb; int count; - unsigned char *ptr; + u8 *ptr; count = sp->rcount + 1; @@ -425,7 +425,7 @@ static void sixpack_receive_buf(struct tty_struct *tty, const u8 *cp, const u8 *fp, size_t count) { struct sixpack *sp; - int count1; + size_t count1; if (!count) return; @@ -800,9 +800,9 @@ static int encode_sixpack(unsigned char *tx_buf, unsigned char *tx_buf_raw, /* decode 4 sixpack-encoded bytes into 3 data bytes */ -static void decode_data(struct sixpack *sp, unsigned char inbyte) +static void decode_data(struct sixpack *sp, u8 inbyte) { - unsigned char *buf; + u8 *buf; if (sp->rx_count != 3) { sp->raw_buf[sp->rx_count++] = inbyte; @@ -828,9 +828,9 @@ static void decode_data(struct sixpack *sp, unsigned char inbyte) /* identify and execute a 6pack priority command byte */ -static void decode_prio_command(struct sixpack *sp, unsigned char cmd) +static void decode_prio_command(struct sixpack *sp, u8 cmd) { - int actual; + ssize_t actual; if ((cmd & SIXP_PRIO_DATA_MASK) != 0) { /* idle ? */ @@ -878,9 +878,9 @@ static void decode_prio_command(struct sixpack *sp, unsigned char cmd) /* identify and execute a standard 6pack command byte */ -static void decode_std_command(struct sixpack *sp, unsigned char cmd) +static void decode_std_command(struct sixpack *sp, u8 cmd) { - unsigned char checksum = 0, rest = 0; + u8 checksum = 0, rest = 0; short i; switch (cmd & SIXP_CMD_MASK) { /* normal command */ @@ -928,10 +928,10 @@ static void decode_std_command(struct sixpack *sp, unsigned char cmd) /* decode a 6pack packet */ static void -sixpack_decode(struct sixpack *sp, const unsigned char *pre_rbuff, int count) +sixpack_decode(struct sixpack *sp, const u8 *pre_rbuff, size_t count) { - unsigned char inbyte; - int count1; + size_t count1; + u8 inbyte; for (count1 = 0; count1 < count; count1++) { inbyte = pre_rbuff[count1];