devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Frank Li <Frank.Li@nxp.com>
Cc: alexandre.belloni@bootlin.com, conor.culhane@silvaco.com,
	 devicetree@vger.kernel.org, gregkh@linuxfoundation.org,
	 imx@lists.linux.dev, jirislaby@kernel.org, joe@perches.com,
	 krzysztof.kozlowski+dt@linaro.org,
	krzysztof.kozlowski@linaro.org,  linux-i3c@lists.infradead.org,
	linux-kernel@vger.kernel.org,  linux-serial@vger.kernel.org,
	miquel.raynal@bootlin.com, robh@kernel.org,
	 zbigniew.lukwinski@linux.intel.com
Subject: Re: [PATCH v4 6/8] i3c: target: func: add tty driver
Date: Wed, 24 Jan 2024 17:15:01 +0200 (EET)	[thread overview]
Message-ID: <744bf8d6-48a3-81b4-baa8-d8c06500a971@linux.intel.com> (raw)
In-Reply-To: <20240123231043.3891847-7-Frank.Li@nxp.com>

On Tue, 23 Jan 2024, Frank Li wrote:

> Add tty over I3C target function driver.
> 
> Signed-off-by: Frank Li <Frank.Li@nxp.com>

> diff --git a/drivers/i3c/func/tty.c b/drivers/i3c/func/tty.c
> new file mode 100644
> index 0000000000000..bad99c08be0ac
> --- /dev/null
> +++ b/drivers/i3c/func/tty.c
> @@ -0,0 +1,475 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2023 NXP
> + * Author: Frank Li <Frank.Li@nxp.com>
> + */
> +
> +#include <linux/iopoll.h>
> +#include <linux/i3c/target.h>
> +#include <linux/serial_core.h>
> +#include <linux/slab.h>
> +#include <linux/tty_flip.h>
> +
> +static DEFINE_IDR(i3c_tty_minors);
> +
> +static struct tty_driver *i3c_tty_driver;
> +
> +#define I3C_TTY_MINORS		8
> +
> +#define I3C_TX_NOEMPTY		BIT(0)
> +#define I3C_TTY_TRANS_SIZE	16
> +#define I3C_TTY_IBI_TX		BIT(0)

Lacking #include for BIT()


> +	do {
> +		req = i3c_target_ctrl_alloc_request(func->ctrl, GFP_KERNEL);
> +		if (!req)
> +			goto err_alloc_req;
> +
> +		req->buf = (void *) (sport->buffer + offset);

Casting to void is unnecessary.

> +		req->length = rxfifo_size;
> +		req->context = sport;
> +		req->complete = i3c_target_tty_rx_complete;
> +		offset += rxfifo_size;
> +
> +		if (i3c_target_ctrl_queue(req, GFP_KERNEL))
> +			goto err_alloc_req;
> +	} while (req && (offset + rxfifo_size) < UART_XMIT_SIZE);

Extra ().

> +static void i3c_port_shutdown(struct tty_port *port)
> +{
> +	struct ttyi3c_port *sport =
> +		container_of(port, struct ttyi3c_port, port);

Just put this to a single line, nothing important is lost even on 80 char
screen.

> +static void i3c_port_destruct(struct tty_port *port)
> +{
> +	struct ttyi3c_port *sport =
> +		container_of(port, struct ttyi3c_port, port);

Ditto.

> +	if (i3c_target_ctrl_set_config(func->ctrl, func)) {
> +		dev_err(&func->dev, "failure set i3c config\n");

failed to set i3c config


> +	read_poll_timeout(i3c_target_ctrl_fifo_status, val, !val, 100, timeout, false,
> +			  sport->i3cdev->ctrl, true);
> +
> +	i3c_target_ctrl_set_status_format1(sport->i3cdev->ctrl, sport->status & (~I3C_TX_NOEMPTY));

Unnecessary ().

-- 
 i.


  reply	other threads:[~2024-01-24 15:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-23 23:10 [PATCH v4 0/8] I3C target mode support Frank Li
2024-01-23 23:10 ` [PATCH v4 1/8] i3c: add " Frank Li
2024-01-23 23:10 ` [PATCH v4 2/8] dt-bindings: i3c: svc: add proptery mode Frank Li
2024-01-23 23:10 ` [PATCH v4 3/8] Documentation: i3c: Add I3C target mode controller and function Frank Li
2024-01-23 23:10 ` [PATCH v4 4/8] i3c: svc: Add svc-i3c-main.c and svc-i3c.h Frank Li
2024-01-24 14:59   ` Ilpo Järvinen
2024-01-23 23:10 ` [PATCH v4 5/8] i3c: target: add svc target controller support Frank Li
2024-01-27  0:58   ` kernel test robot
2024-01-23 23:10 ` [PATCH v4 6/8] i3c: target: func: add tty driver Frank Li
2024-01-24 15:15   ` Ilpo Järvinen [this message]
2024-01-23 23:10 ` [PATCH v4 7/8] i3c: add API i3c_dev_gettstatus_format1() to get target device status Frank Li
2024-01-23 23:10 ` [PATCH v4 8/8] tty: i3c: add TTY over I3C master support Frank Li
2024-01-24 15:26   ` Ilpo Järvinen

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=744bf8d6-48a3-81b4-baa8-d8c06500a971@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=Frank.Li@nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=conor.culhane@silvaco.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=jirislaby@kernel.org \
    --cc=joe@perches.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=robh@kernel.org \
    --cc=zbigniew.lukwinski@linux.intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).