Re: PATCH: tty ldisc locking/ordering

From: Christoph Hellwig
Date: Fri Sep 10 2004 - 11:03:51 EST


On Fri, Sep 10, 2004 at 11:38:10AM -0400, Alan Cox wrote:
> +In order to remove a line discipline call tty_register_ldisc passing NULL.
> +In ancient times this always worked. In modern times the function will
> +return -EBUSY if the ldisc is currently in use. Since the ldisc referencing
> +code manages the module counts this should not usually be a concern.

So what is a module supposed to do if this fails? It's usually called from
module_exit so there's no way to recover.

> +Three calls are now provided
> +
> + ldisc = tty_ldisc_ref(tty);
> +
> +takes a handle to the line discipline in the tty and returns it. If no ldisc
> +is currently attached or the ldisc is being closed and re-opened at this
> +point then NULL is returned. While this handle is held the ldisc will not
> +change or go away.
> +
> + tty_ldisc_deref(ldisc)

We tend to call these _get/_put just about everywhere else in the kernel,
maybe some consisteny is a good idea?

-
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/