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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id ED31BC433F5 for ; Tue, 14 Dec 2021 07:01:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 092BE82849; Tue, 14 Dec 2021 08:01:21 +0100 (CET) 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="JWIYjwQZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7D19582849; Tue, 14 Dec 2021 08:01:19 +0100 (CET) Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (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 79ED6812BB for ; Tue, 14 Dec 2021 08:01:09 +0100 (CET) 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-x42f.google.com with SMTP id n26so17080552pff.3 for ; Mon, 13 Dec 2021 23:01:09 -0800 (PST) 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=FRIN230F8ZruaqF2XsUTPEUQ+7+rYwJR4W9mOlH52fQ=; b=JWIYjwQZVFJDR3R4SLlSgCmTzLWAGFSA57IX4rKuWfSJlgaaUK2Jltz53SqXpQyXKJ TEisol1WKQCNqyj8eGGpY6IUE+r/syIuzykiq7xYwmvdLyTPjpghkC8+UIaRRU2hRYjM W7nm+LB/dmr9fM3ksvxFv+MEZsee5wlYwwB2DOo7RK66l9DMPUIUMt97zC0SmmUgwZ4y fFuLAZPnByi+385srlZ90myMJsnnuf770Lwi2Mar0pbe0w5WonHPW+VcsnslaO/8uHPZ GnVo5FJgFgAboLwHMraPheB+9k+Nge2eFLw/JMhvw2dYbeH5RG+cwmppJvH+wKzj1bQg 0zhA== 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=FRIN230F8ZruaqF2XsUTPEUQ+7+rYwJR4W9mOlH52fQ=; b=zvqlU59YNC34Qarqq8tNt2yPmgd+0rDs7BJo7oR69Vs/WdXDRIq/gIjLwapWcqVTff daa/1N4yFu3p5qAtLjzOu+Qu0zflNhbwHtFSdtMUWMDvogomS3zmk7fKrMok1WUGsrxL WeYcnH4Mcje/HE67Crt1nNSEHZ9+T7AwHca7ofdJO/FiGU1S4AoAMtUqFJqc25L2pSZn OoU+GwekYfuiIG+i5Es/LlrQWTpIQU2vO8GuNBLFoaxwSE2D5sNZqVCMOf5czWUs8DqN wT7yFX+3pE8RdR7nUGQWh4spzDSRImUA7vqb9pIW83wcvgZtsQO8sNKzydr14QzD8g9l kiVg== X-Gm-Message-State: AOAM533ptfGvtPMQ7NPcoNgnHEhpa9WgAgDQTyHAlFDF6s7fAgM/6rxV +wny8336KFZj3rT/wa9AB147JQ== X-Google-Smtp-Source: ABdhPJw3b2h5oGATlMH364OZATnQuCIOzuXlzssRphUunaoTf/sPUeUK3JVilJge0fm0UWUyqO2j3w== X-Received: by 2002:a63:83c1:: with SMTP id h184mr2569488pge.361.1639465267566; Mon, 13 Dec 2021 23:01:07 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:8d4a:ac59:26ea:d2bb]) by smtp.gmail.com with ESMTPSA id j7sm15104077pfu.164.2021.12.13.23.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 23:01:06 -0800 (PST) Date: Tue, 14 Dec 2021 16:01:03 +0900 From: AKASHI Takahiro To: Simon Glass Cc: xypron.glpk@gmx.de, agraf@csgraf.de, ilias.apalodimas@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de Subject: Re: [RFC v2 02/20] blk: add a helper function, blk_probe_or_unbind() Message-ID: <20211214070103.GA49357@laputa> Mail-Followup-To: AKASHI Takahiro , Simon Glass , xypron.glpk@gmx.de, agraf@csgraf.de, ilias.apalodimas@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de References: <20211210064947.73361-1-takahiro.akashi@linaro.org> <20211210064947.73361-3-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.38 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 Hi Simon, Thank you for your review on this series. On Mon, Dec 13, 2021 at 05:51:40AM -0700, Simon Glass wrote: > Hi Takahiro, > > On Thu, 9 Dec 2021 at 23:59, AKASHI Takahiro wrote: > > > > This function will be commonly used in block device drivers > > in the succeeding patches. > > > > Signed-off-by: AKASHI Takahiro > > --- > > drivers/block/blk-uclass.c | 13 +++++++++++++ > > include/blk.h | 12 ++++++++++++ > > 2 files changed, 25 insertions(+) > > Reviewed-by: Simon Glass > > But please add a test for this. Well, how can we test this simple function? I can't simply imagine what the meaningful test scenario is. > > > > diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c > > index 83682dcc181a..f7ad90e8890f 100644 > > --- a/drivers/block/blk-uclass.c > > +++ b/drivers/block/blk-uclass.c > > @@ -670,6 +670,19 @@ int blk_create_devicef(struct udevice *parent, const char *drv_name, > > return 0; > > } > > > > +int blk_probe_or_unbind(struct udevice *dev) > > +{ > > + int ret; > > + > > + ret = device_probe(dev); > > + if (ret) { > > + debug("probing %s failed\n", dev->name); > > + device_unbind(dev); > > + } > > + > > + return ret; > > +} > > + > > int blk_unbind_all(int if_type) > > { > > struct uclass *uc; > > diff --git a/include/blk.h b/include/blk.h > > index f0cc7ca1a28c..ef79e7b27b0a 100644 > > --- a/include/blk.h > > +++ b/include/blk.h > > @@ -369,6 +369,18 @@ int blk_create_devicef(struct udevice *parent, const char *drv_name, > > const char *name, int if_type, int devnum, int blksz, > > lbaint_t lba, struct udevice **devp); > > > > +/** > > + * blk_probe_or_unbind() - Try to probe > > + * > > + * Try to probe the device, primarily for enumelating partitions. > > enumerating Ah, OK. -Takahiro Akashi > > > > + * If it fails, the device itself is unbound since it means that it won't > > + * work any more. > > + * > > + * @dev: The device to probe > > + * @return 0 if OK, -ve on error > > + */ > > +int blk_probe_or_unbind(struct udevice *dev); > > + > > /** > > * blk_unbind_all() - Unbind all device of the given interface type > > * > > -- > > 2.33.0 > >