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 1642FC00140 for ; Tue, 2 Aug 2022 09:50:13 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AC924844E4; Tue, 2 Aug 2022 11:50:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com 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=canonical.com header.i=@canonical.com header.b="uR5Vj4qp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2BB54844C5; Tue, 2 Aug 2022 11:50:09 +0200 (CEST) Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CDA208444D for ; Tue, 2 Aug 2022 11:50:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-062-143-094-109.um16.pools.vodafone-ip.de [62.143.94.109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id BDC153F12D; Tue, 2 Aug 2022 09:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1659433804; bh=0ht+pi4Q355R6OYASShPaeb7CgcZ0XT2Q+f+tQPETUY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=uR5Vj4qptHWl4k91fnvBDsJKL/q7TghXB3YZB/G8G09dkfrBJllUxEg6N+F74woIn JcUBtoWb3GLk+E9vlVfjpZT2GKmfyh4PM9U91ul/UZpJQvxCx414cWyYjhe0T73daz 2ARqbwPBj1iuKNlFPqXL54VUk/gFVJ9z5uHv/JhA6N6K63OO1vM0RWV4Nc/xnLV9DJ QQRRcEjoLCgcSIO/GC9kU/YbPo9nT5okcDfiHN4C+zxEK6yboP94jkt3rXV5dVCYpg Syic2RTSpfmDYwwMIKNlIZl/hImB7yOIqH30P8/pIHN1D+jwYFXvDqkmvdXcmpe6gk LMRyLtcgA3D5Q== From: Heinrich Schuchardt To: Simon Glass Cc: AKASHI Takahiro , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 1/1] block: fix blk_get_devnum_by_typename() Date: Tue, 2 Aug 2022 11:49:33 +0200 Message-Id: <20220802094933.69170-1-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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(-) 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