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 7C0ACC433F5 for ; Tue, 12 Oct 2021 05:54:06 +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 AAF0460C41 for ; Tue, 12 Oct 2021 05:54:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AAF0460C41 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 039C983460; Tue, 12 Oct 2021 07:54:03 +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="fqyskJ7k"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4A9628349A; Tue, 12 Oct 2021 07:54:01 +0200 (CEST) Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) (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 111F283305 for ; Tue, 12 Oct 2021 07:53: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=ilias.apalodimas@linaro.org Received: by mail-ed1-x52e.google.com with SMTP id w19so16550700edd.2 for ; Mon, 11 Oct 2021 22:53: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:references:mime-version :content-disposition:in-reply-to; bh=wnA0aKGyWQjMBRFqL5V/ZRRzXzliku7LjZyQTzZkptc=; b=fqyskJ7kblry/OIqmCqy95YNpBotFKybc20WswN1pnPQ78SVya2eb6rgqC/Syl+Qsp CGs48GiAamzeEc2JtfSzIOAhPd2OhfPlNQXScKzTp3an1q7TAv4yJ9fvzfw3aUoTu+aa Cyyqwd5vkc3wz7Ao+TrVAoFfVqVOEDb5O3CzdN0UZtwHkzBaWSUwXv0rcm8K8gkL3FAp GiK3WfoHbsyJHd8wISHhaHtL0ywo96KBE94geF3Qy31PLbnyfHqCpAOCC4m/4pDZPBdE 7zJ2NcReWRFrFIOdWMSU+VGHSFha1kKTTuCUvcb9wXoHNmkEk+XpAxeDylsXMDGBVCIw SozA== 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:references :mime-version:content-disposition:in-reply-to; bh=wnA0aKGyWQjMBRFqL5V/ZRRzXzliku7LjZyQTzZkptc=; b=zrInEsuJp0y7AH3TMBs9IzF8XP4GgoY89wqgjWzNbWX4b9xYXf2n8fcrlJqNd2LtkQ ieKLdTuyNxAkONvPSU2FMCYsrfYynnwSyK1Hvsa/7GlkAvY8igQe+rXeXmYDqmBYNiWG IhlRwN1oIyqcVmrcVYkP3jk3LlISeO4xa3VW7/MTNEQpM09pBrbgmgTXIReNOkGYow1b wTTE3IB72Ko1dhHZha8E248whoo9Wghu5XvMJzH6eb3H+R0rf2i45mkfMiYAU16b7ixv Vk7cjoaD2m3A9XfJzvNG1/WTXhlUFyLiyV4k1WkQIDoWImKk9Rgg0pmh2+lV7lJ9TTtS Oosw== X-Gm-Message-State: AOAM530JRt6qauCodiQHQo6btNTXO5tWgxXTiMki6ORp6nIXRgHGgL6d 7QfAcbTDwvrxeCidVO5g2HaS6r67B5Y4s8iF X-Google-Smtp-Source: ABdhPJwGbwXLRSyFlcj0ss/mbIIBZUvrZPbXlmx15OX0ZvO6ddp2IFcDJ33MJPkf8g9bGD9XsF+NMw== X-Received: by 2002:a05:6402:49a:: with SMTP id k26mr49426693edv.279.1634018037509; Mon, 11 Oct 2021 22:53:57 -0700 (PDT) Received: from apalos.home (ppp-94-66-220-73.home.otenet.gr. [94.66.220.73]) by smtp.gmail.com with ESMTPSA id n16sm5225202eda.93.2021.10.11.22.53.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Oct 2021 22:53:57 -0700 (PDT) Date: Tue, 12 Oct 2021 08:53:54 +0300 From: Ilias Apalodimas To: Simon Glass Cc: AKASHI Takahiro , Heinrich Schuchardt , Alex Graf , U-Boot Mailing List Subject: Re: [RFC 07/22] block: ide: call device_probe() after scanning Message-ID: 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 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? Cheers /Ilias > > Regards, > Simon