[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH 10/10] hw/arm hw/xtensa: De-duplica
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH 10/10] hw/arm hw/xtensa: De-duplicate pflash creation code some |
Date: |
Tue, 19 Feb 2019 14:01:37 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Max Filippov <address@hidden> writes:
> On Mon, Feb 18, 2019 at 5:07 AM Markus Armbruster <address@hidden> wrote:
>>
>> pflash_cfi01_register() creates a TYPE_CFI_PFLASH01 device, sets
>> properties, realizes, and wires up.
>>
>> We have three modified copies of it, because their users need to set
>> additional properties, or have the wiring done differently.
>>
>> Factor out their common part into pflash_cfi01_create().
>>
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>> hw/arm/vexpress.c | 22 +++++-----------------
>> hw/arm/virt.c | 26 +++++++++-----------------
>> hw/block/pflash_cfi01.c | 39 +++++++++++++++++++++++++++------------
>> hw/xtensa/xtfpga.c | 18 +++++++-----------
>
> I was told that it's better this way when I did that initially:
> http://lists.gnu.org/archive/html/qemu-devel/2015-09/msg06927.html
>
> Has the idea of "better" changed since then?
> I'm fine with the code either way, just curious.
I'm not sure about our collective idea of "better". I simply saw a
helper function duplicated with minor variations because it fails to
capture what's truly common, so I fixed that.
If we think helper functions capturing device creation and property
setting are bad, and open coding would be better. then we should get rid
of pflash_cfi01_register() and pflash_cfi02_register() everywhere, not
just avoid it in these three places.
Cc'ing the usual QOM suspects for guidance.
- Re: [Qemu-block] [Qemu-devel] [PATCH 06/10] r2d: Flash memory creation is confused about size, mark FIXME, (continued)
Re: [Qemu-block] [Qemu-devel] [PATCH 06/10] r2d: Flash memory creation is confused about size, mark FIXME, Philippe Mathieu-Daudé, 2019/02/19
[Qemu-block] [PATCH 10/10] hw/arm hw/xtensa: De-duplicate pflash creation code some, Markus Armbruster, 2019/02/18
[Qemu-block] [PATCH 08/10] pflash: Clean up after commit 368a354f02b part 1, Markus Armbruster, 2019/02/18
[Qemu-block] [PATCH 09/10] pflash: Clean up after commit 368a354f02b part 2, Markus Armbruster, 2019/02/18