Re: [PATCH 1/2] tty_io: add an API to get device corresponding totty_struct
From: Dmitry Eremin-Solenikov
Date: Sat Aug 07 2010 - 20:39:32 EST
On Sat, Aug 07, 2010 at 12:33:33PM +0100, Alan Cox wrote:
> On Sat, 7 Aug 2010 13:55:02 +0400
> Dmitry Eremin-Solenikov <dbaryshkov@xxxxxxxxx> wrote:
> > Some device drivers (mostly tty line disciplines) would like to have way
> > to get a struct device instancve corresponding to passed tty_struct. Add
> > respective API call.
> Most of the kernel simply keeps a parent device pointer in the struct. If
> we have a lookup method then we'll simply end up with a struct device in
> each tty ldisc struct instead, and it will be harder to clean up later.
The proposed usage (at least what we did in the second patch and what
I did in IEEE 802.15.4 tty driver) is to use this device pointer to
set up parent node for all devices created on top of given tty port.
> I think I'd much rather see this set when the tty is created and always
> available. That would also let the whole tty layer use dev_err() and
> friends usefully ?
I was afraid of messing with tty layer in such way, as it's a bit too
complex for me.
Do you mean adding struct device pointer to struct tty_struct (easy),
or refactoring code so, that struct tty_struct contains embedded
struct device and uses it for refcounting & stuff?
With best wishes
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/