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 2A8C2C00140 for ; Tue, 2 Aug 2022 12:42:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C165D84594; Tue, 2 Aug 2022 14:42:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="gDh7Dc0B"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A4DB984536; Tue, 2 Aug 2022 14:41:58 +0200 (CEST) Received: from mail-vk1-xa32.google.com (mail-vk1-xa32.google.com [IPv6:2607:f8b0:4864:20::a32]) (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 F07BC844D4 for ; Tue, 2 Aug 2022 14:41:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-vk1-xa32.google.com with SMTP id w129so7012352vkg.10 for ; Tue, 02 Aug 2022 05:41:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NwIDo/fN+/jCGkN6vUnrrG6oeNvX73frJ3D7Z/vbiSM=; b=gDh7Dc0B2QFTbBhNRCk8kW+92M+uZnJ4VM1j9h0vMOxkPrHSxiPyfFgCOxsvRxh1u0 dfty6s4MaKloNV7e9Cuossx5u2JVGWIGltH+UiDSoidxH11hV3hthAnm6VNThcSUAC6s q+6BKvJY7Wtp5saq+gKw7LTTlH4+fI5BRVGmo= 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:cc; bh=NwIDo/fN+/jCGkN6vUnrrG6oeNvX73frJ3D7Z/vbiSM=; b=5tKtIgVCvgWjwcQwGPVcW+PgtsNdjD8t+dqrOD0hstpo5NGJ6cERUXtWLR9UpuE6SN L1kn7+Bhf8qEcgIUpfoYxkAhp9kPsqbi8QYtBQQuVsdcZLn1jlSmG2Ucxt/U9kWoGXoF eaJEQDEyKCTSMBSOLImmrKjzyuYKbYpKB0bVRvbsoLMqcu7TzgSLWNSW1vsIZ0t8a83p ejlmEgLbjIPHBXDQ5ByIafCTzHVRKRWSJLZe7+zv+ITW3zbkfcJ8vZ9IkqlMKReMr5OC np2g/v51lVlDl3l73aGaqla1H4WtiFrSKH1yJS/U6Rp8QbSoIR6w+E7bA10SnEjZU0HP Y37Q== X-Gm-Message-State: ACgBeo0E8mGzdZbKgzWd3uBcrixLTEZGe+Gn2y4hNq/5ZnI23a2jChxf GIbV63rRnEYsqDbQn0mkrYzDwvzvvMvHP0LVCAlIFA== X-Google-Smtp-Source: AA6agR6HjckC6AeNLUtXXqQYUOCvjtLZ2vRNbFhQh2NwPc2x9hoOopDVoSsFUHi2K/B43ilaoAfXRMwfZScyzUH0seI= X-Received: by 2002:a05:6122:985:b0:377:30a7:69e with SMTP id g5-20020a056122098500b0037730a7069emr5286731vkd.21.1659444114444; Tue, 02 Aug 2022 05:41:54 -0700 (PDT) MIME-Version: 1.0 References: <20220802094933.69170-1-heinrich.schuchardt@canonical.com> In-Reply-To: <20220802094933.69170-1-heinrich.schuchardt@canonical.com> From: Simon Glass Date: Tue, 2 Aug 2022 06:41:42 -0600 Message-ID: Subject: Re: [PATCH 1/1] block: fix blk_get_devnum_by_typename() To: Heinrich Schuchardt Cc: AKASHI Takahiro , U-Boot Mailing List Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean Hi Heinrich, On Tue, 2 Aug 2022 at 03:50, Heinrich Schuchardt wrote: > > Both the 'host' and the 'efiloader' block devices use the same parent > uclass root. Thus the parent uclass is not an indicator the interface type. > > Currently the following fails: > > setenv efi_selftest block device > bootefi selftest > part list efiloader 0 > > Struct blk_desc contains the interface type. So we can check it directly > without caring about the parent uclass. > > Signed-off-by: Heinrich Schuchardt > --- > drivers/block/blk-uclass.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) We've had this discussion before, but this patch will make it difficult to migrate away from IF_TYPE. Instead we should fix EFI. Having the root as a parent of a block device seems wrong to me. What is the actual device that provides the block device? > > diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c > index 21c5209bb6..779cda7834 100644 > --- a/drivers/block/blk-uclass.c > +++ b/drivers/block/blk-uclass.c > @@ -122,15 +122,11 @@ struct blk_desc *blk_get_devnum_by_typename(const char *if_typename, int devnum) > > debug("%s: if_type=%d, devnum=%d: %s, %d, %d\n", __func__, > if_type, devnum, dev->name, desc->if_type, desc->devnum); > - if (desc->devnum != devnum) > - continue; > > - /* Find out the parent device uclass */ > - if (device_get_uclass_id(dev->parent) != uclass_id) { > - debug("%s: parent uclass %d, this dev %d\n", __func__, > - device_get_uclass_id(dev->parent), uclass_id); > + if (desc->if_type != if_type) > + continue; > + if (desc->devnum != devnum) > continue; > - } > > if (device_probe(dev)) > return NULL; > -- > 2.36.1 > Regards, Simon