[RFC][PATCH 1/3] Move parts of init_dev() into new functions

H. Peter Anvin hpa at zytor.com
Mon Aug 25 15:21:38 PDT 2008

sukadev at us.ibm.com wrote:
> By extension, maybe the tty layer would need another interface to determine
> the instance:
> 	instance =  driver->ops->get_instance(driver, inode, other_stuff) 
> using this we find the tty
> 	tty = driver->ops->something(driver, instance, idx);

This seems more than a bit redundant.  The "instance", IMO, *is* the tty 
structure; so the interface should be:

	tty = driver->ops->get_tty(driver, inode [, other_stuff?]);

Not "index", but "inode".  If, as a courtesy to the generic driver, we 
want to precalculate the index number we can do that, but otherwise that 
is of course available as:

index = inode->i_rdev - MK_DEV(device->major, device->minor_start);

... and if we replaced device->{major,minor_start} with device->base and 
made the drivers use MK_DEV() in the initializers, it would be even simpler.


More information about the Containers mailing list