Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp754978pxj; Thu, 13 May 2021 16:31:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmBwTyJhJcXl8M6RMTKfTxWSrvH1uJt4KXGKuBavnEKA36D7KsOPHmkwO0MVmd8YHxPphM X-Received: by 2002:a05:6402:2786:: with SMTP id b6mr12425880ede.20.1620948718457; Thu, 13 May 2021 16:31:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620948718; cv=none; d=google.com; s=arc-20160816; b=EHvltblUSvIuyd2c+gki40PySslXnEPHfDipb5986cSfKKBDVsGbRoGeBw1M8D3AOI kSMcjGSq/uS8pZ6M9r2CWxOETrhLW3z78mttok2no003DBZlLZxI7Jgke3T+Uxa2T9vp rvsLe+tSk5X10xPEkiCynr/kqFKVHNxQt5RYsDoMA7MGTiYR9xHH17ulGuWcAtqV4IAE LZ91D3snmEu5ZfD6aPpOWdAoaa974a5YTiY2XGYSaPqvFnBJCp7DXhe6/s3wcCYTxQgv zG4NWJEE2AYpZVCTE8iomxQp7hvb54AIZ81CnZ1xOMzITZTCZxmZXftDOZHFJvd9ggzp OxCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=cg7LEB8jQNZq3myTn8tFgqiZzcPO7JbaemmMCDGoUaE=; b=veLaQX+Mlz8PA1Rha1tvuntfYRnJbHyo4jGGG4r5ekaKhbOssQX8r9iUHs4xJHjUc3 IVok1oK+HxRTZZ6+UlU4IG4EUn043ojDRZ0KENXqySaim3I7PAL+5NhTnHeLpOI3+sn/ wY3c45CSCLcSW3x/OfKSOaMA6+O+uS/SqXyVjAcmXRnADMbP2xzy/PN25Q3TQM1i2Ais c6O3J2RJumMj6fov3huFRI8Ha0dpKe0ONEE8H7lL/njNWvXylmCMnEd8ZvoMz6ik7hZF Qj49I9780Cx84hstq2ziMdfOSLBgIVHgcLJQZyl/BC8ggnYBNUgZutWwId4jQrZslX2A oeUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=P7DkNhZX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si261144eja.400.2021.05.13.16.31.34; Thu, 13 May 2021 16:31:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=P7DkNhZX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230495AbhEMThU (ORCPT + 99 others); Thu, 13 May 2021 15:37:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230483AbhEMThU (ORCPT ); Thu, 13 May 2021 15:37:20 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3383C06174A for ; Thu, 13 May 2021 12:36:09 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id n129-20020a2527870000b02904ed02e1aab5so33354710ybn.21 for ; Thu, 13 May 2021 12:36:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=cg7LEB8jQNZq3myTn8tFgqiZzcPO7JbaemmMCDGoUaE=; b=P7DkNhZXPNATPQ3LyKbTzcUPPVgge/+RxDvs6NLJ6CE3huLBWo+UOVkZiZjDOBB+7/ 6m2KQJGaR8iIX6Sq57KEgrxjj1/xUIIA52a8HPi60gDSc8hyw06WIr/2ov79OFhRcd/u 9tiZwMjYOh5bdzgadKkmlKFhXYSe0lIcFdcyk7jnX77hjWBLAWG1bFgBvTZOLitx3MZq sEBFmnGIP88RV+HLXW57SqoGXq6vQzUk4naQjeaFmCfePesEVWdgzlKb1OsG2RAL3YjE TLxqGyV9pA4huJy+lF72QdHwanu4OCLUpWkO5CdyJ5IAzE6hNYqwVWcnwFA1lr6LElAd sHuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=cg7LEB8jQNZq3myTn8tFgqiZzcPO7JbaemmMCDGoUaE=; b=LCQZhLJJ9ASqYJkpGfUyl4K+ya3MpDhNZ6N0nbluaBwAmhd0CkEGB69T/qo5d90iy/ VWeNsH/tr11GiG7lEbGeGqbrcZoUMdOusHnTW5gd+7AXcfJZ0YE0fPEERDh34l+DPDA7 2wfRfDIfnQyeUQ8OOPilrNUwQhvXCSwzoR1NF4hfa+gkOoO1PCZiGNlIPDkKA7fKck3V xs+2rD+Q+6kcMvw5Ivat9bLgZTqn7j3rMJEDYUB9ZFTbs/jfZmmPGOibPyP4dP3H5NLL WSeKhuW2EzIKFGlS+bJRatrDgBtZUwE8NHpjgquvGtWxZBW1bPH3Rwk6CH1cSEjfInzX KveA== X-Gm-Message-State: AOAM531h4QbjHovkAez5oF/Y1UfqjQIaPracdr8hPjv4NhCHsAfDMDOr y/Rq5+o1kFTZVIPxLG9iBkkMOK0LvMuUUg== X-Received: from spirogrip.svl.corp.google.com ([2620:15c:2cb:201:5f61:8ca4:879b:809e]) (user=davidgow job=sendgmr) by 2002:a25:1855:: with SMTP id 82mr58263387yby.305.1620934569116; Thu, 13 May 2021 12:36:09 -0700 (PDT) Date: Thu, 13 May 2021 12:31:58 -0700 In-Reply-To: <20210513193204.816681-1-davidgow@google.com> Message-Id: <20210513193204.816681-4-davidgow@google.com> Mime-Version: 1.0 References: <20210513193204.816681-1-davidgow@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 04/10] device property: Remove some casts in property-entry-test From: David Gow To: Brendan Higgins , Daniel Latypov , Shuah Khan , Greg Kroah-Hartman , Andy Shevchenko Cc: David Gow , kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With some of the stricter type checking in KUnit's EXPECT macros removed, several casts in property-entry-test are no longer required. Remove the unnecessary casts, making the conditions clearer. Signed-off-by: David Gow --- This should be a no-op functionality wise, and while it depends on the first couple of patches in this series, it's otherwise independent from the others. I think this makes the test more readable, but if you particularly dislike it, I'm happy to drop it. drivers/base/test/property-entry-test.c | 56 ++++++++++++------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/base/test/property-entry-test.c b/drivers/base/test/property-entry-test.c index 1106fedcceed..6071d5bc128c 100644 --- a/drivers/base/test/property-entry-test.c +++ b/drivers/base/test/property-entry-test.c @@ -32,11 +32,11 @@ static void pe_test_uints(struct kunit *test) error = fwnode_property_read_u8(node, "prop-u8", &val_u8); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)val_u8, 8); + KUNIT_EXPECT_EQ(test, val_u8, 8); error = fwnode_property_read_u8_array(node, "prop-u8", array_u8, 1); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)array_u8[0], 8); + KUNIT_EXPECT_EQ(test, array_u8[0], 8); error = fwnode_property_read_u8_array(node, "prop-u8", array_u8, 2); KUNIT_EXPECT_NE(test, error, 0); @@ -49,14 +49,14 @@ static void pe_test_uints(struct kunit *test) error = fwnode_property_read_u16(node, "prop-u16", &val_u16); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)val_u16, 16); + KUNIT_EXPECT_EQ(test, val_u16, 16); error = fwnode_property_count_u16(node, "prop-u16"); KUNIT_EXPECT_EQ(test, error, 1); error = fwnode_property_read_u16_array(node, "prop-u16", array_u16, 1); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)array_u16[0], 16); + KUNIT_EXPECT_EQ(test, array_u16[0], 16); error = fwnode_property_read_u16_array(node, "prop-u16", array_u16, 2); KUNIT_EXPECT_NE(test, error, 0); @@ -69,14 +69,14 @@ static void pe_test_uints(struct kunit *test) error = fwnode_property_read_u32(node, "prop-u32", &val_u32); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)val_u32, 32); + KUNIT_EXPECT_EQ(test, val_u32, 32); error = fwnode_property_count_u32(node, "prop-u32"); KUNIT_EXPECT_EQ(test, error, 1); error = fwnode_property_read_u32_array(node, "prop-u32", array_u32, 1); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)array_u32[0], 32); + KUNIT_EXPECT_EQ(test, array_u32[0], 32); error = fwnode_property_read_u32_array(node, "prop-u32", array_u32, 2); KUNIT_EXPECT_NE(test, error, 0); @@ -89,14 +89,14 @@ static void pe_test_uints(struct kunit *test) error = fwnode_property_read_u64(node, "prop-u64", &val_u64); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)val_u64, 64); + KUNIT_EXPECT_EQ(test, val_u64, 64); error = fwnode_property_count_u64(node, "prop-u64"); KUNIT_EXPECT_EQ(test, error, 1); error = fwnode_property_read_u64_array(node, "prop-u64", array_u64, 1); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)array_u64[0], 64); + KUNIT_EXPECT_EQ(test, array_u64[0], 64); error = fwnode_property_read_u64_array(node, "prop-u64", array_u64, 2); KUNIT_EXPECT_NE(test, error, 0); @@ -140,19 +140,19 @@ static void pe_test_uint_arrays(struct kunit *test) error = fwnode_property_read_u8(node, "prop-u8", &val_u8); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)val_u8, 8); + KUNIT_EXPECT_EQ(test, val_u8, 8); error = fwnode_property_count_u8(node, "prop-u8"); KUNIT_EXPECT_EQ(test, error, 10); error = fwnode_property_read_u8_array(node, "prop-u8", array_u8, 1); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)array_u8[0], 8); + KUNIT_EXPECT_EQ(test, array_u8[0], 8); error = fwnode_property_read_u8_array(node, "prop-u8", array_u8, 2); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)array_u8[0], 8); - KUNIT_EXPECT_EQ(test, (int)array_u8[1], 9); + KUNIT_EXPECT_EQ(test, array_u8[0], 8); + KUNIT_EXPECT_EQ(test, array_u8[1], 9); error = fwnode_property_read_u8_array(node, "prop-u8", array_u8, 17); KUNIT_EXPECT_NE(test, error, 0); @@ -165,19 +165,19 @@ static void pe_test_uint_arrays(struct kunit *test) error = fwnode_property_read_u16(node, "prop-u16", &val_u16); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)val_u16, 16); + KUNIT_EXPECT_EQ(test, val_u16, 16); error = fwnode_property_count_u16(node, "prop-u16"); KUNIT_EXPECT_EQ(test, error, 10); error = fwnode_property_read_u16_array(node, "prop-u16", array_u16, 1); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)array_u16[0], 16); + KUNIT_EXPECT_EQ(test, array_u16[0], 16); error = fwnode_property_read_u16_array(node, "prop-u16", array_u16, 2); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)array_u16[0], 16); - KUNIT_EXPECT_EQ(test, (int)array_u16[1], 17); + KUNIT_EXPECT_EQ(test, array_u16[0], 16); + KUNIT_EXPECT_EQ(test, array_u16[1], 17); error = fwnode_property_read_u16_array(node, "prop-u16", array_u16, 17); KUNIT_EXPECT_NE(test, error, 0); @@ -190,19 +190,19 @@ static void pe_test_uint_arrays(struct kunit *test) error = fwnode_property_read_u32(node, "prop-u32", &val_u32); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)val_u32, 32); + KUNIT_EXPECT_EQ(test, val_u32, 32); error = fwnode_property_count_u32(node, "prop-u32"); KUNIT_EXPECT_EQ(test, error, 10); error = fwnode_property_read_u32_array(node, "prop-u32", array_u32, 1); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)array_u32[0], 32); + KUNIT_EXPECT_EQ(test, array_u32[0], 32); error = fwnode_property_read_u32_array(node, "prop-u32", array_u32, 2); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)array_u32[0], 32); - KUNIT_EXPECT_EQ(test, (int)array_u32[1], 33); + KUNIT_EXPECT_EQ(test, array_u32[0], 32); + KUNIT_EXPECT_EQ(test, array_u32[1], 33); error = fwnode_property_read_u32_array(node, "prop-u32", array_u32, 17); KUNIT_EXPECT_NE(test, error, 0); @@ -215,19 +215,19 @@ static void pe_test_uint_arrays(struct kunit *test) error = fwnode_property_read_u64(node, "prop-u64", &val_u64); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)val_u64, 64); + KUNIT_EXPECT_EQ(test, val_u64, 64); error = fwnode_property_count_u64(node, "prop-u64"); KUNIT_EXPECT_EQ(test, error, 10); error = fwnode_property_read_u64_array(node, "prop-u64", array_u64, 1); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)array_u64[0], 64); + KUNIT_EXPECT_EQ(test, array_u64[0], 64); error = fwnode_property_read_u64_array(node, "prop-u64", array_u64, 2); KUNIT_EXPECT_EQ(test, error, 0); - KUNIT_EXPECT_EQ(test, (int)array_u64[0], 64); - KUNIT_EXPECT_EQ(test, (int)array_u64[1], 65); + KUNIT_EXPECT_EQ(test, array_u64[0], 64); + KUNIT_EXPECT_EQ(test, array_u64[1], 65); error = fwnode_property_read_u64_array(node, "prop-u64", array_u64, 17); KUNIT_EXPECT_NE(test, error, 0); @@ -358,13 +358,13 @@ static void pe_test_move_inline_u8(struct kunit *test) KUNIT_EXPECT_TRUE(test, copy[0].is_inline); data_ptr = (u8 *)©[0].value; - KUNIT_EXPECT_EQ(test, (int)data_ptr[0], 1); - KUNIT_EXPECT_EQ(test, (int)data_ptr[1], 2); + KUNIT_EXPECT_EQ(test, data_ptr[0], 1); + KUNIT_EXPECT_EQ(test, data_ptr[1], 2); KUNIT_EXPECT_FALSE(test, copy[1].is_inline); data_ptr = copy[1].pointer; - KUNIT_EXPECT_EQ(test, (int)data_ptr[0], 5); - KUNIT_EXPECT_EQ(test, (int)data_ptr[1], 6); + KUNIT_EXPECT_EQ(test, data_ptr[0], 5); + KUNIT_EXPECT_EQ(test, data_ptr[1], 6); property_entries_free(copy); } -- 2.31.1.751.gd2f1c929bd-goog