qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: Fam Zheng <fam@euphon.net>,
	"Daniel P. Berrange" <berrange@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Alberto Garcia <berto@igalia.com>, John Snow <jsnow@redhat.com>
Subject: Re: [PATCH 0/6] Improve consistency of bus init function names
Date: Thu, 23 Sep 2021 15:36:16 +0200	[thread overview]
Message-ID: <1702cda3-cc83-2026-89b4-a9eb6d7a8cd5@redhat.com> (raw)
In-Reply-To: <20210923121153.23754-1-peter.maydell@linaro.org>

On 9/23/21 14:11, Peter Maydell wrote:
> Currently we have a bit of a mishmash of different function
> names for bus creation. There are two basic patterns: you
> can have a function that allocates and returns a new bus
> object; or you can have a function that takes a pointer to
> a bus object and initializes it in-place. We have to some
> extent a convention for those: the allocate-and-return
> function is 'foo_new()', and the 'init in-place' function
> is 'foo_init()'. However many of our bus creation functions
> don't follow that; some use 'foo_new' vs 'foo_new_inplace';
> some use 'foo_new' for the in-place init version; and
> the bottom level qbus functions are 'qbus_create' vs
> 'qbus_create_inplace'. This series tries to bring at least
> scsi, ipack, pci, ide, and qbus into line with the
> _new-vs-_init naming convention.
> 
> The other issue with bus creation functions is that some
> of them take a 'name' argument which can be NULL, and some
> do not. Generally "pass in a specific name" should be the
> rare case, but our API design here is easy to misuse, and
> so a lot of callsites (especially for i2c, sd, ssi) pass
> in names when they should not. Untangling that mess is
> going to be tricky (see other thread for more), but as
> a first step, this series proposes a split between
> foo_bus_new() and foo_bus_new_named() where the latter
> takes a name parameter and the former does not. I do
> this only for scsi (and implicitly ide, whose ide_bus_new
> function already doesn't take a name argument) for the
> moment, as the other bus types have more of a mess of
> "pass name when they should not" callsites, so I didn't
> want to put in too much work before finding out if we
> had agreement on this as a naming convention.
> 
> There are definitely more buses that can be cleaned up
> to follow the init vs new convention, but this series is
> already touching 70 files and trying to do every bus in
> one series seems like a recipe for merge conflicts.
> So this seemed like enough to be going on with...
> 
> thanks
> -- PMM
> 
> Peter Maydell (6):
>    scsi: Replace scsi_bus_new() with scsi_bus_init(),
>      scsi_bus_init_named()
>    ipack: Rename ipack_bus_new_inplace() to ipack_bus_init()
>    pci: Rename pci_root_bus_new_inplace() to pci_root_bus_init()
>    qbus: Rename qbus_create_inplace() to qbus_init()
>    qbus: Rename qbus_create() to qbus_new()
>    ide: Rename ide_bus_new() to ide_bus_init()

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



  parent reply	other threads:[~2021-09-23 13:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 12:11 [PATCH 0/6] Improve consistency of bus init function names Peter Maydell
2021-09-23 12:11 ` [PATCH 1/6] scsi: Replace scsi_bus_new() with scsi_bus_init(), scsi_bus_init_named() Peter Maydell
2021-09-28 15:12   ` Paolo Bonzini
2021-09-23 12:11 ` [PATCH 2/6] ipack: Rename ipack_bus_new_inplace() to ipack_bus_init() Peter Maydell
2021-09-23 12:11 ` [PATCH 3/6] pci: Rename pci_root_bus_new_inplace() to pci_root_bus_init() Peter Maydell
2021-09-23 12:11 ` [PATCH 4/6] qbus: Rename qbus_create_inplace() to qbus_init() Peter Maydell
2021-09-23 12:11 ` [PATCH 5/6] qbus: Rename qbus_create() to qbus_new() Peter Maydell
2021-09-23 16:00   ` Corey Minyard
2021-09-23 12:11 ` [PATCH 6/6] ide: Rename ide_bus_new() to ide_bus_init() Peter Maydell
2021-09-23 18:26   ` John Snow
2021-09-23 13:36 ` Philippe Mathieu-Daudé [this message]
2021-09-23 15:38 ` [PATCH 0/6] Improve consistency of bus init function names Michael S. Tsirkin
2021-09-30  9:39 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1702cda3-cc83-2026-89b4-a9eb6d7a8cd5@redhat.com \
    --to=philmd@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=berto@igalia.com \
    --cc=ehabkost@redhat.com \
    --cc=fam@euphon.net \
    --cc=jsnow@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).