mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bryan Wu" <cooloney@kernel.org>
To: "Alan Cox" <alan@lxorguk.ukuu.org.uk>
Cc: "Yang, Graf" <Graf.Yang@analog.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: Blackfin Serial Driver: Enable IR function when user application (irattach /dev/ttyBFx -s) call TIOCSETD ioctl with line discipline N_IRDA
Date: Sun, 4 May 2008 23:27:24 +0800	[thread overview]
Message-ID: <386072610805040827w7a606ee2ld24e6752a6c745c7@mail.gmail.com> (raw)
In-Reply-To: <20080425105545.77b8c5e8@core>

On Fri, Apr 25, 2008 at 5:55 PM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> > Blackfin serial driver register as a UART driver, which will call tty_set_operations(...,&uart_ops), while uart_ops hasn't set_ldisc function.
>  > Do you mean I should declare a tty_ops and call tty_set_operations(..., &tty_ops) in bfin_5xx.c to register my set_ldisc?
>
>  Then we need to add a set_ldisc to uart_ops. I'll do that in todays
>  hacking.
>

Oh, I got the compile failure now:
--
  CC      drivers/serial/bfin_5xx.o
drivers/serial/bfin_5xx.c: In function 'bfin_serial_init':
drivers/serial/bfin_5xx.c:1281: error: 'struct tty_driver' has no
member named 'set_ldisc'
make[2]: *** [drivers/serial/bfin_5xx.o] Error 1
make[1]: *** [drivers/serial] Error 2
make: *** [drivers] Error 2
--

Obviously, it is no way to change code like this for passing compiling:
-- 
-             bfin_serial_reg.tty_driver->set_ldisc = bfin_set_ldisc;
+             bfin_serial_reg.tty_driver->ops->set_ldisc = bfin_set_ldisc;
--
Because the ops uart_ops is const and does not include the set_ldisc.

IMO, adding set_ldisc to uart_ops is useless for Graf's IrDA request,
because this function is specific for Blackfin, not shared by other
UART drivers. Maybe the only way is to create a new tty_operations
named bfin_uart_ops based on uart_ops like below:
--
static const struct tty_operations bfin_uart_ops = {
        .open           = uart_open,
        .close          = uart_close,
        .write          = uart_write,
        .put_char       = uart_put_char,
        .flush_chars    = uart_flush_chars,
        .write_room     = uart_write_room,
        .chars_in_buffer= uart_chars_in_buffer,
        .flush_buffer   = uart_flush_buffer,
        .ioctl          = uart_ioctl,
        .throttle       = uart_throttle,
        .unthrottle     = uart_unthrottle,
        .send_xchar     = uart_send_xchar,
        .set_termios    = uart_set_termios,
        .stop           = uart_stop,
        .start          = uart_start,
        .hangup         = uart_hangup,
        .break_ctl      = uart_break_ctl,
        .wait_until_sent= uart_wait_until_sent,
#ifdef CONFIG_PROC_FS
        .read_proc      = uart_read_proc,
#endif
        .tiocmget       = uart_tiocmget,
        .tiocmset       = uart_tiocmset,
#ifdef CONFIG_CONSOLE_POLL
        .poll_init      = uart_poll_init,
        .poll_get_char  = uart_poll_get_char,
        .poll_put_char  = uart_poll_put_char,
#endif
        .set_ldisc         = bfin_set_ldisc,
};
--

But it looks like funny as copying a whole structure for just one
simple function member assignment.
Alan, do you have any other suggestion for this issue? maybe we can
remove 'const' from struct tty_operations, then we can simply set the
set_ldisc for bfin_set_ldisc on the fly.

Thanks a lot
-Bryan Wu

  reply	other threads:[~2008-05-04 15:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200804241929.m3OJToSE021045@hera.kernel.org>
2008-04-24 20:50 ` Alan Cox
2008-04-25  9:22   ` Yang, Graf
2008-04-25  9:55     ` Alan Cox
2008-05-04 15:27       ` Bryan Wu [this message]
2008-05-04 15:56         ` Alan Cox
2008-06-03  2:18           ` gyang
2008-06-03 14:18             ` [PATCH] serial_core: uart_set_ldisc (Was Re: Blackfin Serial Driver: Enable IR function when user application (irattach /dev/ttyBFx -s) call TIOCSETD ioctl with line discipline N_IRDA) Alan Cox
2008-06-04 15:59               ` Linus Torvalds

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=386072610805040827w7a606ee2ld24e6752a6c745c7@mail.gmail.com \
    --to=cooloney@kernel.org \
    --cc=Graf.Yang@analog.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®