qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 08/55] qdev: Convert uses of qdev_create() with Coccinelle


From: Markus Armbruster
Subject: Re: [PATCH 08/55] qdev: Convert uses of qdev_create() with Coccinelle
Date: Wed, 20 May 2020 10:16:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Paolo Bonzini <address@hidden> writes:

> On 19/05/20 16:55, Markus Armbruster wrote:
>>     expression bus, type_name, dev;
>>     @@
>>     -    dev = qdev_create(bus, type_name);
>>     +    dev = qdev_new(type_name);
>>          ...
>>     -    qdev_init_nofail(dev);
>>     +    qdev_realize_and_unref(dev, bus, &error_fatal);
>> 
>
>> The first rule exempts hw/arm/highbank.c, because it matches along two
>> control flow paths there, with different @type_name.  Covered by the
>> next commit's manual conversions.
>
> Slightly better way to express it:
>
>      expression bus, type_name, dev;
>      @@
>      -    dev = qdev_create(bus, type_name);
>      +    dev = qdev_new(type_name);
>           ... when != dev = qdev_create(...)
>      -    qdev_init_nofail(dev);
>      +    qdev_realize_and_unref(dev, bus, &error_fatal);
>
> (Just for documentation purposes, the patch is okay of course).

I actually have a "... when != dev = expr" in a few later scripts.
Added when I found out that just ... produced a bad change in one case.
I meant to update all such ... to carry it, then check the addition
doesn't mess up anything, but forgot.  Can do it for v2.  Thanks!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]