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 03051C433EF for ; Wed, 13 Oct 2021 00:36: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 3E66260C4D for ; Wed, 13 Oct 2021 00:36:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3E66260C4D 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 76F838355D; Wed, 13 Oct 2021 02:36:09 +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="as9Lr+gq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 102C883556; Wed, 13 Oct 2021 02:36:03 +0200 (CEST) Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) (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 7A1338354C for ; Wed, 13 Oct 2021 02:35:53 +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-pg1-x530.google.com with SMTP id r201so654842pgr.4 for ; Tue, 12 Oct 2021 17:35:53 -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=v8vrC8cePMXfo20Mmrxoz42M6s3CGVp6cT/OJvnRKsA=; b=as9Lr+gqSAnq5rJ+Ak7msa1TK0iLw1Eeph9qQwZsDo6DAvhUwNx3+nHhO9QkpsvzrH gJrUyA05DC5G88/ez3nXsGzd80+DA+C2dVJ081uHdm+7rHqgVl4DzMTbaFt7zWmvDL8/ +W5bu0MbGyXXLL0vAREYvTtuwQu5w1bdqBUL6/qEz5AF+HV5sXnUVDsjp7Aex8eH6Pzk 7cQww8IEUsjt20nK9kClNfrY2GtOtY2d6aRPEdULYAPYFAgsmGtVNs05o8bAeds7jHPW QKaY++opJzfpImQjGWFGQ1RYWCTP9sQTZhQRMlnMtPH2RVyDkrnY6+XapSSfkLrTJZCQ vYrQ== 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=v8vrC8cePMXfo20Mmrxoz42M6s3CGVp6cT/OJvnRKsA=; b=1Vfp1dlCm+VS+yUs6F0nTS1tAQ8f2aiM5HVUdsVcylqlKvevtkS1DLzAAj/NFo+9l5 +GqkGtiaUg7M9rsKmPSFHAttdxoSbHNOEobj9MNbr0I3emS0OVpgIVxig1tVq3DekRPh nU7+KldYht2lgF0VmCYe6PGg8vnTKeh8SxtfCJq9DoK1hug1lpEpLDbHTzBFF3V/scbZ N0q1UL+3Fs4W0Y2eHANzbh9kWcX6iePruhQpac/OSsHmSs/HxP+i0MC7kOmz7GTMuwv7 gJLPUuHGYac58ZHpM0X5SsJHp0/jesFiOEuYWeIZ8S+au+oTfhrg5LsnI04XXo4yqJoR mdDw== X-Gm-Message-State: AOAM532J4Xz1bN3mH4uaMmmbimQZmpBYzYBTzAWxeGIOm7sRsFkD33WG OD5O1iwd0k47yqFvPfY9vtf2QA== X-Google-Smtp-Source: ABdhPJx/U+JQQIVy5Z6jmxB6Vxq5uyb7pPhzTtg7dFpZJTRh6j5Bdp55c58U2PO6O11vtCQijUJtwQ== X-Received: by 2002:a63:dd46:: with SMTP id g6mr25438898pgj.347.1634085351506; Tue, 12 Oct 2021 17:35:51 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:1d60:171b:3906:2add]) by smtp.gmail.com with ESMTPSA id e6sm12068466pfm.212.2021.10.12.17.35.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 17:35:51 -0700 (PDT) Date: Wed, 13 Oct 2021 09:35:47 +0900 From: AKASHI Takahiro To: Ilias Apalodimas Cc: Simon Glass , Heinrich Schuchardt , Alex Graf , U-Boot Mailing List Subject: Re: [RFC 07/22] block: ide: call device_probe() after scanning Message-ID: <20211013003547.GA43695@laputa> Mail-Followup-To: AKASHI Takahiro , Ilias Apalodimas , Simon Glass , Heinrich Schuchardt , Alex Graf , U-Boot Mailing List References: <20211001050228.55183-1-takahiro.akashi@linaro.org> <20211001050228.55183-14-takahiro.akashi@linaro.org> <20211011014327.GD44356@laputa> 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 Tue, Oct 12, 2021 at 08:53:54AM +0300, Ilias Apalodimas wrote: > On Mon, Oct 11, 2021 at 08:54:13AM -0600, Simon Glass wrote: > > Hi Takahiro, > > > > On Sun, 10 Oct 2021 at 19:43, AKASHI Takahiro > > wrote: > > > > > > 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?) > > > > Yes I agree it would be a very strange function. But at least it would > > have the benefit of grouping the code together under a particular > > name, something like blk_back_out_bind(), but that's not a good > > name....it just feels like this might get refactored in the future and > > having the code in one place might be handy. > > naming is hard! try_device_probe() maybe? Indeed. A name should come later. So I will temporarily use blk_probe_or_unbind() :-) -Takahiro Akashi > Cheers > /Ilias > > > > Regards, > > Simon