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 60D5AC433F5 for ; Fri, 8 Oct 2021 05:45: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 A2EB7610CE for ; Fri, 8 Oct 2021 05:45:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A2EB7610CE 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 19F7F83390; Fri, 8 Oct 2021 07:45:10 +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="TPdxMGUD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6C0C1833AE; Fri, 8 Oct 2021 07:45:09 +0200 (CEST) Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) (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 DA1EF8337C for ; Fri, 8 Oct 2021 07:45:05 +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=ilias.apalodimas@linaro.org Received: by mail-yb1-xb36.google.com with SMTP id s4so18550586ybs.8 for ; Thu, 07 Oct 2021 22:45:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=K+nmHF1B7PChjuMPYeeWaZBC2m1lI4msOxwfaGbmTJo=; b=TPdxMGUD/c5TH8LQ/w4Ted2HdjQha3LLaB/eXjEdEMFtedrk8J2FmlAw0N3HbwFHbI gml6heUgXajlnNxthrh6a3QywkBRJq2Ki0t+NXhDB6pcVqxqznS5sh7DwevcYo6C5eGI aKsAQlri48oMswQJ/P5NQpgdGKKMOSc8/p48uU2Hf0LITGsMoMAUYmFvdOK2oE3aHixe J9s4WxYWpw+tfYANUmrlMlx8TSdCY0Ddd0g9at+R0bzTGnQbbVwyLYsgLBkJiiH1PRID vOJyFIYCgrzTpRM1zMqVJokUcY4jTMVPWcRzsqlrhvfiR2aV1QpNtwRwYJH/3bemfA3M +iUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=K+nmHF1B7PChjuMPYeeWaZBC2m1lI4msOxwfaGbmTJo=; b=XrwiXsQcnlm/PepAdzRS1LGkAZ1B7288KelUnr3LyjimSSvtKHI74tLYZDdfU+linu pZBJ8r+fmcbJk0PpusGnhKf3Fd+IyTXNHqlCqW2P1+qGBfBuLSwNxobiYLF+0Lg+aex7 GDioSh5OQKQkIcQMgM1JBWwf4SpSh6+y1/XtcYAcx16XI2aql5vnDZMnX0K2l1vZlkJc UpmrZzH5o8mM1m9DcARrgXcnKShSw4ZbowJfEjXDrUybgS1SilPjdxqNoaey4hPHm0pd Rwa4hK/kpmnaooZkKnKnp/ioTHL2Fhzg5GPKnAUIBnuM6q1vvN0pgXhTK0sF2c8zekja /toQ== X-Gm-Message-State: AOAM531YFcKCylTBCG0ShuaWt+BiLsmkdO1JP2a8xddhKZzTCwPHb9vD gdiPP2GFTdx8gPsUhZ6rhg7EQ7AtqKSvQYaWCe8//A== X-Google-Smtp-Source: ABdhPJziWjy4Bt26jOH4F1Z+4fPUOiOS2QTcHwLeY1jwCaF3/ODQcWLk4e5MmMbXEOKG+p1BRlALKBBUp7k9CpR6s5E= X-Received: by 2002:a25:5e86:: with SMTP id s128mr1251674ybb.79.1633671904383; Thu, 07 Oct 2021 22:45:04 -0700 (PDT) MIME-Version: 1.0 References: <20211004034430.41355-1-takahiro.akashi@linaro.org> <20211004034430.41355-7-takahiro.akashi@linaro.org> <20211005010650.GA39521@laputa> In-Reply-To: <20211005010650.GA39521@laputa> From: Ilias Apalodimas Date: Fri, 8 Oct 2021 08:44:28 +0300 Message-ID: Subject: Re: [resent RFC 06/22] sata: call device_probe() after scanning To: AKASHI Takahiro , Ilias Apalodimas , Heinrich Schuchardt , Alexander Graf , Simon Glass , U-Boot Mailing List Content-Type: text/plain; charset="UTF-8" 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 [...] > > > + 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. That also stands if you create a common function doesn't it? Create a function that fits most, add the calls in separate patches so subsystems maintainers can have a look. If one of the implementation special, it can ignore the wrapper and go do it's own thing. > 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. Regards /Ilias > > -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 > > >