hidraw_exit in discarded section (was: Re: [PATCH 1/1] HID: fixtty<->hid deadlock)

From: Geert Uytterhoeven
Date: Thu Oct 16 2008 - 06:32:30 EST


On Thu, 4 Sep 2008, Jiri Slaby wrote:
> hid_compat_load() runs on the default workqueue, it request_module(), it
> execs modprobe, it exits, tty flushes default workqueue, it hangs, because
> we are still in it.
>
> I haven't run into it since there always was at least one opener of the tty,
> I guess. Could you try the patch below?
>
> --
>
> Signed-off-by: Jiri Slaby <jirislaby@xxxxxxxxx>
> ---
> drivers/hid/hid-core.c | 11 ++++++++++-
> 1 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 92c16e1..18d952a 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -1663,6 +1663,7 @@ static void hid_compat_load(struct work_struct *ws)
> request_module("hid-dummy");
> }
> static DECLARE_WORK(hid_compat_work, hid_compat_load);
> +static struct workqueue_struct *hid_compat_wq;
> #endif
>
> static int __init hid_init(void)
> @@ -1680,7 +1681,12 @@ static int __init hid_init(void)
> goto err_bus;
>
> #ifdef CONFIG_HID_COMPAT
> - schedule_work(&hid_compat_work);
> + hid_compat_wq = create_workqueue("hid_compat");
> + if (!hid_compat_wq) {
> + hidraw_exit();
> + goto err;
> + }
> + queue_work(hid_compat_wq, &hid_compat_work);
> #endif
>
> return 0;
> @@ -1692,6 +1698,9 @@ err:
>
> static void __exit hid_exit(void)
> {
> +#ifdef CONFIG_HID_COMPAT
> + destroy_workqueue(hid_compat_wq);
> +#endif
> hidraw_exit();
> bus_unregister(&hid_bus_type);
> }

hid_init() is marked __init.
hidraw_exit() is marked __exit.

Hence I get:

`hidraw_exit' referenced in section `.init.text' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o

and my `enable everything' m68k kernel fails to link.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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/