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 2C283C4332F for ; Mon, 25 Apr 2022 16:34:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 42A2283C8C; Mon, 25 Apr 2022 18:34:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1650904452; bh=H9PSxy94ib3oWcED2s76rQs0fwIfWPtsRVNdQSRj5Gs=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=njBFiXBx2vmBhipE4Nf/QbQsEuM3SJ3z6GCPO/28VypyvxgcNzaai2fM6hWrV8K/Z tT44L1BthE80RrUfNYxiu2donWCODOxzvdKnDoY9Acljut8XJJ5QinCgS7MRNvH2TH P/ZQjj2+vCFV+XVZypR3R3o5/DzM26iXvowA0TKfqdZqY8yv+Qmk+zywN/z54imSGA rmF21gqLQUsNBsCWboBiJg9XHEhdXwfEMcSNbESpES8g1RqAOcgabqzrbowxpblAuv xesW+PuyIWMNcRlCvOCmdyZTHWDexLNdy37pM5/30dCKYo9aA8OA1PsvjU2BGKfjZb had5/x2jsE7kA== Received: from tr.lan (ip-86-49-12-201.net.upcbroadband.cz [86.49.12.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 9240483C1E; Mon, 25 Apr 2022 18:34:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1650904450; bh=H9PSxy94ib3oWcED2s76rQs0fwIfWPtsRVNdQSRj5Gs=; h=From:To:Cc:Subject:Date:From; b=gbBl0zgKJ//XtFIxx0u9XPFx+aBtuavyosTpTwzlfuIMsjpZYuuXLfFp1/dmdcJT+ xovvjEkgjKs07Rev9jq0C54V1ZEG68FgKhnUP/wUsqmfCH4DrR5Hg+4qiIyxSrUiaW c2ZjayBnZO48cWi2CjbIiUfoljWjxdzGUs0mnRIgjDCOTuwRKBHYnX6wPkkmFGt8XX jyDWRseDvIjfHFbeiJxJecioDIRyZNKPOhEBJz6lTFRg4Z7TL2oCopxa2hUpuXpl8W +LQIGsFesvboq0uNlOXx4/uxJDqV7J6fcZNqkCnyyHCkvkvHNj7oPiXjNLVh1ITV9D UYjPUqtjzVbGw== From: Marek Vasut To: u-boot@lists.denx.de Cc: trini@konsulko.com, Marek Vasut , Patrice Chotard , Patrick Delaunay , Sean Anderson , Simon Glass , Steven Lawrance Subject: [PATCH 1/2] test: dm: led: Fix LED enumeration Date: Mon, 25 Apr 2022 18:33:50 +0200 Message-Id: <20220425163351.191350-1-marex@denx.de> X-Mailer: git-send-email 2.35.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.5 at phobos.denx.de X-Virus-Status: Clean The GPIO LED driver no longer considers the top level node an LED, because it is not an LED. With this bug fixed, the LED enumeration has changed. Update the test accordingly. Signed-off-by: Marek Vasut Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Sean Anderson Cc: Simon Glass Cc: Steven Lawrance --- test/dm/led.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/dm/led.c b/test/dm/led.c index 5bbe04648a1..eed3f4654c5 100644 --- a/test/dm/led.c +++ b/test/dm/led.c @@ -21,8 +21,7 @@ static int dm_test_led_base(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_LED, 1, &dev)); ut_assertok(uclass_get_device(UCLASS_LED, 2, &dev)); ut_assertok(uclass_get_device(UCLASS_LED, 3, &dev)); - ut_assertok(uclass_get_device(UCLASS_LED, 4, &dev)); - ut_asserteq(-ENODEV, uclass_get_device(UCLASS_LED, 5, &dev)); + ut_asserteq(-ENODEV, uclass_get_device(UCLASS_LED, 4, &dev)); return 0; } @@ -52,10 +51,10 @@ static int dm_test_led_gpio(struct unit_test_state *uts) struct udevice *dev, *gpio; /* - * Check that we can manipulate an LED. LED 1 is connected to GPIO + * Check that we can manipulate an LED. LED 0 is connected to GPIO * bank gpio_a, offset 1. */ - ut_assertok(uclass_get_device(UCLASS_LED, 1, &dev)); + ut_assertok(uclass_get_device(UCLASS_LED, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_GPIO, 1, &gpio)); ut_asserteq(0, sandbox_gpio_get_value(gpio, offset)); ut_assertok(led_set_state(dev, LEDST_ON)); @@ -77,10 +76,10 @@ static int dm_test_led_toggle(struct unit_test_state *uts) struct udevice *dev, *gpio; /* - * Check that we can manipulate an LED. LED 1 is connected to GPIO + * Check that we can manipulate an LED. LED 0 is connected to GPIO * bank gpio_a, offset 1. */ - ut_assertok(uclass_get_device(UCLASS_LED, 1, &dev)); + ut_assertok(uclass_get_device(UCLASS_LED, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_GPIO, 1, &gpio)); ut_asserteq(0, sandbox_gpio_get_value(gpio, offset)); ut_assertok(led_set_state(dev, LEDST_TOGGLE)); @@ -102,12 +101,12 @@ static int dm_test_led_label(struct unit_test_state *uts) ut_assertok(led_get_by_label("sandbox:red", &dev)); ut_asserteq(1, device_active(dev)); - ut_assertok(uclass_get_device(UCLASS_LED, 1, &cmp)); + ut_assertok(uclass_get_device(UCLASS_LED, 0, &cmp)); ut_asserteq_ptr(dev, cmp); ut_assertok(led_get_by_label("sandbox:green", &dev)); ut_asserteq(1, device_active(dev)); - ut_assertok(uclass_get_device(UCLASS_LED, 2, &cmp)); + ut_assertok(uclass_get_device(UCLASS_LED, 1, &cmp)); ut_asserteq_ptr(dev, cmp); ut_asserteq(-ENODEV, led_get_by_label("sandbox:blue", &dev)); @@ -127,7 +126,7 @@ static int dm_test_led_blink(struct unit_test_state *uts) * Check that we get an error when trying to blink an LED, since it is * not supported by the GPIO LED driver. */ - ut_assertok(uclass_get_device(UCLASS_LED, 1, &dev)); + ut_assertok(uclass_get_device(UCLASS_LED, 0, &dev)); ut_assertok(uclass_get_device(UCLASS_GPIO, 1, &gpio)); ut_asserteq(0, sandbox_gpio_get_value(gpio, offset)); ut_asserteq(-ENOSYS, led_set_state(dev, LEDST_BLINK)); -- 2.35.1