Received: by 2002:a17:906:fcb7:b0:974:3dd3:6e73 with SMTP id qw23csp5235ejb; Tue, 6 Jun 2023 21:44:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ItylP8Ua7Jr1T1Czb4w5rhO31Efue2ONjHc4CiByIAIffvUujDCjQ9pgKI1VXvpK2WxFJ X-Received: by 2002:a05:620a:2402:b0:75b:23a0:e7ae with SMTP id d2-20020a05620a240200b0075b23a0e7aemr1004938qkn.15.1686113098640; Tue, 06 Jun 2023 21:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686113098; cv=none; d=google.com; s=arc-20160816; b=U0Q5yUC6A29Q8wNT4Gq4ROENOjv0Nx2/7hxnJGHExCVd78Lspt0iXmL1MsgL9ocfxn LHJUJx44GpwEcOyFYYKjZtWMp1yozDvwUR2Q25uqr6nXN+Jmacn3M6XCW1JLsM01hYwk Mg81zvA4NBbk/b1IEAF5PDqpJjxpPLw3QkGrCeUsHZvPhPCEPKCqwb63VRobcOax9toq 2whi4TEFONWXpvQmdCRUb7tLvZeJqj4bhF5oy1sOv9SdJtOAkPNc/WuKus0Y1cowrvdH WOt5vhfAY1CSivwIi4bXcBP8Liw8ggypMZehemIm38NbCmFFB8SHDhDUOz0d32lZDM91 QWzw== 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; bh=vW2qbGF9pjMNNGNGVkM0AXfvqafdXxlzqBN2mfGGevg=; b=fyUMah0IlJtUJgmBcfwCt/GEyFijyo+X952Nwm54YnzYfab8ggO8lhcfJcSvgm05vg tr4kSA8mWKqe9CA5Bf/My9M5wrE42s1BPsev2wu1G0paIpgplzyFZYhQgIHE4J95b7/j 36QIEVab/YyWl0Us0md6HBcS2R62P/eSoJF+HxSshSaUvaovPvcyakRPmyz1Wzik3HNS QzX46Th2mm0PGz/Wn/eo5FBObqxI/miT2YxIrjOXEh3IlSugxHiNv5WZFfNHGyp7GCFq SFOs0ySCtrcmPHLvqMY4guf9+W+Dt6L2QDyi+z2/mlkmDdOq7Lsk5fDC8IkBP6mdtxzJ uSvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c18-20020a05620a11b200b0075938f5f300si7178412qkk.287.2023.06.06.21.44.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Jun 2023 21:44:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6kyN-0001sZ-Q8; Wed, 07 Jun 2023 00:40:39 -0400 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 1q6kyG-0001qG-NY; Wed, 07 Jun 2023 00:40:34 -0400 Received: from gandalf.ozlabs.org ([150.107.74.76]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6kyF-0003s3-3g; Wed, 07 Jun 2023 00:40:32 -0400 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4QbZQh5BfPz4x4K; Wed, 7 Jun 2023 14:40:28 +1000 (AEST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4QbZQd6RBbz4x3g; Wed, 7 Jun 2023 14:40:25 +1000 (AEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, Peter Maydell , Joel Stanley , Andrew Jeffery , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Alistair Francis Subject: [PATCH v2 09/12] m25p80: Introduce an helper to retrieve the BlockBackend of a device Date: Wed, 7 Jun 2023 06:39:40 +0200 Message-Id: <20230607043943.1837186-10-clg@kaod.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230607043943.1837186-1-clg@kaod.org> References: <20230607043943.1837186-1-clg@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=150.107.74.76; envelope-from=SRS0=5JAy=B3=kaod.org=clg@ozlabs.org; helo=gandalf.ozlabs.org X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@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-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: 2iwvGkwcl6ui It will help in getting rid of some drive_get(IF_MTD) calls by retrieving the BlockBackend directly from the m25p80 device. Cc: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Cédric Le Goater --- include/hw/block/flash.h | 4 ++++ hw/block/m25p80.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h index 7198953702b7..de93756cbe8f 100644 --- a/include/hw/block/flash.h +++ b/include/hw/block/flash.h @@ -76,4 +76,8 @@ uint8_t ecc_digest(ECCState *s, uint8_t sample); void ecc_reset(ECCState *s); extern const VMStateDescription vmstate_ecc_state; +/* m25p80.c */ + +BlockBackend *m25p80_get_blk(DeviceState *dev); + #endif diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index dc5ffbc4ff52..afc3fdf4d60b 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -25,6 +25,7 @@ #include "qemu/units.h" #include "sysemu/block-backend.h" #include "hw/block/block.h" +#include "hw/block/flash.h" #include "hw/qdev-properties.h" #include "hw/qdev-properties-system.h" #include "hw/ssi/ssi.h" @@ -1830,3 +1831,8 @@ static void m25p80_register_types(void) } type_init(m25p80_register_types) + +BlockBackend *m25p80_get_blk(DeviceState *dev) +{ + return M25P80(dev)->blk; +} -- 2.40.1