Messages in this thread | | | Date | Tue, 20 May 2003 09:39:33 +0200 | From | Ingo Oeser <> | Subject | Re: try_then_request_module |
| |
Hi Riley,
On Mon, May 19, 2003 at 07:50:02PM +0100, Riley Williams wrote: > > int module_loaded_flag=0;
Tell that we don't know, whether the module is loaded > > retry_with_module_loaded: > > > > /* search code */
Do the search.
> > if (!module_loaded_flag && !found) {
Test, whether we did not yet explicitly load the module and not found the entry either.
> > module_loaded_flag=1;
Tell that we loaded it (if we cannot load it, then we fall through).
> > if (!request_module(bla)) > > goto retry_with_module_loaded;
Restart search after successful module load.
> > } > > return found;
> Out of curiosity, what exactly is the purpose of the goto in the > above code? Since we set module_loaded_flag just prior to it, the > first if statement must fail after the goto, so we just fall down > to where we would have been without the goto.
That is intended. I just reuse the search code here instead of duplicating it.
Since I load the module to broaden my search range, I can also try to load the module there. Without module support this goto will never execute and most of that code there compiled away.
That's why I consider try_then_request_module() not needed. But people seem to have big problems with using gotos and still reading the code (although it's quite common in the kernel), so try_then_request_module() might solve this *social* problem ;-)
Regards
Ingo Oeser - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |