Re: setting miscdevice.parent after misc_register()
From: Hans-Christian Egtvedt
Date: Tue Jun 08 2010 - 03:09:35 EST
On Tue, 8 Jun 2010 12:11:44 +0900
Akinobu Mita <akinobu.mita@xxxxxxxxx> wrote:
> In drivers/watchdog/at32ap700x_wdt.c, and drivers/watchdog/sch311x_wdt.c
> miscdevice.parent is set after misc_register().
>
> drivers/watchdog/at32ap700x_wdt.c:
>
> ret = misc_register(&wdt->miscdev);
> ...
> wdt->miscdev.parent = &pdev->dev;
>
> But it does nothing. (the miscdevice will not be a child of that parent
> device in sysfs)
>
> So should it be set before misc_register() or just keep it as-is?
AFAICT I think it is unsafe to have misc_register() before the last
parts of the probe function. The misc_register() should be the last
call in _probe().
Something ala the following...