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 76D00C54EBC for ; Sun, 8 Jan 2023 03:01:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E3A5D856EA; Sun, 8 Jan 2023 03:56:54 +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="BhIEI0Jr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 53483856D6; Sun, 8 Jan 2023 03:56:10 +0100 (CET) Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) (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 6809D85658 for ; Sun, 8 Jan 2023 03:51:22 +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-il1-x12c.google.com with SMTP id o8so3299765ilo.1 for ; Sat, 07 Jan 2023 18:51:22 -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=klzrnl5c/X4Qd+TVC7Vd/OuTb8yjTA+/eYVxhyaUnhw=; b=BhIEI0JrfevVxAznAiekiZ2gPUluee4qkzwWeo0U71+UO377H1mGNmiBER19RAU2bG //fweCUpbe3Hpp/kdMpoxM9SLA3+FlsojLFGwTutgNAg1te2dwuFYLLl3eEs98F0N40l FX6ZxSgzHUwheTvWv4ftmtMCMsxBJKYYZeV2I= 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=klzrnl5c/X4Qd+TVC7Vd/OuTb8yjTA+/eYVxhyaUnhw=; b=lOoGpysiLavFwP2LNJobfxHpY+VziOcgslMbJk19mtQzrIVyai0sLu/EvzkGNLaEbV K3kjKV/a2HT7c2bcoee9xowfVi2B2n7p+dD428okiver767Vn3stqjPdWgwq+jQmzwtz Q9zfbjMus4OVdcwZZO9UnzgsXgpHjFkLeBOrEmgH6gIg7tskr0Ky41B1RUn3IYIapF5Q nhMgaGkDt3GI28h2GoXyJioZeRflIojW6YJxCSDL+Rb91JcL57bKp5ZXrqGKaMoZ3XGi F/AVgKoWBExnEdEegPu93deEQh93jYhr2FPbW0Od3VI4S8dPR1QNbvkpqWcM/zW7aZ3L m9Pw== X-Gm-Message-State: AFqh2kpiDcEDNaddNzOUW9d0dHMLAGJOkQwGbWr7uXRba+siWOzv34IA 6Y3+6pRYpOzzMo99kAnxgpwJG+krj+ZeFZc7 X-Google-Smtp-Source: AMrXdXtkD2MXDtdSrtMYMyY4jTcKKNUhh5gHmF69kALL8Pd30+beLMl9h3lQ7cYCZ4W3hN7H/6CAwA== X-Received: by 2002:a92:cb41:0:b0:30c:41:558 with SMTP id f1-20020a92cb41000000b0030c00410558mr47512965ilq.18.1673146281951; Sat, 07 Jan 2023 18:51:21 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-71-56-217-229.hsd1.co.comcast.net. [71.56.217.229]) by smtp.gmail.com with ESMTPSA id c17-20020a92bd11000000b00302a00aaefasm1622174ile.26.2023.01.07.18.51.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jan 2023 18:51:21 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: U-Boot Custodians , Simon Glass , Rob Herring Subject: [PATCH v2 35/71] scsi: Remove all children of SCSI devices before rescanning Date: Sat, 7 Jan 2023 19:50:11 -0700 Message-Id: <20230108025047.522240-36-sjg@chromium.org> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230108025047.522240-1-sjg@chromium.org> References: <20230108025047.522240-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 --- (no changes since v1) 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.314.g84b9a713c41-goog