From: Simon Horman <horms@kernel.org>
To: Rodolfo Zitellini <rwz@xhero.org>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Jonathan Corbet <corbet@lwn.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
netdev@vger.kernel.org, linux-doc@vger.kernel.org,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
Arnd Bergmann <arnd@arndb.de>, Doug Brown <doug@schmorgal.com>
Subject: Re: [PATCH net-next 2/2] appletalk: tashtalk: Add LocalTalk line discipline driver for AppleTalk using a TashTalk adapter
Date: Mon, 19 Aug 2024 10:47:09 +0100 [thread overview]
Message-ID: <20240819094709.GD11472@kernel.org> (raw)
In-Reply-To: <20240817093316.9239-1-rwz@xhero.org>
On Sat, Aug 17, 2024 at 11:33:16AM +0200, Rodolfo Zitellini wrote:
> This is the TashTalk driver, it perits for a modern machine to
> participate in a Apple LocalTalk network and is compatibile with
nit: compatible
Flagged by checkpatch.pl --codespell
> Netatalk.
>
> Please see the included documentation for details:
> Documentation/networking/device_drivers/appletalk/index.rst
>
> Signed-off-by: Rodolfo Zitellini <rwz@xhero.org>
...
> diff --git a/drivers/net/appletalk/tashtalk.c b/drivers/net/appletalk/tashtalk.c
...
> +/* Called by the driver when there's room for more data.
> + * Schedule the transmit.
> + */
> +static void tashtalk_write_wakeup(struct tty_struct *tty)
> +{
> + struct tashtalk *tt;
I think that tt needs an __rcu annotation. Sparse says:
.../tashtalk.c:290:14: error: incompatible types in comparison expression (different address spaces):
.../tashtalk.c:290:14: void [noderef] __rcu *
.../tashtalk.c:290:14: void *
> +
> + rcu_read_lock();
> + tt = rcu_dereference(tty->disc_data);
> + if (tt)
> + schedule_work(&tt->tx_work);
> + rcu_read_unlock();
> +}
...
> +static void tashtalk_send_ctrl_packet(struct tashtalk *tt, unsigned char dst,
> + unsigned char src, unsigned char type)
> +{
> + unsigned char cmd = TT_CMD_TX;
> + unsigned char buf[5];
> + int actual;
> + u16 crc;
> +
> + buf[LLAP_DST_POS] = dst;
> + buf[LLAP_SRC_POS] = src;
> + buf[LLAP_TYP_POS] = type;
> +
> + crc = tash_crc(buf, 3);
> + buf[3] = ~(crc & 0xFF);
> + buf[4] = ~(crc >> 8);
> +
> + actual = tt->tty->ops->write(tt->tty, &cmd, 1);
> + actual += tt->tty->ops->write(tt->tty, buf, sizeof(buf));
> +}
actual is set but otherwise unused in this function.
Should it be used as part of checking, with an error code returned on error?
If not, it should probably be removed.
Flagged by W=1 builds.
...
> +static void tashtalk_close(struct tty_struct *tty)
> +{
> + struct tashtalk *tt = tty->disc_data;
> +
> + /* First make sure we're connected. */
> + if (!tt || tt->magic != TASH_MAGIC || tt->tty != tty)
> + return;
> +
> + spin_lock_bh(&tt->lock);
> + rcu_assign_pointer(tty->disc_data, NULL);
I think tty->disc_data also needs an __rcu annotation, which will
likely highlight the need for annotations elsewhere. Flagged by Sparse.
> + tt->tty = NULL;
> + spin_unlock_bh(&tt->lock);
> +
> + synchronize_rcu();
> + flush_work(&tt->tx_work);
> +
> + /* Flush network side */
> + unregister_netdev(tt->dev);
> + /* This will complete via tt_free_netdev */
> +}
...
next prev parent reply other threads:[~2024-08-19 9:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-17 9:33 [PATCH net-next 2/2] appletalk: tashtalk: Add LocalTalk line discipline driver for AppleTalk using a TashTalk adapter Rodolfo Zitellini
2024-08-19 9:44 ` Arnd Bergmann
2024-08-19 12:39 ` Rodolfo Zitellini
2024-08-19 9:47 ` Simon Horman [this message]
2024-08-19 9:55 ` Jiri Slaby
2024-08-19 14:28 ` Jeff Johnson
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=20240819094709.GD11472@kernel.org \
--to=horms@kernel.org \
--cc=arnd@arndb.de \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=doug@schmorgal.com \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rwz@xhero.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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