From patchwork Fri Oct 1 05:01:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 514980 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp450803jaf; Thu, 30 Sep 2021 22:03:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDg2lWmTQ7UwB3x0vcXkTB05DUZJVmo9u4zhI97NkHK5g3VjU/Fi1+Iw5IW7Fq0YAYpgWH X-Received: by 2002:a05:6402:2689:: with SMTP id w9mr3204172edd.188.1633064604261; Thu, 30 Sep 2021 22:03:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633064604; cv=none; d=google.com; s=arc-20160816; b=W6NDKj8g/iTc0INJ+BwnSIgs5ae/JUcdRsG27fv9n2VPYJME3EzsA5BmqSJodU346E AsGZfboMwDeONTGrryoJISqKPGkG170Gng24+g9b0Ycix5PQ0I1Uf6TXnnE+EnLw1gDI lpHoXeGT3LtxLRiQ8kmYpNxnFCaae0tRDGY2AoNlqxTrx+QKL6jLd5seBWm4NVR4/XOn y6/EVFw6klt9jUAWTuU2gxq3RtRs9y19Z4znkLxDHflofynNKm6XHAa1tc2BhrgLlxiJ VQNm6h3yVkM3tRpZHw6KoZ18n2BUjUku7V6+jIRRqf314v+PzflbdqkOuFdirv8BPmXd woIw== 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=m3aapTepVXiihbxIg6MFj8vuCjL1teYhZ5hXTnrODTkQSBfgfJ26RLcRaIsrdZ8xt9 5erescWEspIg2TSDZQYs1AIxTb056XhCjmhuNd0W/vbivkBcwUsImjVhgX1rQdiFT6gm EQTEwMz+OHoSEp28wbodAPlUJn0kgkM120cxvol/8JD8KHVoVb6UUsqjnyv1BaJp81A9 EGu79jBqim6ru3QlL3usI6C4P053Xh2/351sG00PVALQ0+4WGk4YR+Ps8iDwGYtle5yB U670OU1uhy1w964qpn4kwUC1qaVq4IsgY4UfaZ3+rW1lEon4qZbf9XdENkNVaB1Lnb2W HnsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wqogq96O; 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 jy1si5879556ejc.140.2021.09.30.22.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:03:24 -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=Wqogq96O; 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 5CD52820E3; Fri, 1 Oct 2021 07:03:14 +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="Wqogq96O"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E247581EE5; Fri, 1 Oct 2021 07:03:07 +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-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (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 C47328169E for ; Fri, 1 Oct 2021 07:02:55 +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-pj1-x1031.google.com with SMTP id il14-20020a17090b164e00b0019c7a7c362dso3100146pjb.0 for ; Thu, 30 Sep 2021 22:02:55 -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=Wqogq96O7wtLWHtkMzG+8YNkH3DNcbaTXnGt0yX+Gz6m2DWNRhBS+aBRZhwI/cRgiy ISEL3YdCbhIs6ga+04ej9VngTTprxfTT1VUtRj4PrDAEGEDguHvj5YTxr7p78USdXceY 6PNMXhVOy9sF4PfENasahivrMjsaMFYepgzp4hYHHpIOtL3QoYIuMBKdiVgHHjAho63c 88Sg7WuE7pLgUwB3UVCmDuiindgrG/WTLbndz3wlIpCB+GByoEDHH322Snr1T22qzoMk QzUBXJhHzhUzMGA4HdVY3iW6rhIaWj9CcSJXInZZ40Tp/hyvsRGQP9ELGtWPbz6bA0bE 5BEg== 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=jjWs4S8rTTpb2TuN6+K29TY3yk2eVgw260XqWX9+8bzsY5/1DXJ+Y/zigbOyOjilZN FVqw8gvPs+WtfAs9FhEiHPWXd8u/hGjY/Jx+o21+4McAWu3HS4wieUGVq2szlPQeBKZi VaPsVoilXSIRKOotkVry0BPTjdTmRnjcji+6s+E1Y9gg0Yn+G/c3+qcRBRFU40ps7f2D TnQ2L859Q2fsAj0EFz0pQjzIVgBUqotuaL9OJ/wjHp2VIsXGctLG6uZkvJoLYrwfgvvh ShtXvi3CPXNN11VSeVlcKJmMPC6feRcN+VEF5SgyI8sWyUcpVhjNSD9YJa6eraLJ0X18 PNrA== X-Gm-Message-State: AOAM530HjSx4VuI/V7m22+JNlv2mjpkBye0ofv+soejH41MIKZdjCJPq mBJPH9VitN7YTHUYAY53khBgkw== X-Received: by 2002:a17:90b:388c:: with SMTP id mu12mr11045186pjb.160.1633064573722; Thu, 30 Sep 2021 22:02:53 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:02:53 -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 01/22] scsi: call device_probe() after scanning Date: Fri, 1 Oct 2021 14:01:46 +0900 Message-Id: <20211001050228.55183-3-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 Reviewed-by: Simon Glass 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);