From patchwork Mon Oct 4 03:44:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515130 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1061794imy; Sun, 3 Oct 2021 20:45:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3q1GH3GrpWIlFJJkV9xWqZP3NL/jnuEBJ1ANyAJpGcyuSc9uuN4UQYteIdnGJiDYj/EIs X-Received: by 2002:a05:6402:40cf:: with SMTP id z15mr15666316edb.169.1633319122377; Sun, 03 Oct 2021 20:45:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319122; cv=none; d=google.com; s=arc-20160816; b=pEgmB878S+MMAvuEe+CCX0HAOzBUs6fGcRgUuPph3IB4sakRhj/N5xO9scVNGH2cT9 oQZ2QPwj0fBNySje8cABuhJS96UHS1WNoSVwStMrNb9hSqCrQBQsJ4GmHWnvCR/mBRDb cPjyF9LDCiuJNC02si2Zk24FD8AeEFmGAvP/nbbolKYvS1IL0tEaCl6q084fZMlrDTGJ VkbyzVaruU55zxiTUdotaPi+bSBpDjWRXJJ+qVxNbLGuu9mVnAtK5TVPwNgeaLN10I0J 7NixHj4Y0fnxKRChvHzbBE2izgkidrVVMbwRNb4xTf3PbslCrLErtWKtmBSPW5JPK5NB 9W3g== 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=M+U36texJbu6hHfrYjgegiGGWjIZoEcVkpsJT27bxuRbS+jL74diSV6XGghlh5RsLM VC18f5x36URtr5EmcDvJ9l8plSmejMlBwXXATXuHm/Qm/d6QT8JhEEnsm347R42iyn3v JjqHkqu7VEb2pOVaYtiWAGe6Xl5bwP9N9+XkGZjciAPR0AwXexl56+6LyIDSA5BQ0Tae +TaM1oltWEqkyZ/ilfiYNudU1c6iAEyJwaBU0e0nBT0m8YAFt70N5rtSQiqgCjuzT2jO isE7eQrYWxm7YID5B/2VWhhI3KjGQweMfP0Hf9dBVNlusmp2k6EkhNKZA23SoJKck5lv AiUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MD1Ovu6C; 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 g2si3295481edz.500.2021.10.03.20.45.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:22 -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=MD1Ovu6C; 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 7383E83550; Mon, 4 Oct 2021 05:45:18 +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="MD1Ovu6C"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 488F883532; Mon, 4 Oct 2021 05:45:15 +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 6E46E8352B for ; Mon, 4 Oct 2021 05:45:11 +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 w14so858100pll.2 for ; Sun, 03 Oct 2021 20:45:11 -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=MD1Ovu6CmQP6B72WGh9ws7fOReBBUvqaSS5N4RQ4tkXf22/uZwW65w+5iglUZqwJYE VZhKdIUGNuSdVEShu/ZeHyOdfKKJWvoM8lV7ssxNC1i0nu9eYmdeW29ShuCjVi9TJBnV qf935cAKC3VVSZ6zy2viz7FS3SiV/0TDDvwG7EFgv6Hej/5Z1lAVTq2FhES6rdj8eSJK t75cfqwPkM5mIwTdx6xtY2+Ay4AFC6ECtdjDBLOH5QwiRFOnvwcffnQXrD3U9IkMnDUy qUjZFf14zd/GP3dRkD0dkzMHOifIh4fsURllhdv9XDNf0lI4XBDa7441iYa+kv4GCF6m 6/Vw== 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=DHPXpld0jYyBHrhHXvMA2/HsyUc2DbphcYZpfIqLhK9XsRpCOrk+7LIWzaaJzGH/fk K+hRn2waOO4k/h25Ta41qSptwkvFGaGGnD+N3Q21VxgCEaRXG7FKtCSpkKxr3m/Lao5u vHccbTfkpFujE0BCbclaIhM+r5szpGLuUrQDhFU1N26xyeXYRGVMKEEmQzsQzFk2kv4r ohoqIPfDgSklXooLEytLCEX/bCzgMkufAnzIjBRUJJXzJBctPbrthGDxW2Akfvkmq6GK hzeKiY16s80v74qG346ycrDTk8Ww6yYglJ7Fz2seFhWxqNq1VbnRK0dtI5G2NNZ7XxMl 0J7Q== X-Gm-Message-State: AOAM533XpG5og6Jplk8kgIolZfqdMiE2MvLBpyOMQedhd97sl1k4QRYp X5qr+xxmKGcc19VBZvuUF2/KdQ== X-Received: by 2002:a17:90b:1649:: with SMTP id il9mr34807018pjb.206.1633319109799; Sun, 03 Oct 2021 20:45:09 -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.45.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:45:09 -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 02/22] scsi: call device_probe() after scanning Date: Mon, 4 Oct 2021 12:44:10 +0900 Message-Id: <20211004034430.41355-3-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 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);