From patchwork Thu Feb 28 03:05:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 223764 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 561D42C0089 for ; Thu, 28 Feb 2013 14:06:14 +1100 (EST) Received: from localhost ([::1]:45300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAtoy-0002hj-8P for incoming@patchwork.ozlabs.org; Wed, 27 Feb 2013 22:06:12 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAtoX-0002gZ-RM for qemu-devel@nongnu.org; Wed, 27 Feb 2013 22:05:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAtoT-0006XG-8H for qemu-devel@nongnu.org; Wed, 27 Feb 2013 22:05:45 -0500 Received: from mail-pa0-f42.google.com ([209.85.220.42]:55265) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAtoT-0006Wy-27 for qemu-devel@nongnu.org; Wed, 27 Feb 2013 22:05:41 -0500 Received: by mail-pa0-f42.google.com with SMTP id kq12so847717pab.1 for ; Wed, 27 Feb 2013 19:05:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=lVj8o0grpnhbe4dHUqcsKNNhLI2LARQ0BEjo+bHQVPE=; b=MAleVbiL7xig/EcVxJYSZWPT6SeULspv7V3GadX4SZnBOzA+4NYccRTZ8t86NIqRxm mtkyt/eCrRnVCqhXx5YvZ9B3S+29zZpKWQaqI0dLNP8xgheZqT66ZikelhNaYkjmxHxd +KtJzWS4dDg4zPn6lOKqmv/wlGj1m+5SPO5DzmhedP6fwPP5h/E9S5B6+IgTRK5F2oDv kpAZrhhiGAldIxaX+Qgt8bO2RETaWyZJ8aXgpPCd4ChnnxP2V5ek/WpZSgcuNGLq6e2Q 8WiFT8X99c83UWUTMUG6q8LK/DZl3crSAZerkHUnvVa3Afhpkvl3fEDJBSp8frjV8bUM XsCg== X-Received: by 10.68.189.9 with SMTP id ge9mr6777946pbc.166.1362020739233; Wed, 27 Feb 2013 19:05:39 -0800 (PST) Received: from ka1.ozlabs.ibm.com (ibmaus65.lnk.telstra.net. [165.228.126.9]) by mx.google.com with ESMTPS id jp9sm6669786pbb.7.2013.02.27.19.05.35 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Feb 2013 19:05:38 -0800 (PST) From: Alexey Kardashevskiy To: Benjamin Herrenschmidt , David Gibson Date: Thu, 28 Feb 2013 14:05:26 +1100 Message-Id: <1362020726-7040-1-git-send-email-aik@ozlabs.ru> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQkeBjkUJt/qVdIhiNDkrkyNkxK7cKJo8tcoW50di0ZNhconccjRkw1QgUoAWa56ukG1QUYN X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.42 Cc: Alexey Kardashevskiy , qemu-ppc@nongnu.org, Alexander Graf , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] spapr pci: get rid of "busname" property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org As the sPAPRPHBState struct includes the DeviceState struct which already has an "id" propetry, and this property can be set from the command line, there is no need in an additional "busname" property to specify a bus name. So the bus device "id" property can be used to name a bus. The patch removes the "busname" property from sPAPR PHB device. Signed-off-by: Alexey Kardashevskiy --- hw/spapr_pci.c | 13 +++++++------ hw/spapr_pci.h | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/spapr_pci.c b/hw/spapr_pci.c index d017d5a..888c907 100644 --- a/hw/spapr_pci.c +++ b/hw/spapr_pci.c @@ -519,6 +519,7 @@ static int spapr_phb_init(SysBusDevice *s) sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s); PCIHostState *phb = PCI_HOST_BRIDGE(s); char *namebuf; + const char *busname; int i; PCIBus *bus; @@ -575,9 +576,6 @@ static int spapr_phb_init(SysBusDevice *s) } sphb->dtbusname = g_strdup_printf("pci@%" PRIx64, sphb->buid); - if (!sphb->busname) { - sphb->busname = sphb->dtbusname; - } namebuf = alloca(strlen(sphb->dtbusname) + 32); @@ -621,7 +619,11 @@ static int spapr_phb_init(SysBusDevice *s) &sphb->msiwindow); } - bus = pci_register_bus(DEVICE(s), sphb->busname, sphb->dtbusname, + busname = s->qdev.id; + if (!busname || !busname[0]) { + busname = sphb->dtbusname; + } + bus = pci_register_bus(DEVICE(s), busname, sphb->dtbusname, pci_spapr_set_irq, pci_spapr_map_irq, sphb, &sphb->memspace, &sphb->iospace, PCI_DEVFN(0, 0), PCI_NUM_PINS); @@ -663,7 +665,6 @@ static void spapr_phb_reset(DeviceState *qdev) } static Property spapr_phb_properties[] = { - DEFINE_PROP_STRING("busname", sPAPRPHBState, busname), DEFINE_PROP_INT32("index", sPAPRPHBState, index, -1), DEFINE_PROP_HEX64("buid", sPAPRPHBState, buid, -1), DEFINE_PROP_HEX32("liobn", sPAPRPHBState, dma_liobn, -1), @@ -750,7 +751,7 @@ PCIHostState *spapr_create_phb(sPAPREnvironment *spapr, int index, dev = qdev_create(NULL, TYPE_SPAPR_PCI_HOST_BRIDGE); qdev_prop_set_uint32(dev, "index", index); - qdev_prop_set_string(dev, "busname", busname); + dev->id = g_strdup(busname); qdev_init_nofail(dev); return PCI_HOST_BRIDGE(dev); diff --git a/hw/spapr_pci.h b/hw/spapr_pci.h index 0749fee..3eecc6d 100644 --- a/hw/spapr_pci.h +++ b/hw/spapr_pci.h @@ -39,7 +39,6 @@ typedef struct sPAPRPHBState { int32_t index; uint64_t buid; - char *busname; char *dtbusname; MemoryRegion memspace, iospace;