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 16CB1C433F5 for ; Tue, 5 Oct 2021 01:07:12 +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 E222460F48 for ; Tue, 5 Oct 2021 01:07:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E222460F48 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 E9F42807CD; Tue, 5 Oct 2021 03:07:07 +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="VUBvTMIM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 800758081B; Tue, 5 Oct 2021 03:07:03 +0200 (CEST) Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) (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 EAED1805F9 for ; Tue, 5 Oct 2021 03:06: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-pj1-x1032.google.com with SMTP id na16-20020a17090b4c1000b0019f5bb661f9so1154789pjb.0 for ; Mon, 04 Oct 2021 18:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=wa+XLw0Ngq9YXikcO0khwyb9orQNnV7FpqIgJx7KQy0=; b=VUBvTMIMcs9YsWlXeh4pz2+zHpFjOvU20hx2gKviwNGi4Di3nl0veM3RHb2O7co1rG ViesT3NJDtGtpejiO2xCfIMtb+KZmRnMsMtTC/XgRcZkdGTFagY9TI3xQiu58E1SuPQn /9NjSzJHVUxW/GABWhsm5eeCJYEV6JHPYvlgH4ItYwSMbP9sN1WyYnm3yznyhZGKDqRk a7htx6GGKNy23bn13ZZp0/2zzQI5ReuV2Uj4C+ZzIHcILmgdYA2sY1iUop2ynzigjHhL 1tZ8UipC18a0NsHLFrkQrtgoN2u4YkmZ2J6HcBCsavmBXh1Uhm8X17BQRvJH0LTgpH7H 7xlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=wa+XLw0Ngq9YXikcO0khwyb9orQNnV7FpqIgJx7KQy0=; b=c++FVriA9J/W+70r0EGpm4y1M1xwZ4LoP+ru0JO/cQhQQpgtWXYDUOKTN3I82fwBz0 f79KBmTJNBiCsYhgEsceEP1HPTAgKXinETAoksCbOU18EujBicbypzpmYMZEl510FKGl NU+M84Nf8CDqfzGr4Es3FZP/wGoVamzl63Bmg4nsy+GonPb3maKxsZm2clEVkBWAoIvN /7UgerS1cD501mYfi9kzXJ/G1vDKKI4MKuhMnd5G9DXtLcdK1iRtHjQ7Yun27ClJ3l4/ 3TI8JEC8SnWwgRzNccMROEc7SkPhDgaNwib/N1tJ9n4mlqhIc1xxkPsFEBfH0DJc8qY4 OW0w== X-Gm-Message-State: AOAM5314QNbmEc0vsFz2UTVt3R3CDrKbqtv8o+WYJ+hWGopgGRCNJqX3 V934VjljLwST2kKtHvjb7G5F2g== X-Google-Smtp-Source: ABdhPJxDShlT54RTQ3It2BxBHS+8IYXUh0L06vgxstuuqkEscPVrVDjwbJDZFsRQha4mj5YXwPzpmA== X-Received: by 2002:a17:90b:4d8e:: with SMTP id oj14mr335410pjb.160.1633396016979; Mon, 04 Oct 2021 18:06:56 -0700 (PDT) Received: from laputa (122-100-26-39m5.mineo.jp. [122.100.26.39]) by smtp.gmail.com with ESMTPSA id b13sm73709pjl.15.2021.10.04.18.06.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 18:06:56 -0700 (PDT) Date: Tue, 5 Oct 2021 10:06:50 +0900 From: AKASHI Takahiro To: Ilias Apalodimas Cc: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, u-boot@lists.denx.de Subject: Re: [resent RFC 06/22] sata: call device_probe() after scanning Message-ID: <20211005010650.GA39521@laputa> Mail-Followup-To: AKASHI Takahiro , Ilias Apalodimas , xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, u-boot@lists.denx.de References: <20211004034430.41355-1-takahiro.akashi@linaro.org> <20211004034430.41355-7-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Mon, Oct 04, 2021 at 09:45:35PM +0300, Ilias Apalodimas wrote: > On Mon, Oct 04, 2021 at 12:44:14PM +0900, AKASHI Takahiro wrote: > > Every time a sata bus/port is scanned and a new 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/ata/dwc_ahsata.c | 10 ++++++++++ > > drivers/ata/fsl_sata.c | 11 +++++++++++ > > drivers/ata/sata_mv.c | 9 +++++++++ > > drivers/ata/sata_sil.c | 12 ++++++++++++ > > 4 files changed, 42 insertions(+) > > > > diff --git a/drivers/ata/dwc_ahsata.c b/drivers/ata/dwc_ahsata.c > > index 6d42548087b3..6a51c70d1170 100644 > > --- a/drivers/ata/dwc_ahsata.c > > +++ b/drivers/ata/dwc_ahsata.c > > @@ -1026,6 +1026,16 @@ int dwc_ahsata_scan(struct udevice *dev) > > return ret; > > } > > > > + ret = device_probe(bdev); > > + if (ret < 0) { > > + debug("Can't probe\n"); > > + /* TODO: undo create */ > > + > > + device_unbind(bdev); > > + > > + return ret; > > + } > > + > > Patches 2-6 seem to do the same thing for different subsystems. I think > creating a function for that would make it easier. Well, the reason why I put those changes in separate commits is - first, different subsystems are owned by different maintainers, and - more importantly, different subsystems may have different cleanup processing required. There are always extra setups after blk_create_device(), which should be reverted if device_probe() fails. For instance, sil_unbind_device() and fsl_unbind_device(). So I would like to leave subsystem owners responsible for that. -Takahiro Akashi > > return 0; > > } > > > > diff --git a/drivers/ata/fsl_sata.c b/drivers/ata/fsl_sata.c > > index e44db0a37458..346e9298b4c5 100644 > > --- a/drivers/ata/fsl_sata.c > > +++ b/drivers/ata/fsl_sata.c > > @@ -982,6 +982,17 @@ static int fsl_ata_probe(struct udevice *dev) > > failed_number++; > > continue; > > } > > + > > + ret = device_probe(bdev); > > + if (ret < 0) { > > + debug("Can't probe\n"); > > + ret = fsl_unbind_device(blk); > > Apart from this exception I guess > > > + if (ret) > > + return ret; > > + > > + failed_number++; > > + continue; > > + } > > } > > > > if (failed_number == nr_ports) > > diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c > > index 003222d47be6..09b735779ebf 100644 > > --- a/drivers/ata/sata_mv.c > > +++ b/drivers/ata/sata_mv.c > > @@ -1099,6 +1099,15 @@ static int sata_mv_probe(struct udevice *dev) > > continue; > > } > > > > + ret = device_probe(bdev); > > + if (ret < 0) { > > + debug("Can't probe\n"); > > + /* TODO: undo create */ > > + > > + device_unbind(bdev); > > + continue; > > + } > > + > > /* If we got here, the current SATA port was probed > > * successfully, so set the probe status to successful. > > */ > > diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c > > index dda712f42cb2..295f7ca72303 100644 > > --- a/drivers/ata/sata_sil.c > > +++ b/drivers/ata/sata_sil.c > > @@ -864,6 +864,18 @@ static int sil_pci_probe(struct udevice *dev) > > failed_number++; > > continue; > > } > > + > > + ret = device_probe(bdev); > > + if (ret < 0) { > > + debug("Can't probe\n"); > > + ret = sil_unbind_device(blk); > > + device_unbind(bdev); > > + if (ret) > > + return ret; > > + > > + failed_number++; > > + continue; > > + } > > } > > > > if (failed_number == sata_info.maxport) > > -- > > 2.33.0 > >