From: Stephen Rothwell <sfr@canb•auug.org.au>
To: Greg KH <greg@kroah•com>, David Miller <davem@davemloft•net>,
Networking <netdev@vger•kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation•org>,
Jiri Slaby <jirislaby@kernel•org>, Jiri Slaby <jslaby@suse•cz>,
Linux Kernel Mailing List <linux-kernel@vger•kernel.org>,
Linux Next Mailing List <linux-next@vger•kernel.org>,
Zheng Yongjun <zhengyongjun3@huawei•com>
Subject: linux-next: manual merge of the tty tree with the net-next tree
Date: Tue, 6 Apr 2021 18:48:14 +1000 [thread overview]
Message-ID: <20210406184814.3c958f51@canb.auug.org.au> (raw)
[-- Attachment #1: Type: text/plain, Size: 3075 bytes --]
Hi all,
Today's linux-next merge of the tty tree got a conflict in:
net/nfc/nci/uart.c
between commit:
d3295869c40c ("net: nfc: Fix spelling errors in net/nfc module")
from the net-next tree and commit:
c2a5a45c0276 ("net: nfc: nci: drop nci_uart_ops::recv_buf")
from the tty tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
--
Cheers,
Stephen Rothwell
diff --cc net/nfc/nci/uart.c
index 6af5752cde09,9958b37d8f9d..000000000000
--- a/net/nfc/nci/uart.c
+++ b/net/nfc/nci/uart.c
@@@ -229,6 -229,72 +229,72 @@@ static void nci_uart_tty_wakeup(struct
nci_uart_tx_wakeup(nu);
}
+ /* -- Default recv_buf handler --
+ *
+ * This handler supposes that NCI frames are sent over UART link without any
+ * framing. It reads NCI header, retrieve the packet size and once all packet
+ * bytes are received it passes it to nci_uart driver for processing.
+ */
+ static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data,
+ int count)
+ {
+ int chunk_len;
+
+ if (!nu->ndev) {
+ nfc_err(nu->tty->dev,
+ "receive data from tty but no NCI dev is attached yet, drop buffer\n");
+ return 0;
+ }
+
+ /* Decode all incoming data in packets
+ * and enqueue then for processing.
+ */
+ while (count > 0) {
+ /* If this is the first data of a packet, allocate a buffer */
+ if (!nu->rx_skb) {
+ nu->rx_packet_len = -1;
+ nu->rx_skb = nci_skb_alloc(nu->ndev,
+ NCI_MAX_PACKET_SIZE,
+ GFP_ATOMIC);
+ if (!nu->rx_skb)
+ return -ENOMEM;
+ }
+
+ /* Eat byte after byte till full packet header is received */
+ if (nu->rx_skb->len < NCI_CTRL_HDR_SIZE) {
+ skb_put_u8(nu->rx_skb, *data++);
+ --count;
+ continue;
+ }
+
+ /* Header was received but packet len was not read */
+ if (nu->rx_packet_len < 0)
+ nu->rx_packet_len = NCI_CTRL_HDR_SIZE +
+ nci_plen(nu->rx_skb->data);
+
+ /* Compute how many bytes are missing and how many bytes can
+ * be consumed.
+ */
+ chunk_len = nu->rx_packet_len - nu->rx_skb->len;
+ if (count < chunk_len)
+ chunk_len = count;
+ skb_put_data(nu->rx_skb, data, chunk_len);
+ data += chunk_len;
+ count -= chunk_len;
+
- /* Chcek if packet is fully received */
++ /* Check if packet is fully received */
+ if (nu->rx_packet_len == nu->rx_skb->len) {
+ /* Pass RX packet to driver */
+ if (nu->ops.recv(nu, nu->rx_skb) != 0)
+ nfc_err(nu->tty->dev, "corrupted RX packet\n");
+ /* Next packet will be a new one */
+ nu->rx_skb = NULL;
+ }
+ }
+
+ return 0;
+ }
+
/* nci_uart_tty_receive()
*
* Called by tty low level driver when receive data is
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next reply other threads:[~2021-04-06 8:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-06 8:48 Stephen Rothwell [this message]
2021-04-06 9:11 ` linux-next: manual merge of the tty tree with the net-next tree Greg KH
-- strict thread matches above, loose matches on Subject: below --
2023-08-09 3:40 Stephen Rothwell
2023-08-09 7:54 ` Greg KH
2023-08-09 3:37 Stephen Rothwell
2023-08-09 7:54 ` Greg KH
2012-03-09 6:02 Stephen Rothwell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210406184814.3c958f51@canb.auug.org.au \
--to=sfr@canb$(echo .)auug.org.au \
--cc=davem@davemloft$(echo .)net \
--cc=greg@kroah$(echo .)com \
--cc=gregkh@linuxfoundation$(echo .)org \
--cc=jirislaby@kernel$(echo .)org \
--cc=jslaby@suse$(echo .)cz \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-next@vger$(echo .)kernel.org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=zhengyongjun3@huawei$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox