[lkml]   [2008]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Blackfin Serial Driver: Enable IR function when user application (irattach /dev/ttyBFx -s) call TIOCSETD ioctl with line discipline N_IRDA
On Fri, Apr 25, 2008 at 5:55 PM, Alan Cox <> 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,
.read_proc = uart_read_proc,
.tiocmget = uart_tiocmget,
.tiocmset = uart_tiocmset,
.poll_init = uart_poll_init,
.poll_get_char = uart_poll_get_char,
.poll_put_char = uart_poll_put_char,
.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

 \ /
  Last update: 2008-05-04 17:29    [W:0.047 / U:36.152 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site