On Saturday 20 September 2008, Russell King - ARM Linux wrote:
Well, the conventional thing for misc drivers, at any rate. In
various other drivers, inode->i_private is set up earlier, just
to avoid such a need for globals (or equivalent).
One could argue that this idiom is ugly ... and fix it by having
misc_open() in drivers/char/misc.c initialize i_private before
delegating to the miscdevice->fops->open(). Even just setting
it to the miscdevice pointer would suffice with this driver;
container_of(i_private, struct omap_wdt_dev, omap_wdt_miscdev)
would then return what get_drvdata() returns, sans global.
But that wouldn't be just cleaning up this watchdog.
= Dave
--