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 8FC78C433EF for ; Mon, 11 Oct 2021 01:43:45 +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 779F360F3A for ; Mon, 11 Oct 2021 01:43:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 779F360F3A 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 4C4388361E; Mon, 11 Oct 2021 03:43:42 +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="q8kQyrNx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6E46083578; Mon, 11 Oct 2021 03:43:39 +0200 (CEST) Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) (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 2211683270 for ; Mon, 11 Oct 2021 03:43:35 +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-x62d.google.com with SMTP id x8so10168412plv.8 for ; Sun, 10 Oct 2021 18:43:35 -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=aw2enomc7yWt2keo2nmnb02T0Hw75TBIqoOFCbMpIc0=; b=q8kQyrNxUKEFhTU7pUtP61AM4Mq1vJ5zFwVu0u63oU8bCTiibF0snCniypbpDeBG51 RE8bfv5SUEj2QFtoRkWHjMmySLJIw73LiutinLdu2mCc5EpR39oS5SZjZim1Bkw74WFf NrFcryF9zzMvJSMGAJIiARlt9B2X7YTCr2XR4aL0XBDmRjGFiGZ74VZfRGpjjGgT0UzR Tw6H+EOyWnXLInzOjdXkOCY6iUgmEvqalXzIT1PX1hMyWwnlGqTPayuVaFA8hVsgmVHc 3AWE5d2moAHAhejYtz3jB006a35uCCLUCmmTP5ML7UfrYqoIKx86iKlgzlRDZStHwRlC P8ig== 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=aw2enomc7yWt2keo2nmnb02T0Hw75TBIqoOFCbMpIc0=; b=wSPlKfWmzhosOODKk/9xbr2H/x2FJgG7hFxmY3+2ba4cY5hmd+RvDIOP3BBQ1rbmYy Ao/qF1p1zAsRRFlqKqkpYV5qbLDuZI7nozqDNeyow32OidLsF/yWrvYHvVYcfpGLycxp quaT7V0gkdp/8OuxbGHmJyTotPGGUa2hjC+nOaYTmZWOdl/pbdFLfOORXCgO731l3yj8 vKy37cmKFyPz6Hk/3DE13dWfebHqLprcWpxqz/AATnWGPp54xAXQFp+n3YA3HtZ9d3th B0LWfT63Srug9HXVRIJWjFjkQxRdfUkgv6bpP8cUJD1FVMCRUq7TLD7EowPpDBJ45Jd7 Dggg== X-Gm-Message-State: AOAM530atA7KAb5uNbRuHaod0TTDtInWZouMY6eqiIeHzo69yGYu9lE+ ookt45Zm48FmQpgMaS+41OP79A== X-Google-Smtp-Source: ABdhPJzEEgp/+gOcNhkTPxDbgqmDsQi6o7Td56dwNJA14yiG5qhjg/8HwIv0d+imcWA7GAWTbqtqNw== X-Received: by 2002:a17:902:760b:b0:13b:122:5ff0 with SMTP id k11-20020a170902760b00b0013b01225ff0mr21983679pll.22.1633916613214; Sun, 10 Oct 2021 18:43:33 -0700 (PDT) Received: from laputa (122-100-26-39m5.mineo.jp. [122.100.26.39]) by smtp.gmail.com with ESMTPSA id d19sm5620963pfn.102.2021.10.10.18.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Oct 2021 18:43:32 -0700 (PDT) Date: Mon, 11 Oct 2021 10:43:27 +0900 From: AKASHI Takahiro To: Simon Glass Cc: Heinrich Schuchardt , Alex Graf , Ilias Apalodimas , U-Boot Mailing List Subject: Re: [RFC 07/22] block: ide: call device_probe() after scanning Message-ID: <20211011014327.GD44356@laputa> Mail-Followup-To: AKASHI Takahiro , Simon Glass , Heinrich Schuchardt , Alex Graf , Ilias Apalodimas , U-Boot Mailing List References: <20211001050228.55183-1-takahiro.akashi@linaro.org> <20211001050228.55183-14-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 Sun, Oct 10, 2021 at 08:14:13AM -0600, Simon Glass wrote: > On Thu, 30 Sept 2021 at 23:03, AKASHI Takahiro > wrote: > > > > Every time an ide 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/block/ide.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > Reviewed-by: Simon Glass > > I'm starting to wonder if you can create a function that does the > probe and unbind? Something in the blk interface, perhaps? It would > reduce the duplicated code and provide a standard way of bringing up a > new device. That is exactly what Ilias suggested but I'm a bit declined to do :) Common 'scanning' code looks like: blk_create_devicef(... , &dev); desc = dev_get_uclass_data(dev); initialize some members in desc as well as device-specific info --- (A) (now dev can be accessible.) ret = device_probe(dev); if (ret) { de-initialize *dev* --- (B) device_unbind() } Basically (B) is supposed to undo (A) which may or may not exist, depending on types of block devices. So I'm not 100% sure that a combination of device_probe() and device_unbind() will fit to all the device types. (The only cases that I have noticed are fsl_sata.c and sata_sil.c. Both have their own xxx_unbind_device(), but they simply call device_remove() and device_unbind(), though. So no worry?) -Takahiro Akashi > Perhaps blk_device_complete() ? > > Regards, > Simon