From patchwork Fri Oct 1 05:01:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 514979 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp450700jaf; Thu, 30 Sep 2021 22:03:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdQ6ItwIBWWhK4eVE3YBUhXsrh+JICjLUalI/v4m68sOmuSQlVMBSLjGKnbqR2ajiGPmsR X-Received: by 2002:a17:906:6943:: with SMTP id c3mr3935850ejs.550.1633064593274; Thu, 30 Sep 2021 22:03:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633064593; cv=none; d=google.com; s=arc-20160816; b=DLyIQJsi/7us3S0Aqg0gUmlRgGM1wyUU/72q4kh69NaAJUMr/KujIoIQsE6JZ7cOiV 0BOGL91QDbakpSEZfEEv0YRN6FtpnjMf3bEM1IDIvqiMHlrPt8xzuMOHR+H75A/nXVmO JdBaIn1VTEWcUL+C91QOtpAX7590+d249fJuB4MPDWX3iajFiIc8H3x3lGBfrnrm/Kx9 5Bg9a5Sq6/TX3dCCmlP1GRiEgeVJxl0iflLBxtKL4AE3ohZUZptdSWOVq5lSDbr0UZVN TzDRCwPSfKKoNHLge7oIgPD8s7s5xIJDpQCuySEnYG+1R/3ZutpHKIhANwT8agSRczp+ KUNw== 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=6lrdVuf2bMn02/XrYkdZnAojTsvLmTg0lU2639BMch8=; b=FEq7ilmwHQWODUWAGWpd97qYF4WaBoAjwpFQbhDlPwYQx7536rsJxXC9N7BdwK5QTX NekFJY07U0metTmJZI7EWW1kKGvnIySAfO1G25y941fCCPUj/uwwrEEBxzIUtKLklffN Y0+3r2su70C91imimEYEzBIC7HzpkE961FPCkJE2ZJa8cd/mFEOpK7Ef8cN1sevu1IS3 uzQQicSZAgdJhYb8qLUN+PIyOCnHBDjqUAuktPWjk7ObV5S1L7Iyviu40odV2BQJ8JAy L2v97oeaT+s6Ddz7uc6U5y0/P9GsYX0LwF95dWoGz0YLPh1hS8Dk6pQ/m8d39C2HDnsX +dvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zxTCOoqb; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id t2si6008628edt.298.2021.09.30.22.03.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:03:13 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zxTCOoqb; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 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) 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-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-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 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(+) -- 2.33.0 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);