From patchwork Mon Jan 9 11:53:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640608 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2091079pvb; Mon, 9 Jan 2023 04:00:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXvuSOaJAfZ9xPUcnf/DXA5A7LoyZDsA6jObhYYfra7TbhdmIlY2BhFLPVVrxP1/49VIxNYg X-Received: by 2002:a0c:b3cb:0:b0:531:c556:c2ce with SMTP id b11-20020a0cb3cb000000b00531c556c2cemr39875333qvf.16.1673265601586; Mon, 09 Jan 2023 04:00:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673265601; cv=none; d=google.com; s=arc-20160816; b=iCXPahDHnECqunIxNys3I1YqvncZQzhlUaF18J6R/DQGIpoRuk2GwRyr5Imt9lYfEO C13u4PFd5+A3F+pp5M34thWXGFdSwP0iFnhua1yVBIwo7/JHVp0u03r20dvdKRSuzfBH Af1y+GXEH6NBOp7L6iYuWSpCMncxsvKpq+qv1U0hW/gdlbZMDQA4/vSULlqXtDtA8FXa txHyJrtE2k5StuFCMzbMCoRI4uZXXpIBB2tKBmnrJYO5Giloqlkb5RKQAKNEn4joZcVC 6jfPgdHk5EP+Khd5dOKg3ql8VzcUT0+A3CpVtPerwTNrCdobTfyttyiRXgK0dL5l6Zxs c7fQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=arGDJqPATELoiqCitRXAST5VMx8cy/N7Kqb6K/IJ2aQ=; b=0BzooBydwEEkHSNaAlNc/I6u0AqOFeOVZwvvuwL+2Oueb9aNkPhOgJt1bu+uBQmKOd wsQblp5gYBxNJbC/WsfFpyyqVUyTxCpcSuLJgnWO4IcO5Y0Jl+BKh+ppyV76MpZVORjc OXqCzi+jn7+8w2NQeRUQ+fhIcBR387eD5MAzUDAAWIAK2ApSmRx+hwU6600R8OUENbNp r3gXfKw6ywy9s5Ej+uNX6fIYxbTP3QqpGskQ/j6z9N9X0wTHSTfHmLfvmIBzFPqsXaEk StGR4cyO1JrdWTSOZcVtyWXFwGpLOorJ1k7dbW8+pDLBfIGO//7COlcHqNcHUue8OTbw eqBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y8zzCrgT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w5-20020a05620a444500b00704f6874e7fsi4631435qkp.472.2023.01.09.04.00.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:00:01 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y8zzCrgT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pEqiu-0002wq-KZ; Mon, 09 Jan 2023 06:53:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEqih-0002sU-Rc for qemu-devel@nongnu.org; Mon, 09 Jan 2023 06:53:40 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEqig-00082Z-8s for qemu-devel@nongnu.org; Mon, 09 Jan 2023 06:53:39 -0500 Received: by mail-wm1-x331.google.com with SMTP id i17-20020a05600c355100b003d99434b1cfso6480506wmq.1 for ; Mon, 09 Jan 2023 03:53:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=arGDJqPATELoiqCitRXAST5VMx8cy/N7Kqb6K/IJ2aQ=; b=Y8zzCrgTut6jgjD+2PJJkoxwC8GTlfXoG3Y6pHmori7AkAM9EIXts79gGfuYdKWTnM Lp4IfJpjqJ6ygvjqPHSf/FrlJYQ0VTUbWLjg8UMsHdRfLMq41uhL+Vy8KMxCjafgV3l2 nn2EeN4u+ET6PQaj7MNOoRaea9dmORXobnGLJcHRlV200nrIDq4mRQQTuJ8EhcCTcs/x P8L5WuWUPzj7Ri7gVD2iuT68cyjV6CUIhm2utjEzFD6xdlqmOiHYGf5ZOTyPfxnyOtYL 8zjkVr425b44r+EmKsJg/RdE7u/gn8ZZl8OaG+Q6I/RutHUHEnEg18WRmGh7HT2NYQmn 6YFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=arGDJqPATELoiqCitRXAST5VMx8cy/N7Kqb6K/IJ2aQ=; b=U2oPdQbICErce7QJVvqXweWbWzdH+JKDi0shxj1FcEZ6sa/OZZOSljJ9pNcg1NVekZ dDH+ehcmXewWblN6FY3ICKZbIhVO964eIeTXtbPPTEwkz8yBx826cJGlD/7UmsLf/1my nVkutypjUlolmLv1jMXPS1munA7N8QE1/D/gFaios54Xeidrv7LjTEXPAPMXJqh9j2ha DVDUjBrKfe3bjBF6iqQmNJmkHjWbfZBHsyg/ewLvEWbihydbOmKCNL8ZYdjt1pixPkrF iUNNK9oRRMHCnxp8FEIwD7/XAI58+tbfNgSzWX12PD3wU9+bn3V4isqUSbH51X3MpJyH OGZQ== X-Gm-Message-State: AFqh2kra7xMN+fUywgn5hgWUJGwMOdnyJpWvN4NzGdJBDh10bf4id9zx l+BNSUJqpjxH5Fq5RgU4o24MH0cB16f5xsdt X-Received: by 2002:a05:600c:4f48:b0:3c6:f7ff:6f87 with SMTP id m8-20020a05600c4f4800b003c6f7ff6f87mr46835458wmq.11.1673265217427; Mon, 09 Jan 2023 03:53:37 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003d98a7aa12csm17525389wmg.16.2023.01.09.03.53.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 03:53:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, Jan Kiszka , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 04/13] hw/arm/collie: Simplify flash creation using for() loop Date: Mon, 9 Jan 2023 12:53:07 +0100 Message-Id: <20230109115316.2235-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109115316.2235-1-philmd@linaro.org> References: <20230109115316.2235-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/collie.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/hw/arm/collie.c b/hw/arm/collie.c index d59c376e60..9edff59370 100644 --- a/hw/arm/collie.c +++ b/hw/arm/collie.c @@ -40,7 +40,6 @@ static struct arm_boot_info collie_binfo = { static void collie_init(MachineState *machine) { - DriveInfo *dinfo; MachineClass *mc = MACHINE_GET_CLASS(machine); CollieMachineState *cms = COLLIE_MACHINE(machine); @@ -55,15 +54,13 @@ static void collie_init(MachineState *machine) memory_region_add_subregion(get_system_memory(), SA_SDCS0, machine->ram); - dinfo = drive_get(IF_PFLASH, 0, 0); - pflash_cfi01_register(SA_CS0, "collie.fl1", FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - FLASH_SECTOR_SIZE, 4, 0x00, 0x00, 0x00, 0x00, 0); - - dinfo = drive_get(IF_PFLASH, 0, 1); - pflash_cfi01_register(SA_CS1, "collie.fl2", FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - FLASH_SECTOR_SIZE, 4, 0x00, 0x00, 0x00, 0x00, 0); + for (unsigned i = 0; i < 2; i++) { + DriveInfo *dinfo = drive_get(IF_PFLASH, 0, i); + pflash_cfi01_register(i ? SA_CS1 : SA_CS0, + i ? "collie.fl2" : "collie.fl1", FLASH_SIZE, + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, + FLASH_SECTOR_SIZE, 4, 0x00, 0x00, 0x00, 0x00, 0); + } sysbus_create_simple("scoop", 0x40800000, NULL);