[PATCH v2] uload unused input modules

Michal Suchanek hramrach at gmail.com
Tue Jul 17 05:36:05 PDT 2012


On 11 July 2012 08:46, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> On Tue, Jul 03, 2012 at 12:45:21PM +0200, Michal Suchanek wrote:

>> Signed-off-by: Michal Suchanek <hramrach at gmail.com>
>> ---
>>  hw/xfree86/loader/loadmod.c |   19 ++++++++++++++++---
>>  1 file changed, 16 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
>> index 706b9b3..e94265a 100644
>> --- a/hw/xfree86/loader/loadmod.c
>> +++ b/hw/xfree86/loader/loadmod.c
>> @@ -1103,10 +1103,23 @@ UnloadModuleOrDriver(ModuleDescPtr mod)
>>          LoaderUnload(mod->name, mod->handle);
>>      }
>>
>> -    if (mod->child)
>> +    while (mod->child)
>>          UnloadModuleOrDriver(mod->child);
>> -    if (mod->sib)
>> -        UnloadModuleOrDriver(mod->sib);
>> +
>> +    if (mod->parent) {
>> +        ModuleDescPtr sib_list = mod->parent->child;
>> +        if (sib_list == mod) {
>> +            mod->parent->child = mod->sib;
>> +        } else {
>> +            while (sib_list) {
>> +                if (sib_list->sib == mod) {
>> +                    sib_list->sib = mod->sib;
>> +                    break;
>> +                }
>> +                sib_list = sib_list->sib;
>> +            }
>> +        }
>
> we've got a bunch of macros to deal with null-terminated lists, so I've
> changed the second part to:
>
>     if (mod->parent)
>         nt_list_del(mod, mod->parent->child, ModuleDesc, sib)
>
> which does the same thing as above. read as
> delete "mod" from "mod->parent->child", mod is of type ModuleDesc, "sib" is
> the pointer in mod to point to the next element.
>
> applied otherwise, thanks.
>

Too early.

There is a RemoveChild that does just this, with another copy of this code.

Going to send an updated patchset when I get to looking at the others, too.

Thanks

Michal


More information about the xorg-devel mailing list