From patchwork Thu Dec 13 14:54:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 153673 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp916975ljp; Thu, 13 Dec 2018 07:13:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/VqscJoXtIkJDyR5eu2GI9BMq8DEWjuXn5Lh+MoHQcCI+zbRMb4ypfbSwmbLIEfiST09wkM X-Received: by 2002:a0c:8b64:: with SMTP id d36mr22936802qvc.233.1544714011696; Thu, 13 Dec 2018 07:13:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544714011; cv=none; d=google.com; s=arc-20160816; b=Qoa24UPFqwWmB9+rNQRH2yDHYll3HXUOD0PZqlAOAST3eoJlFDSDJQNO3jAMYfm4EY rHH2U611RefNm4NnCn+rSRg2UWrGJqbEs0B4YpAGvVqTyWwhz/Xr+Dqf3zc0lsA+y70S 7c9muHPzhVJkstGV8I93469TD/zScYP9NXJDNsR/AhEdNRSkH5UFAneiku3sp/hfsnsX goAYX2bTPdSGWoKEUdUZhhaU8BrTj24FqQABKxLnrcosyCoB9mqUkMItlcRHhedqJqQ2 S6DAu0fnBrBhWX4n+YsnEQBiXe3n4JDU9Rf9sYS/1AS2+MmLu33Bbf0/2+OHuaeLiZFG hfJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=uAb58HKMytWsQlW7TVl9trf9xZXUAplpYiEbAPccYZU=; b=yCirJX3FvHM+LWlSd2DfEVrMIRS8s0y1cwQFMbMXEOlMc4s8WxGjd1cR84J3HDox/7 4ggaK948LCWq9lHqNyfBGtLn3AYu6CoG/fF5rq+fLJ1yoInwomW08Hr0SqDBRxlDVjGi A+It4ambZ8UubTt+GwrjCpJzmokKI28pm+C9WGP49yDxuvglpGdfjYPJv4hcZ7hwxzbR LqW0SkWuOEXDskHUCOGSNETBd7M5IbJDve5+TodhefG2ErS5OkiqTZXLCKuKns03wNHr kzeCjDFs7YGehtuARH2MTJ5UR4+HdG8adqfOj2rkDLG7bgy/7boxyuwOCTr5KTPaubeL OdMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x71si1360202qkx.198.2018.12.13.07.13.31 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 13 Dec 2018 07:13:31 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53177 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXSg7-0004fJ-2f for patch@linaro.org; Thu, 13 Dec 2018 10:13:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXSPJ-0005Ed-Fj for qemu-devel@nongnu.org; Thu, 13 Dec 2018 09:56:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXSPI-0000T1-GS for qemu-devel@nongnu.org; Thu, 13 Dec 2018 09:56:09 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:53512) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gXSPI-0007J5-7p for qemu-devel@nongnu.org; Thu, 13 Dec 2018 09:56:08 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1gXSO8-0007Jk-Af for qemu-devel@nongnu.org; Thu, 13 Dec 2018 14:54:56 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 13 Dec 2018 14:54:27 +0000 Message-Id: <20181213145445.17935-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181213145445.17935-1-peter.maydell@linaro.org> References: <20181213145445.17935-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 19/37] timer/grlib_gptimer: Convert sysbus init function to realize function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Mao Zhongyi Use DeviceClass rather than SysBusDeviceClass in grlib_gptimer_class_init(). Cc: chouteau@adacore.com Signed-off-by: Mao Zhongyi Signed-off-by: Zhang Shengju Reviewed-by: Philippe Mathieu-Daudé Message-id: 20181130093852.20739-18-maozhongyi@cmss.chinamobile.com Signed-off-by: Peter Maydell --- hw/timer/grlib_gptimer.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) -- 2.19.2 diff --git a/hw/timer/grlib_gptimer.c b/hw/timer/grlib_gptimer.c index 4ed96e970a7..183eddc0737 100644 --- a/hw/timer/grlib_gptimer.c +++ b/hw/timer/grlib_gptimer.c @@ -347,10 +347,11 @@ static void grlib_gptimer_reset(DeviceState *d) } } -static int grlib_gptimer_init(SysBusDevice *dev) +static void grlib_gptimer_realize(DeviceState *dev, Error **errp) { GPTimerUnit *unit = GRLIB_GPTIMER(dev); unsigned int i; + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); assert(unit->nr_timers > 0); assert(unit->nr_timers <= GPTIMER_MAX_TIMERS); @@ -366,7 +367,7 @@ static int grlib_gptimer_init(SysBusDevice *dev) timer->id = i; /* One IRQ line for each timer */ - sysbus_init_irq(dev, &timer->irq); + sysbus_init_irq(sbd, &timer->irq); ptimer_set_freq(timer->ptimer, unit->freq_hz); } @@ -375,8 +376,7 @@ static int grlib_gptimer_init(SysBusDevice *dev) unit, "gptimer", UNIT_REG_SIZE + GPTIMER_REG_SIZE * unit->nr_timers); - sysbus_init_mmio(dev, &unit->iomem); - return 0; + sysbus_init_mmio(sbd, &unit->iomem); } static Property grlib_gptimer_properties[] = { @@ -389,9 +389,8 @@ static Property grlib_gptimer_properties[] = { static void grlib_gptimer_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = grlib_gptimer_init; + dc->realize = grlib_gptimer_realize; dc->reset = grlib_gptimer_reset; dc->props = grlib_gptimer_properties; }