Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CC8CC47089 for ; Wed, 7 Dec 2022 09:01:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3A1FC85670; Wed, 7 Dec 2022 09:56:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ko0iIk5M"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6095585608; Wed, 7 Dec 2022 09:56:02 +0100 (CET) Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (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 CE9AB85652 for ; Wed, 7 Dec 2022 09:55:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pl1-x632.google.com with SMTP id jl24so16419798plb.8 for ; Wed, 07 Dec 2022 00:55:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.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=xtIU8RUfT8cVHzbarhsyLG9Ageo3osY8iBUgffqITg8=; b=ko0iIk5M6mzSGgeQKDax3B8pQsONeYtTmpVOOZjwUiwa0o+eMJzLAAHHD6suRyznHX Bzd8yvTzjX0hFGce4O9Yo66U5Lo2xSqIu1+xS1EpOXaxMro0WcoUb6qChZeYHs8HDx/A ctLjqhVFakxQadjD23uzlr+PkiIUCLXhdMgiA= 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=xtIU8RUfT8cVHzbarhsyLG9Ageo3osY8iBUgffqITg8=; b=6/Wjl9MLRIiJ1cN5yaaRdiXNNh8/dOhNHy9Sw8byHuMO4H8/xFNiEO8nOA2kQ7g7Rf zvU2ktb78aIc0Fs3OIz8FHoTMsRHAlSF3Iv60/CWyhCgwfKn5C8CiqMwkmey1aEu/slg kt5scKFEFFm7dfhu17M8Eu/s1x6AbxZNt3YACvXHE2TPqdhN622TYRl0zueXu/5mfLVs T9ybG05LHO3BHKU8dz9jmyk3o3g76LLxQCGOUj2AQoW+Re6De7Y7rrhWWYr+AXZKvtIm SNUatqtWrcdDmCXeBvRY60vn0dpU37ktChjc/InXFJ7HjN0Ou+Src46ftESS0uNVko// Tyxw== X-Gm-Message-State: ANoB5pn5SoaBOkmpCHy+9gAYMUhb8lT9opjzvnqJyu0Nt29NZ97rI0NB SFZMhdABH47ING/ULrUCMOEbCsQkNsCIBzmW X-Google-Smtp-Source: AA0mqf7fqkCQRGE5YanNn8GgjDJjyELZ/zF+hX6Z/XQeCWn3fUQsMEm8t6I07pgATl2sFfV0OHlLiA== X-Received: by 2002:a17:902:8d98:b0:189:8e39:3c88 with SMTP id v24-20020a1709028d9800b001898e393c88mr47246063plo.102.1670403356968; Wed, 07 Dec 2022 00:55:56 -0800 (PST) Received: from localhost.localdomain ([27.110.126.54]) by smtp.gmail.com with ESMTPSA id l16-20020a170903121000b0018157b415dbsm14145514plh.63.2022.12.07.00.55.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 00:55:56 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: U-Boot Custodians , Simon Glass , AKASHI Takahiro , Rob Herring , Stefan Roese Subject: [PATCH 35/71] scsi: Remove all children of SCSI devices before rescanning Date: Wed, 7 Dec 2022 21:51:01 +1300 Message-Id: <20221207085137.445249-36-sjg@chromium.org> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog In-Reply-To: <20221207085137.445249-1-sjg@chromium.org> References: <20221207085137.445249-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean At present this only unbinds block devices of a certain type. But SCSI device can have different types of children, including bootdevs. Unbind all children so tht everything is clean and ready for a new scan. Signed-off-by: Simon Glass --- drivers/scsi/scsi.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 6419f4be210..2ae96e171eb 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -644,12 +644,23 @@ int scsi_scan(bool verbose) if (verbose) printf("scanning bus for devices...\n"); - blk_unbind_all(UCLASS_SCSI); - ret = uclass_get(UCLASS_SCSI, &uc); if (ret) return ret; + /* remove all children of the SCSI devices */ + uclass_foreach_dev(dev, uc) { + log_debug("unbind %s\n", dev->name); + ret = device_chld_remove(dev, NULL, DM_REMOVE_NORMAL); + if (!ret) + ret = device_chld_unbind(dev, NULL); + if (ret) { + if (verbose) + printf("unable to unbind devices (%dE)\n", ret); + return log_msg_ret("unb", ret); + } + } + uclass_foreach_dev(dev, uc) { ret = scsi_scan_dev(dev, verbose); if (ret) -- 2.39.0.rc0.267.gcb52ba06e7-goog