Hi Biju,
On Tue, 25 Nov 2025 at 16:06, Biju <biju.das.au@gmail.com> wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> Add sci_is_fifo_type() helper for SCI operates in FIFO mode to
> simplify the code in probe() and remove().
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Thanks for your patch!
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -3546,6 +3546,12 @@ static struct uart_driver sci_uart_driver = {
> .cons = SCI_CONSOLE,
> };
>
> +static bool sci_is_fifo_type(u8 type)
sci_has_fifo?
> +{
> + return (type == PORT_SCIFA || type == PORT_SCIFB ||
> + type == PORT_HSCIF || type == SCI_PORT_RSCI);
> +}
> +
> static void sci_remove(struct platform_device *dev)
> {
> struct sci_port *s = platform_get_drvdata(dev);
> @@ -3556,8 +3562,7 @@ static void sci_remove(struct platform_device *dev)
>
> if (s->port.fifosize > 1)
> device_remove_file(&dev->dev, &dev_attr_rx_fifo_trigger);
> - if (type == PORT_SCIFA || type == PORT_SCIFB || type == PORT_HSCIF ||
> - type == SCI_PORT_RSCI)
> + if (sci_is_fifo_type(type))
> device_remove_file(&dev->dev, &dev_attr_rx_fifo_timeout);
I am wondering if we could just check for s->port.fifosize > 1 instead,
and thus combine with the above check? We do have to fill in .set_rtg =
rsci_scif_set_rtrg first, but are there other hurdles to take?
> }
>
> @@ -3918,8 +3923,7 @@ static int sci_probe(struct platform_device *dev)
> if (ret)
> return ret;
> }
> - if (sp->type == PORT_SCIFA || sp->type == PORT_SCIFB ||
> - sp->type == PORT_HSCIF || sp->type == SCI_PORT_RSCI) {
> + if (sci_is_fifo_type(sp->type)) {
Likewise.
> ret = device_create_file(&dev->dev, &dev_attr_rx_fifo_timeout);
> if (ret) {
> if (sp->port.fifosize > 1) {
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds