From: "Andreas Färber" <afaerber@suse.de>
To: Alexander Graf <agraf@suse.de>
Cc: pbonzini@redhat.com, peter.crosthwaite@xilinx.com,
qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 08/30] ide/ich: QOM Upcast Sweep
Date: Mon, 01 Jul 2013 12:03:57 +0200 [thread overview]
Message-ID: <51D1540D.7060009@suse.de> (raw)
In-Reply-To: <FD678EF0-B02A-4741-8D97-A750100D7FBC@suse.de>
Am 01.07.2013 01:36, schrieb Alexander Graf:
>
> On 30.06.2013, at 10:21, Andreas Färber wrote:
>
>> Am 24.06.2013 08:55, schrieb peter.crosthwaite@xilinx.com:
>>> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>>
>>> Define and use standard QOM cast macro. Remove usages of DO_UPCAST
>>> and direct -> style upcasting.
>>>
>>> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>> ---
>>>
>>> hw/ide/ahci.h | 5 +++++
>>> hw/ide/ich.c | 10 +++++-----
>>> 2 files changed, 10 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/hw/ide/ahci.h b/hw/ide/ahci.h
>>> index 341a571..916bef0 100644
>>> --- a/hw/ide/ahci.h
>>> +++ b/hw/ide/ahci.h
>>> @@ -305,6 +305,11 @@ typedef struct AHCIPCIState {
>>> AHCIState ahci;
>>> } AHCIPCIState;
>>>
>>> +#define TYPE_ICH_AHCI "ich9-ahci"
>>
>> Let's be as precise as for the LSI SCSI HBA and name this ICH9. :)
>
> No, please. ICH9 is a controller hub. This device really is only about the AHCI part of it.
>
>>
>>> +
>>> +#define ICH_AHCI(obj) \
>>> + OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH_AHCI)
>>
>> Wondering if this is specific to ICH(9)? Alex?
>> Leaving it as is for now, renaming is an easy follow-up.
>
> This is not an ICH9 device. It's an ICH9-AHCI device. And for that the check looks sane from what I can tell.
I don't see how either of your answers relate to my question? Maybe you
were just tired? ;)
So as you can see above, the type is called ich9-ahci, therefore I have
done s/TYPE_ICH_AHCI/TYPE_ICH9_AHCI/g, and I still don't see anything
wrong with it, Peter just ack'ed it. There's a link to the modified
patch below to verify.
What does a controller hub vs. AHCI have to do with ICH vs. ICH9?
The implied question really is, how specific is AHCIPCIState to
ich9-ahci (its sole user AFAICS)? Would an ich6-ahci or ich10-ahci use
the same struct or not? Is it even specific to ICH? If not, we might
want to name the cast macro after the struct PCI_AHCI() rather than
ICH_AHCI(). Compare EHCI where we have a base struct and one derived
class having its own extended state/class structs.
Andreas
>>> +
>>> extern const VMStateDescription vmstate_ahci;
>>>
>>> #define VMSTATE_AHCI(_field, _state) { \
>>> diff --git a/hw/ide/ich.c b/hw/ide/ich.c
>>> index 6c0c0c2..c3cbf2a 100644
>>> --- a/hw/ide/ich.c
>>> +++ b/hw/ide/ich.c
>>> @@ -92,7 +92,7 @@ static const VMStateDescription vmstate_ich9_ahci = {
>>>
>>> static void pci_ich9_reset(DeviceState *dev)
>>> {
>>> - struct AHCIPCIState *d = DO_UPCAST(struct AHCIPCIState, card.qdev, dev);
>>> + struct AHCIPCIState *d = ICH_AHCI(dev);
>>
>> Let's drop the "struct" while touching the line.
>>
>> Thanks, applied to qom-next:
>> https://github.com/afaerber/qemu-cpu/commits/qom-next
>>
>> Andreas
>>
>>>
>>> ahci_reset(&d->ahci);
>>> }
>>> @@ -102,9 +102,9 @@ static int pci_ich9_ahci_init(PCIDevice *dev)
>>> struct AHCIPCIState *d;
>>> int sata_cap_offset;
>>> uint8_t *sata_cap;
>>> - d = DO_UPCAST(struct AHCIPCIState, card, dev);
>>> + d = ICH_AHCI(dev);
>>>
>>> - ahci_init(&d->ahci, &dev->qdev, pci_get_address_space(dev), 6);
>>> + ahci_init(&d->ahci, DEVICE(dev), pci_get_address_space(dev), 6);
>>>
>>> pci_config_set_prog_interface(d->card.config, AHCI_PROGMODE_MAJOR_REV_1);
>>>
>>> @@ -141,7 +141,7 @@ static int pci_ich9_ahci_init(PCIDevice *dev)
>>> static void pci_ich9_uninit(PCIDevice *dev)
>>> {
>>> struct AHCIPCIState *d;
>>> - d = DO_UPCAST(struct AHCIPCIState, card, dev);
>>> + d = ICH_AHCI(dev);
>>>
>>> msi_uninit(dev);
>>> ahci_uninit(&d->ahci);
>>> @@ -163,7 +163,7 @@ static void ich_ahci_class_init(ObjectClass *klass, void *data)
>>> }
>>>
>>> static const TypeInfo ich_ahci_info = {
>>> - .name = "ich9-ahci",
>>> + .name = TYPE_ICH_AHCI,
>>> .parent = TYPE_PCI_DEVICE,
>>> .instance_size = sizeof(AHCIPCIState),
>>> .class_init = ich_ahci_class_init,
>>>
>>
>>
>> --
>> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
>> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2013-07-01 10:04 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 6:49 [Qemu-devel] [PATCH v2 00/30] PCI: Cleanup legacy casts in device land peter.crosthwaite
2013-06-24 6:50 ` [Qemu-devel] [PATCH v2 01/30] net/e1000: QOM Upcast Sweep peter.crosthwaite
2013-06-30 10:59 ` [Qemu-devel] [PATCH qom-next] net/e1000: QOM parent field cleanup Andreas Färber
2013-06-24 6:51 ` [Qemu-devel] [PATCH v2 02/30] net/rtl8139: QOM Upcast Sweep peter.crosthwaite
2013-06-30 11:16 ` [Qemu-devel] [PATCH qom-next] net/rtl8139: QOM parent field cleanup Andreas Färber
2013-06-24 6:52 ` [Qemu-devel] [PATCH v2 03/30] net/pcnet-pci: QOM Upcast Sweep peter.crosthwaite
2013-06-30 7:34 ` Andreas Färber
2013-06-30 11:24 ` Andreas Färber
2013-07-22 17:17 ` Andreas Färber
2013-06-24 6:52 ` [Qemu-devel] [PATCH v2 04/30] usb/hcd-xhci: " peter.crosthwaite
2013-06-30 7:44 ` Andreas Färber
2013-06-30 11:41 ` [Qemu-devel] [PATCH qom-next] usb/hcd-xhci: QOM parent field cleanup Andreas Färber
2013-06-24 6:53 ` [Qemu-devel] [PATCH v2 05/30] scsi/lsi53c895a: QOM Upcast Sweep peter.crosthwaite
2013-06-30 7:51 ` Andreas Färber
2013-06-30 11:54 ` [Qemu-devel] [PATCH qom-next] scsi/lsi53c895a: QOM parent field cleanup Andreas Färber
2013-06-24 6:54 ` [Qemu-devel] [PATCH v2 06/30] scsi/megasas: QOM Upcast Sweep peter.crosthwaite
2013-06-30 12:04 ` [Qemu-devel] [PATCH qom-next] scsi/megasas: QOM parent field cleanup Andreas Färber
2013-06-24 6:55 ` [Qemu-devel] [PATCH v2 07/30] scsi/esp-pci: QOM Upcast Sweep peter.crosthwaite
2013-06-30 12:11 ` [Qemu-devel] [PATCH qom-next] scsi/esp-pci: QOM parent field cleanup Andreas Färber
2013-06-24 6:55 ` [Qemu-devel] [PATCH v2 08/30] ide/ich: QOM Upcast Sweep peter.crosthwaite
2013-06-30 8:21 ` Andreas Färber
2013-06-30 23:36 ` Alexander Graf
2013-07-01 10:03 ` Andreas Färber [this message]
2013-07-01 10:10 ` Alexander Graf
2013-06-30 12:20 ` [Qemu-devel] [PATCH qom-next] ide/ich: QOM parent field cleanup Andreas Färber
2013-06-24 6:56 ` [Qemu-devel] [PATCH v2 09/30] ide/piix: QOM casting sweep peter.crosthwaite
2013-06-30 8:25 ` Andreas Färber
2013-07-22 16:20 ` Andreas Färber
2013-07-22 15:58 ` [Qemu-devel] [PATCH qom-next] ide: Introduce abstract QOM type for PCIIDEState Andreas Färber
2013-07-24 23:28 ` Andreas Färber
2013-06-24 6:57 ` [Qemu-devel] [PATCH v2 10/30] acpi/piix4: QOM Upcast Sweep peter.crosthwaite
2013-06-30 12:41 ` [Qemu-devel] [PATCH qom-next] acpi/piix4: QOM parent field cleanup Andreas Färber
2013-06-24 6:58 ` [Qemu-devel] [PATCH v2 11/30] misc/pci-testdev: QOM Upcast Sweep peter.crosthwaite
2013-06-30 12:49 ` Andreas Färber
2013-06-30 12:50 ` [Qemu-devel] [PATCH qom-next] misc/pci-testdev: QOM parent field cleanup Andreas Färber
2013-06-24 6:58 ` [Qemu-devel] [PATCH v2 12/30] virtio/vmware_vga: QOM casting sweep peter.crosthwaite
2013-06-30 8:41 ` Andreas Färber
2013-06-30 13:02 ` [Qemu-devel] [PATCH qom-next] display/vmware_vga: QOM parent field cleanup Andreas Färber
2013-06-24 6:59 ` [Qemu-devel] [PATCH v2 13/30] misc/ivshmem: QOM Upcast Sweep peter.crosthwaite
2013-06-30 9:18 ` Andreas Färber
2013-06-30 13:15 ` Andreas Färber
2013-06-30 13:16 ` [Qemu-devel] [PATCH qom-next] misc/ivshmem: QOM parent field cleanup Andreas Färber
2013-06-24 7:00 ` [Qemu-devel] [PATCH v2 14/30] xen/xen_platform: QOM casting sweep peter.crosthwaite
2013-06-30 9:32 ` Andreas Färber
2013-06-30 13:23 ` [Qemu-devel] [PATCH qom-next] xen/xen_platform: QOM parent field cleanup Andreas Färber
2013-06-24 7:00 ` [Qemu-devel] [PATCH v2 15/30] isa/*: QOM casting sweep peter.crosthwaite
2013-06-24 7:01 ` [Qemu-devel] [PATCH v2 16/30] pci/*: " peter.crosthwaite
2013-06-30 8:05 ` Andreas Färber
2013-06-24 7:02 ` [Qemu-devel] [PATCH v2 17/30] pci-bridge/pci_bridge_dev: Don't use DO_UPCAST peter.crosthwaite
2013-06-24 7:03 ` [Qemu-devel] [PATCH v2 18/30] pci-bridge/*: substitute ->qdev casts with DEVICE() peter.crosthwaite
2013-06-24 7:03 ` [Qemu-devel] [PATCH v2 19/30] pci/pci_bridge: " peter.crosthwaite
2013-06-24 7:04 ` [Qemu-devel] [PATCH v2 20/30] misc/vfio: " peter.crosthwaite
2013-06-24 7:05 ` [Qemu-devel] [PATCH v2 21/30] net/eepro100: " peter.crosthwaite
2013-06-24 7:06 ` [Qemu-devel] [PATCH v2 22/30] net/ne2000: " peter.crosthwaite
2013-06-24 7:06 ` [Qemu-devel] [PATCH v2 23/30] usb/*: " peter.crosthwaite
2013-06-24 7:07 ` [Qemu-devel] [PATCH v2 24/30] watchdog/wdt_i6300esb: " peter.crosthwaite
2013-06-24 7:08 ` [Qemu-devel] [PATCH v2 25/30] scsi/vmw_pvscsi: " peter.crosthwaite
2013-06-24 7:09 ` [Qemu-devel] [PATCH v2 26/30] i2c/smbus_ich9: " peter.crosthwaite
2013-06-24 7:09 ` [Qemu-devel] [PATCH v2 27/30] ide/cmd646: " peter.crosthwaite
2013-06-24 7:10 ` [Qemu-devel] [PATCH v2 28/30] ide/via: " peter.crosthwaite
2013-06-24 7:11 ` [Qemu-devel] [PATCH v2 29/30] pci-host/*: " peter.crosthwaite
2013-06-24 7:12 ` [Qemu-devel] [PATCH v2 30/30] i386/*: " peter.crosthwaite
2013-06-30 10:44 ` [Qemu-devel] [PATCH v2 00/30] PCI: Cleanup legacy casts in device land -- ANN: qom-next revived Andreas Färber
2013-06-30 15:09 ` [Qemu-devel] [PATCH v2 00/30] PCI: Cleanup legacy casts in device land Andreas Färber
2013-07-01 4:33 ` [Qemu-devel] [PATCH v2 00/30] PCI: Cleanup legacy casts in device land -- ANN: qom-next revived Peter Crosthwaite
2013-07-01 4:50 ` Peter Crosthwaite
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=51D1540D.7060009@suse.de \
--to=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--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).