From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Corey Minyard" <cminyard@mvista.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
pbonzini@redhat.com, "John Snow" <jsnow@redhat.com>
Subject: [PULL 20/21] various: Remove unnecessary OBJECT() cast
Date: Fri, 15 May 2020 08:04:23 +0200 [thread overview]
Message-ID: <20200515060424.18993-21-armbru@redhat.com> (raw)
In-Reply-To: <20200515060424.18993-1-armbru@redhat.com>
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
The OBJECT() macro is defined as:
#define OBJECT(obj) ((Object *)(obj))
Remove the unnecessary OBJECT() casts when we already know the
pointer is of Object type.
Patch created mechanically using spatch with this script:
@@
typedef Object;
Object *o;
@@
- OBJECT(o)
+ o
Acked-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Corey Minyard <cminyard@mvista.com>
Acked-by: John Snow <jsnow@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200512070020.22782-3-f4bug@amsat.org>
[Trivial rebase conflict in hw/s390x/sclp.c resolved]
---
hw/core/bus.c | 2 +-
hw/ide/ahci-allwinner.c | 2 +-
hw/ipmi/smbus_ipmi.c | 2 +-
hw/microblaze/petalogix_ml605_mmu.c | 8 ++++----
hw/s390x/sclp.c | 2 +-
monitor/misc.c | 3 +--
qom/object.c | 4 ++--
7 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/hw/core/bus.c b/hw/core/bus.c
index a9e4118d3c..50924793ac 100644
--- a/hw/core/bus.c
+++ b/hw/core/bus.c
@@ -25,7 +25,7 @@
void qbus_set_hotplug_handler(BusState *bus, Object *handler, Error **errp)
{
- object_property_set_link(OBJECT(bus), OBJECT(handler),
+ object_property_set_link(OBJECT(bus), handler,
QDEV_HOTPLUG_HANDLER_PROPERTY, errp);
}
diff --git a/hw/ide/ahci-allwinner.c b/hw/ide/ahci-allwinner.c
index bb8393d2b6..8536b9eb5a 100644
--- a/hw/ide/ahci-allwinner.c
+++ b/hw/ide/ahci-allwinner.c
@@ -90,7 +90,7 @@ static void allwinner_ahci_init(Object *obj)
SysbusAHCIState *s = SYSBUS_AHCI(obj);
AllwinnerAHCIState *a = ALLWINNER_AHCI(obj);
- memory_region_init_io(&a->mmio, OBJECT(obj), &allwinner_ahci_mem_ops, a,
+ memory_region_init_io(&a->mmio, obj, &allwinner_ahci_mem_ops, a,
"allwinner-ahci", ALLWINNER_AHCI_MMIO_SIZE);
memory_region_add_subregion(&s->ahci.mem, ALLWINNER_AHCI_MMIO_OFF,
&a->mmio);
diff --git a/hw/ipmi/smbus_ipmi.c b/hw/ipmi/smbus_ipmi.c
index 2a9470d9df..f1a0148755 100644
--- a/hw/ipmi/smbus_ipmi.c
+++ b/hw/ipmi/smbus_ipmi.c
@@ -329,7 +329,7 @@ static void smbus_ipmi_init(Object *obj)
{
SMBusIPMIDevice *sid = SMBUS_IPMI(obj);
- ipmi_bmc_find_and_link(OBJECT(obj), (Object **) &sid->bmc);
+ ipmi_bmc_find_and_link(obj, (Object **) &sid->bmc);
}
static void smbus_ipmi_get_fwinfo(struct IPMIInterface *ii, IPMIFwInfo *info)
diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c
index 536571db7f..05a5614a04 100644
--- a/hw/microblaze/petalogix_ml605_mmu.c
+++ b/hw/microblaze/petalogix_ml605_mmu.c
@@ -148,9 +148,9 @@ petalogix_ml605_init(MachineState *machine)
qdev_set_nic_properties(eth0, &nd_table[0]);
qdev_prop_set_uint32(eth0, "rxmem", 0x1000);
qdev_prop_set_uint32(eth0, "txmem", 0x1000);
- object_property_set_link(OBJECT(eth0), OBJECT(ds),
+ object_property_set_link(OBJECT(eth0), ds,
"axistream-connected", &error_abort);
- object_property_set_link(OBJECT(eth0), OBJECT(cs),
+ object_property_set_link(OBJECT(eth0), cs,
"axistream-control-connected", &error_abort);
qdev_init_nofail(eth0);
sysbus_mmio_map(SYS_BUS_DEVICE(eth0), 0, AXIENET_BASEADDR);
@@ -161,9 +161,9 @@ petalogix_ml605_init(MachineState *machine)
cs = object_property_get_link(OBJECT(eth0),
"axistream-control-connected-target", NULL);
qdev_prop_set_uint32(dma, "freqhz", 100 * 1000000);
- object_property_set_link(OBJECT(dma), OBJECT(ds),
+ object_property_set_link(OBJECT(dma), ds,
"axistream-connected", &error_abort);
- object_property_set_link(OBJECT(dma), OBJECT(cs),
+ object_property_set_link(OBJECT(dma), cs,
"axistream-control-connected", &error_abort);
qdev_init_nofail(dma);
sysbus_mmio_map(SYS_BUS_DEVICE(dma), 0, AXIDMA_BASEADDR);
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index 43cc1e0a41..20aca30ac4 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -321,7 +321,7 @@ void s390_sclp_init(void)
Object *new = object_new(TYPE_SCLP);
object_property_add_child(qdev_get_machine(), TYPE_SCLP, new);
- object_unref(OBJECT(new));
+ object_unref(new);
qdev_init_nofail(DEVICE(new));
}
diff --git a/monitor/misc.c b/monitor/misc.c
index 9723b466cd..f5207cd242 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -1837,8 +1837,7 @@ void object_add_completion(ReadLineState *rs, int nb_args, const char *str)
static int qdev_add_hotpluggable_device(Object *obj, void *opaque)
{
GSList **list = opaque;
- DeviceState *dev = (DeviceState *)object_dynamic_cast(OBJECT(obj),
- TYPE_DEVICE);
+ DeviceState *dev = (DeviceState *)object_dynamic_cast(obj, TYPE_DEVICE);
if (dev == NULL) {
return 0;
diff --git a/qom/object.c b/qom/object.c
index e89ffbe3d1..d0be42c8d6 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -756,7 +756,7 @@ Object *object_new_with_propv(const char *typename,
}
}
- object_unref(OBJECT(obj));
+ object_unref(obj);
return obj;
error:
@@ -1650,7 +1650,7 @@ object_property_add_child(Object *obj, const char *name,
assert(!child->parent);
- type = g_strdup_printf("child<%s>", object_get_typename(OBJECT(child)));
+ type = g_strdup_printf("child<%s>", object_get_typename(child));
op = object_property_add(obj, name, type, object_get_child_property, NULL,
object_finalize_child_property, child);
--
2.21.1
next prev parent reply other threads:[~2020-05-15 6:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 6:04 [PULL 00/21] QOM patches for 2020-05-15 Markus Armbruster
2020-05-15 6:04 ` [PULL 01/21] qom: Clearer reference counting in object_initialize_childv() Markus Armbruster
2020-05-15 6:04 ` [PULL 02/21] qom: Clean up inconsistent use of gchar * vs. char * Markus Armbruster
2020-05-15 6:04 ` [PULL 03/21] qom: Drop object_property_del_child()'s unused parameter @errp Markus Armbruster
2020-05-15 6:04 ` [PULL 04/21] qom: Simplify object_property_get_enum() Markus Armbruster
2020-05-15 6:04 ` [PULL 05/21] qom: Drop convenience method object_property_get_uint16List() Markus Armbruster
2020-05-15 6:04 ` [PULL 06/21] qom: Make all the object_property_add_FOO() return the property Markus Armbruster
2020-05-15 6:04 ` [PULL 07/21] qom: Drop object_property_set_description() parameter @errp Markus Armbruster
2020-05-15 6:04 ` [PULL 08/21] tests/check-qom-proplist: Improve iterator coverage Markus Armbruster
2020-05-15 6:04 ` [PULL 09/21] s390x/cpumodel: Fix UI to CPU features pcc-cmac-{aes, eaes}-256 Markus Armbruster
2020-05-15 6:04 ` [PULL 10/21] hw/isa/superio: Make the components QOM children Markus Armbruster
2020-05-15 6:04 ` [PULL 11/21] e1000: Don't run e1000_instance_init() twice Markus Armbruster
2020-05-15 6:04 ` [PULL 12/21] hw/arm/bcm2835: Drop futile attempts at QOM-adopting memory Markus Armbruster
2020-05-15 6:04 ` [PULL 13/21] qdev: Clean up qdev_connect_gpio_out_named() Markus Armbruster
2020-05-15 6:04 ` [PULL 14/21] qom: Drop parameter @errp of object_property_add() & friends Markus Armbruster
2020-05-15 6:04 ` [PULL 15/21] Drop more @errp parameters after previous commit Markus Armbruster
2020-05-15 6:04 ` [PULL 16/21] qdev: Unrealize must not fail Markus Armbruster
2020-05-15 6:04 ` [PULL 17/21] spapr_pci: Drop some dead error handling Markus Armbruster
2020-05-15 6:04 ` [PULL 18/21] qom: Drop @errp parameter of object_property_del() Markus Armbruster
2020-05-15 6:04 ` [PULL 19/21] target: Remove unnecessary CPU() cast Markus Armbruster
2020-05-15 6:04 ` Markus Armbruster [this message]
2020-05-15 6:04 ` [PULL 21/21] hw: Remove unnecessary DEVICE() cast Markus Armbruster
2020-05-15 7:17 ` [PULL 00/21] QOM patches for 2020-05-15 no-reply
2020-05-15 8:54 ` no-reply
2020-05-15 10:17 ` Peter Maydell
2020-05-15 14:34 ` no-reply
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=20200515060424.18993-21-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=cminyard@mvista.com \
--cc=cohuck@redhat.com \
--cc=f4bug@amsat.org \
--cc=jsnow@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).