Re: [PATCH 06/11] pps: serial clients support.

From: Alan Cox
Date: Thu Dec 03 2009 - 07:23:57 EST


> > void n_tty_init_ops(struct tty_ldisc_ops *ops)
> > {
> > *ops = tty_ldisc_N_TTY;
> > ops->owner = NULL:
> > ops->refcount = ops->flags = 0;
> > }
> > EXPORT_SYMBOL_GPL(n_tty_inherit_ops);
>
> The problem is that I have to do some operations into ldisc's open and
> close methods (see linux/drivers/pps/clients/pps-ldisc.c).
>
> By using your solution I inherit such methods but I cannot modify
> their behaviour in a manner suitable for register/deregister PPS
> support at runtime.

You can

n_tty_init_ops(&my_ops);
my_ops.num = whatever;
old_open = my_ops.open;
my_ops.open = pps_ntty_open;

etc

While not as pretty in C as C++ it works fine.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/