From patchwork Mon Oct 4 03:44:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515147 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062777imy; Sun, 3 Oct 2021 20:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWtxbL3bryNRZTyEwyDupsCta4aFr4xvs8f46g0G6Tt9vgjoC2TX/gdNiU0bRafW7e4qxJ X-Received: by 2002:a50:ec08:: with SMTP id g8mr12090188edr.303.1633319315278; Sun, 03 Oct 2021 20:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319315; cv=none; d=google.com; s=arc-20160816; b=VuxdHNvsOtKFEJPSgkWeaVqOhhKTc8h8CgfWxvoDX0D4Q8eYdeOzDly4qxQ6Epd2IB H8tl7nML9xhlrs3CEGy8X/LdQzjEu4we38Mr3o7lTnNHiFD7TcNJUf09DOEFzJUtOq57 B3E8wvkOjOWK870Jq4CdI+tIsvXDIkVM+HxStbWkIVQD7qoDvPHZ1GFTjs827Z/YRHPV j5/Ce4tpUdl8llmBYS8U2cMZRogw370ausi/aYHfD6av5fnQVuNgUZO7m+mswLIY5iLU NfcqhDZyk4RMKQCcAn3xVDP3C4PMaN6MI2CPx0BFlWUQ8HRDmjxaq1KMMDykLqC3VRxh WKSA== 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=3twPqvbIuj/O0dFgQHqyndh2aMFnT3N8S7zk68TTxgo=; b=ghWpIk6MdZlSj923VDfPC8gQIaTq4apfRJLH2J/nXzDfE6sAEXvCuf0ABrZ48Eg98X KDm41pjxFyc9Tw4E55VkDJJ805CS3BTIo8W1z1GCtaSRpwtgyKYKScLXtH7zW6HMNACp wVNt6MqUJQwnBmrni3V4CTDkQzp26cbpFFqkAWsscFcifnOKqvAHDxP7742Y+m0IlAMZ EJzZCczWvc7VbAclSMaAHLXkRjo4LQcG6m3titpoMaA6XRm+7r77cFBTCkWP6AdOay3c 1ih1ntze/3tydCHILLRdQVAG5NX1q/iTSFjWaATQqiYzU9e573sGZ/JniuUyrGK1THft arnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VPwtCuEk; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id s11si18721502edh.626.2021.10.03.20.48.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:48:35 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VPwtCuEk; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AC6C4835A6; Mon, 4 Oct 2021 05:47:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="VPwtCuEk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A0B7C8358A; Mon, 4 Oct 2021 05:46:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A826F83573 for ; Mon, 4 Oct 2021 05:46:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pl1-x630.google.com with SMTP id x4so10179778pln.5 for ; Sun, 03 Oct 2021 20:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3twPqvbIuj/O0dFgQHqyndh2aMFnT3N8S7zk68TTxgo=; b=VPwtCuEkvZA4HwsNu7LkNH74Pcx82TJ9pIXGO7xmrTMoGJh/jMf7Ml36C5MoqcQ1j5 Mny+zlwHNIoCbtkiKVp0S1Xl1b1DnQMSssD3LXJ2ElthmDPrY8TfoTU9qb2ssyAhXvdf v9UyOMGcbxQ+ZGrhJ2vfgg/3OnS4nwYAGdU+3JpG0HFjGGMwsRvtfOL54wP4rdZZkfEN ao3O7wRqerodXzQZ4m5oEdr/fOeJCDn8IwAFqj19vxGa1biLhNRryWgOtSSxnSyeWWnE fHUg8BPegwzoyJVfKhVK6BT5Z9+E7by69IhXQvfcvG32MOvCqfCABPe1ruyIVmJ+jSXw ICEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3twPqvbIuj/O0dFgQHqyndh2aMFnT3N8S7zk68TTxgo=; b=JSiXok6/5IramPaFtradPaSJwvF8+dmhNWqCylxvn8m1/n55K+YcdqjNO4mfkklmf/ ijd0kTakmqYhQC502XxtbGsQkPcMnQGGahss055MK5bJgKwnecs/VfiG92DolGky9Neb dZkzKcC4aEkbBZpVBmr2Ix6iqxh1DV6ZSM5Y9vAPq0IYLwc+CtbkQIyOEmsfAR1sG8ew zr1epvd2/wiu+GNWm3nBVN91YRfEbd2toecYWAR0q8rfHRt4evyrLklfc3i8w3VpRNN1 6w+QX+Awq4pqIwlx/acUQrJpi7pbuTrF066fikS/S5NYvPCJz9Ok/nF5hX900Y/zMS9L pBrQ== X-Gm-Message-State: AOAM533P7t4OMR+e1ZZ8UTtbSAIlBGLgf3QGh4JZueI4DlCsgldtaEYw Rh3tWeKQrctCqyF2UbcDMU55WlFNsJKZJQ== X-Received: by 2002:a17:902:b909:b0:13a:2d8e:12bc with SMTP id bf9-20020a170902b90900b0013a2d8e12bcmr21168368plb.6.1633319192047; Sun, 03 Oct 2021 20:46:32 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.46.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:31 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 19/22] dm: blk: call efi's device-removal hook Date: Mon, 4 Oct 2021 12:44:27 +0900 Message-Id: <20211004034430.41355-20-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Adding the callback function, efi_disk_delete(), in block devices's pre_remove hook will allows for automatically deleting efi_disk objects per block device. This will eliminate any improper efi_disk objects which hold a link to non-existing udevice structures when associated block devices are physically un-plugged or udevices are once removed (and re-created) by executing commands like "scsi rescan." Signed-off-by: AKASHI Takahiro --- drivers/block/blk-uclass.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) -- 2.33.0 diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index ce45cf0a8768..b8ad267c6c61 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -847,6 +847,16 @@ static int blk_post_probe(struct udevice *dev) return 0; } +static int blk_pre_remove(struct udevice *dev) +{ + if (CONFIG_IS_ENABLED(EFI_LOADER)) { + if (efi_disk_delete(dev)) + debug("*** efi_pre_remove_device failed\n"); + } + + return 0; +} + static int blk_part_post_probe(struct udevice *dev) { if (CONFIG_IS_ENABLED(EFI_LOADER)) { @@ -861,10 +871,21 @@ static int blk_part_post_probe(struct udevice *dev) return 0; } +static int blk_part_pre_remove(struct udevice *dev) +{ + if (CONFIG_IS_ENABLED(EFI_LOADER)) { + if (efi_disk_delete(dev)) + debug("*** efi_pre_remove_device failed\n"); + } + + return 0; +} + UCLASS_DRIVER(blk) = { .id = UCLASS_BLK, .name = "blk", .post_probe = blk_post_probe, + .pre_remove = blk_pre_remove, .per_device_plat_auto = sizeof(struct blk_desc), }; @@ -937,6 +958,7 @@ U_BOOT_DRIVER(blk_partition) = { UCLASS_DRIVER(partition) = { .id = UCLASS_PARTITION, .post_probe = blk_part_post_probe, + .pre_remove = blk_part_pre_remove, .per_device_plat_auto = sizeof(struct disk_part), .name = "partition", };