From patchwork Mon Aug 5 10:20:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13753423 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 CE64815B99D; Mon, 5 Aug 2024 10:21: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=1722853266; cv=none; b=mFHpxzcDFwTCnbv78pMkZZ3FZB4viM5Ud0gcL5EjYN2N8Ex08QVO+EvPd9Vi9WxsDulLoyq6ukTzzz91BextsNxojbGHFMLJApEKRoYOswrcBP41Ij67AYcqW8tYUbFCr1JE5fqopOKUYyxQOP8FbFHfCIbJitflmhtfJOTS9YQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722853266; c=relaxed/simple; bh=9Fik8RXRQRa2crOyQlS1nroMylh+Z+5N4egxIxbBjx0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=klEUddxaW82RF5V5MCaxOGSlNJIxJRs8FwkX065DXaemjPUvzpH7yelKg+qyLAuAXHnzr3r2g7X9pjTpZ7IU6bNk/J6W25+IMFTihWWq9/LsnqRsmY9SUQF1Q4P0oseHfMbBXzCg7+5Yx0Cm7i7RUUcJUcLZ04nWsMfLkRROzec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eUiDXu22; 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="eUiDXu22" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FB14C32782; Mon, 5 Aug 2024 10:21:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722853266; bh=9Fik8RXRQRa2crOyQlS1nroMylh+Z+5N4egxIxbBjx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eUiDXu22uB+jbLMph18hBLd/KCcOpYlxMPBisM53NfJD624xvBT1xw5G0sB7ATIAg 78zkxf2hgsDgGOaRgopFdiJuMsGQJ5l7921xAAnYhmGXQIQiHmExHcncJUw8KGMJaJ Dk0mRDZIg3RuwZDfBtgyXJrMibNd3Nk3hI5V/Uzspymd8d5sTKncay2pPY1D4374RL V0j4Tg+tZ516U3PEzWv0t5v2TG2tlPWsTcjRgGXhbhgnFpK1ckm+ZOBELLESiGGjFo f2NgbJuSLg+OISfrxIQ1j9B+3AR2a0sqE8Dcfsqx4Q87QXz4/j2upBKjTccoCPJnVx UBXeHhIN/Lc6A== 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 08/13] mctp: serial: propagage new tty types Date: Mon, 5 Aug 2024 12:20:41 +0200 Message-ID: <20240805102046.307511-9-jirislaby@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240805102046.307511-1-jirislaby@kernel.org> References: <20240805102046.307511-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) 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 Reviewed-by: Jeremy Kerr --- 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 Mon Aug 5 10:20: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: 13753424 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 55646156C62; Mon, 5 Aug 2024 10:21:09 +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=1722853269; cv=none; b=ZzTFwMAMh7tIxtZGNH/N8EOjZrZc1iBtPqjZQzcIk7s+PBtIiZtfdp+50edbmQxqJiM4g/u6DbG8Eo4rhxQ9saSqPKnr0MN1153Wfbdsj7LpT3jeJgKDmR3+fvf3ubC/Sn/QDWsyQn7+obeFD98Ebg+KVESC9B8CzoNS/52Hn20= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722853269; c=relaxed/simple; bh=/O2/TlWp3zMCUKUw2fsXXmxsmDVNGJDzCxv0rpypKf4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f6IyuTtz3edn9roO9NsENopudVKa4RmIOki87cE04KdKiHCuNBOEJJ/PxsKi+QVLMkZwRYYbBkLkPjUGDb6Ejg/v2vosZtlkvQGfiMxcLpD9tnoVlWZDzVZbUT2cvagbayG+XTsnkvwpzj3+n3OBB4O8nYtFdFILbDeZfnGJxQI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N+FZoTC+; 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="N+FZoTC+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E40A4C4AF10; Mon, 5 Aug 2024 10:21:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722853269; bh=/O2/TlWp3zMCUKUw2fsXXmxsmDVNGJDzCxv0rpypKf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N+FZoTC+68x2Ffbm/j8evQ8oJ0Bu+jSjLMPny1gejiLok5T0S8NhgAhA7iv5a4+uX 8bqlzR8jbcE6J3DZfcyERozXAncaedmmJu9C9Uhd0RGJDYH/s28lR0++hH1IGC21GM 3ichC/HKPZADvktqDBT/iz4trfEKKuSKqKKolynWhfPvf6A1DSPmJx+mpwgI9eupUK hJKZi2+3hMoT2vaAUFWp5AeA5mN4QGVH1EBRvsdZPL4FG9URkXZ58Sal2RdNy/DciZ T3E7+ebGh84DfyVd0WAXzJ46PL+yjXbKoFxQ2Nh5K1cJdecy8Fowit5s3rwy9Ux1ZE 6MAnm8zSmiImw== 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 09/13] 6pack: remove sixpack::rbuff Date: Mon, 5 Aug 2024 12:20:42 +0200 Message-ID: <20240805102046.307511-10-jirislaby@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240805102046.307511-1-jirislaby@kernel.org> References: <20240805102046.307511-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 Mon Aug 5 10:20: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: 13753425 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 18C3315ECD7; Mon, 5 Aug 2024 10:21:12 +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=1722853272; cv=none; b=BRc2YLgc1C1tHBiJ6OGBnH+PTEiLKzlNE8UHI0J6fVzKcTeTLHOEIzJter5UMHiYcFIPtIR1OZIUugbKgdhVntO+yTPVmtrLya3okE/D9f+6ko61XpcytTReyKVRUPp0oikNOU9poWvM8kt3rsTJ1aZ1UzyUi2Btdm+2OzzTEJM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722853272; c=relaxed/simple; bh=Y/kZ6pKUemi1ebXpTMHlyUEYKL9YeGqV57QiLnAlE98=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LIY+M0GOe6KL3Cy16kMSUAN6gmJpv8tl5nI1BS+QRRjVqh9a985kHbqK26TWsklHOr2hZSwI2wVeGeDiP44PGlAdleqLHQ+8/PY0E2+IpZO73Xona2bo7TlcHwFnvkJN0k4Jq84GvWNZpaU8+m+zrkYFhVBEH3cSrQzQW0LUsQ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A/cvscT6; 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="A/cvscT6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3955C4AF0D; Mon, 5 Aug 2024 10:21:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722853272; bh=Y/kZ6pKUemi1ebXpTMHlyUEYKL9YeGqV57QiLnAlE98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A/cvscT6e4SLxEeXha5o18ZK46G7glG9XZgCfau+ksJVZytwWXVHuaVPeKjjpOFKK CZUY+DKhf6WApVNIdoZU9bkSspTVBS54v1gR/9OqFCxjZiDUXa+5w4XkgKPoTAKMGA ZXDXebW/IXtiCZE93tNttP6MXEw7R4PRIEMzkO6TdlKBcctQ4+GMc2xcqMhKkfHMF3 DyIzLOr4skAnvnJ1rN8tu2UhHXjshdmuYJe+I1RfSVFNwNNaxushxjlgyD+inoUOwp AHIxVxA6w9Hjvlt/hIZns+MKOfj2noQb+VdvW0QKnQ3cGEFFyFNjjSvQRy46vt9ZbS 1jARtj3o1Tn9A== 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 10/13] 6pack: drop sixpack::mtu Date: Mon, 5 Aug 2024 12:20:43 +0200 Message-ID: <20240805102046.307511-11-jirislaby@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240805102046.307511-1-jirislaby@kernel.org> References: <20240805102046.307511-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 Mon Aug 5 10:20: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: 13753426 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 C703815EFCC; Mon, 5 Aug 2024 10:21: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=1722853274; cv=none; b=S75LnazikDoOzYsFvoJXGmxQI6XwHGip14UgizM+XNLBRwWkFtlJWpSKWd03946AkdUgkQ/a57azgvJrhyu19NV7qoV7oACrTUvboookTkwgLAXbg8FWSmOSo3Uw+1t0NlOOtBykcTE7cUCauPj1tNyuvENqa6aS+XLMLlijetA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722853274; c=relaxed/simple; bh=/bx8JyDtijw2rJHtb+tZ3h5JPdq8AmW/Z7d+AJaqE4k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X2yRCfPD/a+RvlWXwE+TxpGpwIl2tgcOQ7YKeVGEhPie48SqNUA2uFIuoF4kENv8dHuCgdIHk/ZZtGZvWxq2vfyNpNpOinofW9GbuQU4uY55j4KIgJLI/xV4/KspV4BRm8jYwM+Sir7GqLiS9aKV4DjbocFQZSXCBYu4Bj/45u8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sSWUy8Oi; 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="sSWUy8Oi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 638DAC4AF0D; Mon, 5 Aug 2024 10:21:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722853274; bh=/bx8JyDtijw2rJHtb+tZ3h5JPdq8AmW/Z7d+AJaqE4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sSWUy8OiwyY1dp3BF1PzQOPb5rXZeRbDRtWeuUI20h226MwW8re8Pgkr7dZ1aNpbK EmZslc8ziuqnOV0/x8f6tUu46ALIJVV9vpUTFvBubLG3UG3/6oHgrc3Y2LKywg3qvy iGSDJIbes97+thPWuCxk3gPj7VcxDQ27hMNhMj3E7Gz+q6vRU1KTl+tXC56ZO9mIZO 6oik4jrVJTg6rm1TLsstFjfoYpAfpDCXQCDXt9w+GoHzHeGF1LA7+tu7Y/Roz0jUVo pRd/A0QhG0OV2eTteFYV30Xo+tn2BOwESUtLfc9WmBOqFdjBp8X/Zz8ArcRo7Zm+ic aHAYIo5rRrRig== 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 11/13] 6pack: drop sixpack::buffsize Date: Mon, 5 Aug 2024 12:20:44 +0200 Message-ID: <20240805102046.307511-12-jirislaby@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240805102046.307511-1-jirislaby@kernel.org> References: <20240805102046.307511-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 Mon Aug 5 10:20: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: 13753427 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 CE78015FA9E; Mon, 5 Aug 2024 10:21: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=1722853277; cv=none; b=IJt8bz/+OKUN4GoDG5xmjINv4nUJLaYnBG5wSJBhPEuBCWwDeGDxQxzfJPUymlrEdSGjiBPRg4Y9DPhLmkE241MddchI75LKttxS3Maak1s+ku3MwxPAelZuHWWJ5tPMCCT8KvmYSQOURnMqlEs/PWyXBFnU2y2uwK18jL1xIXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722853277; c=relaxed/simple; bh=NHQzYLisZFxJp8w+mTR6u58VzbcedQc9/+93I90ZlQo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V7KAiXmIpF1ZSUK5IN0XA6Rt08Kw+91i++NxuiEE9gUDemc4fp9CfmraagBXZEoSw9WG61HBCN6vQ6DrKHskruHC/OVrt/GyPPFMhQPXkmGf/dCtlBo4P+vm/MSUDNIO3QGfv56vjA+B6QMy9K/ZeHWOmxc1aFSoRMCHmGBKRHA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VEkg/8X2; 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="VEkg/8X2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22800C32782; Mon, 5 Aug 2024 10:21:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722853277; bh=NHQzYLisZFxJp8w+mTR6u58VzbcedQc9/+93I90ZlQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VEkg/8X22UM60oSoWfb6uLB8Vjy03nCCmNYhP1o0V+KZRtS9eattJAy0W78L+IM2z kBlimKONQVvJm5oEE5qwcrF+uinYDvQCONGe0XZ/g8lRvwdEa4Zh49JydUARb2FsEB Ey1KTRnSOeM5mCWWDt0M9xffGNs6a46vvsZzVeCPsqRGGRJVrG7PlgZ+Nv+8M3cFyM pgyFcX+C508Vv4skFtz3J/2sUnvtJrVAM/iyYF+rBDZIjZAOGmEPuLZ8gjCxcfJP8N cJlgx8G7j8ekK/tjBnwHGipn1IzFahVbg8P1KFDGC607WBN8A0eD/+cFaTd/jdOW/b ZiDYduaDmA14g== 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 12/13] 6pack: remove global strings Date: Mon, 5 Aug 2024 12:20:45 +0200 Message-ID: <20240805102046.307511-13-jirislaby@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240805102046.307511-1-jirislaby@kernel.org> References: <20240805102046.307511-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 Mon Aug 5 10:20: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: 13753428 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 50996165EF1; Mon, 5 Aug 2024 10:21: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=1722853280; cv=none; b=omAPqh3rsTpfD+osO5vgQOYLDQey7OaX3zWQYIMch/eYCCNQpY+aSVg5EoG+9HdIGp7FlfkzBudXiXXOft40AHoMaBDwL166BhRUJlRkd+LRAN/UH007eNHyACBJn5avR2I2iDOgPXCSA/WRoYLlWR06wqTUHXVjIcJ28APQY30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722853280; c=relaxed/simple; bh=UTNt9b26mQWZHW0TPCLWfErk9+9NMWIJfFgYZHzW/Wc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n3m7mr7Lps+nFEQoiyR42x5fJ025oW3EQCktdMoXlkR8mrWqbv/9sNKf5i2uxNBX08TF1OU11B6b0Ca55ySPuBMQfIVjDkwEUXQzjMVaz1Wnwj9HQSBX6Q67D7DZMuCnxWeDvadKo168qEg+1E+ZjPhyhY8aYkFxDnuF12xy+Lk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WapI0yCn; 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="WapI0yCn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5B38C4AF0D; Mon, 5 Aug 2024 10:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722853280; bh=UTNt9b26mQWZHW0TPCLWfErk9+9NMWIJfFgYZHzW/Wc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WapI0yCngBCE5c2SNP9W/lPrqFLrVQ0ceeV4igrs5u8Semeb5mvQUaLid0mtRX4oP lct/25I9Dg7wVEF3ElCrvifB+dH+Dv4gG8lpGNIZuL0t81CHJY5H/Z7RpVpJrI1lLj urQqqML02c3GUVjuLyafJI9AeTeU5jqhxNvbqc9aatqdgeVuElHBNpbQOoOb8vHsYl FBPfIa0vvDoys4MG4zX0pMh3P8eOxg7oT0Lo6Nz4v97qtRuBLwMNTI2bid76is3nNE WNYTYTBs6weQiBzqMoTKDvQdgNXjI8XHO45ARk2Z9XQwbeHo6+DKIjgm6HX30u3OLz Q3d9n91pYrPjg== 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 13/13] 6pack: propagage new tty types Date: Mon, 5 Aug 2024 12:20:46 +0200 Message-ID: <20240805102046.307511-14-jirislaby@kernel.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240805102046.307511-1-jirislaby@kernel.org> References: <20240805102046.307511-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];