qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: mdroth@linux.vnet.ibm.com
Cc: lvivier@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	bharata@linux.vnet.ibm.com, sursingh@redhat.com, groug@kaod.org,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH 2/7] spapr: Abolish DRC get_name method
Date: Tue,  6 Jun 2017 18:32:16 +1000	[thread overview]
Message-ID: <20170606083221.9299-3-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20170606083221.9299-1-david@gibson.dropbear.id.au>

DRConnectorClass has a get_name method, however:
  * There's only one implementation, and only ever likely to be one
  * There's exactly one caller, which is (now) local
  * The implementation is trivial

So just open-code what we need.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/spapr_drc.c         | 11 ++---------
 include/hw/ppc/spapr_drc.h |  1 -
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index da3779e..9140b48 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -167,11 +167,6 @@ static uint32_t set_allocation_state(sPAPRDRConnector *drc,
     return RTAS_OUT_SUCCESS;
 }
 
-static const char *get_name(sPAPRDRConnector *drc)
-{
-    return drc->name;
-}
-
 /* has the guest been notified of device attachment? */
 static void set_signalled(sPAPRDRConnector *drc)
 {
@@ -221,8 +216,7 @@ static void prop_get_index(Object *obj, Visitor *v, const char *name,
 static char *prop_get_name(Object *obj, Error **errp)
 {
     sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj);
-    sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
-    return g_strdup(drck->get_name(drc));
+    return g_strdup(drc->name);
 }
 
 static void prop_get_fdt(Object *obj, Visitor *v, const char *name,
@@ -653,7 +647,6 @@ static void spapr_dr_connector_class_init(ObjectClass *k, void *data)
     drck->set_isolation_state = set_isolation_state;
     drck->set_indicator_state = set_indicator_state;
     drck->set_allocation_state = set_allocation_state;
-    drck->get_name = get_name;
     drck->attach = attach;
     drck->detach = detach;
     drck->release_pending = release_pending;
@@ -848,7 +841,7 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner,
         g_array_append_val(drc_power_domains, drc_power_domain);
 
         /* ibm,drc-names */
-        drc_names = g_string_append(drc_names, drck->get_name(drc));
+        drc_names = g_string_append(drc_names, drc->name);
         drc_names = g_string_insert_len(drc_names, -1, "\0", 1);
 
         /* ibm,drc-types */
diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h
index f892b94..795b7dd 100644
--- a/include/hw/ppc/spapr_drc.h
+++ b/include/hw/ppc/spapr_drc.h
@@ -223,7 +223,6 @@ typedef struct sPAPRDRConnectorClass {
                                     sPAPRDRIndicatorState state);
     uint32_t (*set_allocation_state)(sPAPRDRConnector *drc,
                                      sPAPRDRAllocationState state);
-    const char *(*get_name)(sPAPRDRConnector *drc);
 
     /* QEMU interfaces for managing hotplug operations */
     void (*attach)(sPAPRDRConnector *drc, DeviceState *d, void *fdt,
-- 
2.9.4

  parent reply	other threads:[~2017-06-06  8:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06  8:32 [Qemu-devel] [PATCH 0/7] spapr: DRC cleanups (part III) David Gibson
2017-06-06  8:32 ` [Qemu-devel] [PATCH 1/7] spapr: Clean up DR entity sense handling David Gibson
2017-06-06 16:19   ` Michael Roth
2017-06-06  8:32 ` David Gibson [this message]
2017-06-06 16:21   ` [Qemu-devel] [PATCH 2/7] spapr: Abolish DRC get_name method Michael Roth
2017-06-06  8:32 ` [Qemu-devel] [PATCH 3/7] spapr: Assign DRC names from owners David Gibson
2017-06-06  8:32 ` [Qemu-devel] [PATCH 4/7] spapr: Don't misuse DR-indicator in spapr_recover_pending_dimm_state() David Gibson
2017-06-06 17:20   ` Michael Roth
2017-06-06  8:32 ` [Qemu-devel] [PATCH 5/7] spapr: Clean up RTAS set-indicator David Gibson
2017-06-06 20:50   ` Michael Roth
2017-06-06  8:32 ` [Qemu-devel] [PATCH 6/7] spapr: Clean up handling of DR-indicator David Gibson
2017-06-06 21:04   ` Michael Roth
2017-06-07  1:28     ` David Gibson
2017-06-07 23:11       ` Michael Roth
2017-06-08  1:08         ` David Gibson
2017-06-06  8:32 ` [Qemu-devel] [PATCH 7/7] spapr: Change DRC attach & detach methods to functions David Gibson
2017-06-06 21:15   ` Michael Roth

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=20170606083221.9299-3-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=groug@kaod.org \
    --cc=lvivier@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=sursingh@redhat.com \
    /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).