From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D127AC433EF for ; Fri, 1 Oct 2021 05:03:13 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 401D561A57 for ; Fri, 1 Oct 2021 05:03:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 401D561A57 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8D55682B94; Fri, 1 Oct 2021 07:03:09 +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="zxTCOoqb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2D34681FAD; Fri, 1 Oct 2021 07:03:04 +0200 (CEST) Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) (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 C530C820E3 for ; Fri, 1 Oct 2021 07:02:58 +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-pf1-x42b.google.com with SMTP id u7so6861629pfg.13 for ; Thu, 30 Sep 2021 22:02:58 -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=6lrdVuf2bMn02/XrYkdZnAojTsvLmTg0lU2639BMch8=; b=zxTCOoqbc7PeWVnnn5fPWOjfBRqMJ1/e3HPS4/C5Zwo4fMaYSEo7qR2b3MYAjd4CCo cXB9vqVb0nf1IUscpXt4t1cZ5AFKQoOuVrnlLhfw3MYuJ27K2bXsAyewRf798v00rYfE YrmpHnkZAHz7tMmaC1FvM7MBDYdKZyvKcLpFPaowSVg6RzRkvgwJZ2+Z0P2dNWatcYFt eSXt6h3GAcaeF9u5ja5cncen5WZvrAogtf/icQYgb7D5I6K7o77GehYYlnQJY3BwvJwF CkwPlZmOjDGtxHPcGkKbXIqfLLqF/c+Ry4xEJPmGU311UmLC+obYNwEq3Xgi7TtZq4+n Kfvw== 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=6lrdVuf2bMn02/XrYkdZnAojTsvLmTg0lU2639BMch8=; b=74Rw8i0olVX6wxJMOezjpHlcWbe209Kb++TQ80qt6PdR+3tS+x0IszcWAFegZsI2gc 0gMPgKqX5U7FLaMKFwZl7OH8Nvc+t8oePc680DWcOeeP91Nci69Apa3Dmm266vfkpLIS 1FZgWnI6wYCHhff9ejVB4gDWDe7PnXObGvngQ/5NGA4ANYGWwr6L8V0YyoDwWTh1kC0j BEAbkivWhJ4iP7J9/UYS2moYxKMmbBHXnDzI5UNWoiWUkMkZN3hcchG3AHoc9nGPNCsy mBHRIEhs3E2SKZtftUsAz113JXFJxni3Pqd+ZiAfZXkxS0OIF1AiU2GvbVf5wuE/5kmy /nMA== X-Gm-Message-State: AOAM53355dJs1R8VnJFwo3ZKyN1j7O/1h+nU3sVffnq/hc/9o1hIXVuF 6YGQVWPLcH9LlTV6DddjrBzy9Q== X-Google-Smtp-Source: ABdhPJyw8IscoYMNb6Po+Rwa0gOV3rB6xxFY1O/uBhbsecJQhHIlCSzYHCMHMAvCOyNFFeuI380yHg== X-Received: by 2002:a63:338b:: with SMTP id z133mr7876547pgz.318.1633064576583; Thu, 30 Sep 2021 22:02:56 -0700 (PDT) Received: from localhost.localdomain (122-100-26-52m5.mineo.jp. [122.100.26.52]) by smtp.gmail.com with ESMTPSA id z8sm4615113pgc.53.2021.09.30.22.02.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:02:56 -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: [RFC 02/22] scsi: call device_probe() after scanning Date: Fri, 1 Oct 2021 14:01:47 +0900 Message-Id: <20211001050228.55183-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211001050228.55183-1-takahiro.akashi@linaro.org> References: <20211001050228.55183-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Every time a scsi bus/port is scanned and a new block device is detected, we want to call device_probe() as it will give us a chance to run additional post-processings for some purposes. In particular, support for creating partitions on a device will be added. Signed-off-by: AKASHI Takahiro --- drivers/scsi/scsi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index d93d24192853..4865b5a86fd5 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -595,6 +595,16 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose) ata_swap_buf_le16((u16 *)&bdesc->revision, sizeof(bd.revision) / 2); } + ret = device_probe(bdev); + if (ret < 0) { + debug("Can't probe\n"); + /* TODO: undo create */ + + ret = device_unbind(bdev); + + return ret; + } + if (verbose) { printf(" Device %d: ", bdesc->devnum); dev_print(bdesc); -- 2.33.0