From patchwork Wed Nov 16 05:32:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 20721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3103995wru; Tue, 15 Nov 2022 21:36:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf6RSHF5fAEDD2vRPr0rXTWwCSWdQ4HY+1etkO0u5EoDtDJwKIe6v5ONZIJzZoY8de0vfD6y X-Received: by 2002:a17:902:9b87:b0:173:f3f:4a99 with SMTP id y7-20020a1709029b8700b001730f3f4a99mr7557962plp.79.1668577001649; Tue, 15 Nov 2022 21:36:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668577001; cv=none; d=google.com; s=arc-20160816; b=FB1HAQcnqYjMoEoOLdTND/Pr87BWgXDXU5u7V1Y+yaVedLc4untkY+RzzNIxZCObOq 0lpXsZiOjLbEHeztyUfmR2q27LLe2hbbYNERaKd86C6pdAvVeRLYCZJY3bM2+OAcLmqJ B7zf6Z6OaMt8Kyn/1qVIqzs/f+E/NrU/416D10LH3FVfaiA043552Mv+wo02Uu6JlkKz ywHutW46lHR0tay38dQTzNcf3cWVQr5JsEkYHKFqXZI/Y0/1xf4lCjDUGr23pHO0DkQj atd7wNpwGlYHrsIbcmkRNtGa6BcGZ3Xiw1pWq3e9U5jKjrYzuwVTRBhasrYK/HjfR0VQ vyAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=0MPz37HP3DvdLGi3Ok11jTRkC/AJb+bpy2SWIpQI6Hs=; b=ANGTQ1hbk0qMCJEt6BImsbUZByiY7ZgQKEqMb5EQAlHXaYDTrDaUzc0Ax3NStSTsbp Pi5bLIn04lG4CTZaSwwRUu/hDW6NSqVfkSYUvJZ8UdaGwa5APTDOorcQzsxYtxlIdz7p Zf4MLVEQVGEZgSGyVKwvqqVjkw4PNf2vsy1IJohZAmKvbO8Mb8Pte6B58WauuS6ObbAP aO+A3/bT4j6wrYjIepoOxFk5GMYH6cDcrM3RlSrrgo9b3QkTYupyzwOMa2iv6FBET7xz pvzUJ70qrvsjMi7UKxOIRQJ90fPwxAF5siCqwOJrHAEMEeptHgwpGhjG5R3u8S1o0t9w TLMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FUOshDM3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i20-20020a170902e49400b00174665bbc29si11994916ple.161.2022.11.15.21.36.29; Tue, 15 Nov 2022 21:36:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FUOshDM3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231283AbiKPFcj (ORCPT + 99 others); Wed, 16 Nov 2022 00:32:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiKPFcg (ORCPT ); Wed, 16 Nov 2022 00:32:36 -0500 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D4C323E85 for ; Tue, 15 Nov 2022 21:32:35 -0800 (PST) Received: by mail-lj1-x236.google.com with SMTP id d3so20433872ljl.1 for ; Tue, 15 Nov 2022 21:32:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=0MPz37HP3DvdLGi3Ok11jTRkC/AJb+bpy2SWIpQI6Hs=; b=FUOshDM38Y6xWfxUeFtmA5arEgyvlTslRIhhTO8fBpkw/ZssBHIMdDTfahrwy87KxJ SkafsHOqXryIrrW2ORfNYvo5GLgO0flB/WA0qNHoxd0h+/SyskWNxaTiOQNeDBVWpnLs VMAnU4cegFSyWdEv/Cr9BVCK8w1IKPtB+hoa+u6Lfnwl49w9lJ1AgUq4LBQ5ampgutvz Ks+/Se5G/FOc9Vybrcel2GLhnq2J5rcM/rpDZHr7pizcN9nf3e8yhBz6+HxI52pWLSrZ k7w57+xPNXi/JAsjhBsBsERPOytBEdAxapNMQYy08H0lEelLhMITyiqaTgtPDcWaaELr LdlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0MPz37HP3DvdLGi3Ok11jTRkC/AJb+bpy2SWIpQI6Hs=; b=u5iMY7KlioGEnhDamVqXs0+O0ZuYM+TY0S3J5kvKNpB3qetPOiZrKICYu2t5ikvpbD W2CXbdYaBFRhfa3EhMFFwudB+hapg6Bygfm49fbRUhi9akplaKsLR/4Z2ZAVuHYb+C88 JfpPW8LW6C0X3WcPlEvxtLDuN7/WIoZZAPpTFemq7gwmdwHg10e9r5TJDLjdAPkLSAk5 MiwSTmayquv2ix/qddgYOeCob0f8fMnucpZtjGGQa3cDRPx+G6AQamr1eHbz3nE/yVfQ zJlsCTeSNequ7wBzcQEEWrcn3xWwt0q+PtaZuPkEgSB+9H4E6vxy9hSj8lBuFzpitpvT G2bA== X-Gm-Message-State: ANoB5ploY+vXJD2JZ4VihLkb1HH3ARNL6Jb9zmLvmMsEyXAFYj8HhIpE /aDc4A5CLGtYlc46nBM6BvGR4gUHDlg= X-Received: by 2002:a2e:6f0e:0:b0:277:452a:473c with SMTP id k14-20020a2e6f0e000000b00277452a473cmr7244803ljc.454.1668576753210; Tue, 15 Nov 2022 21:32:33 -0800 (PST) Received: from dc75zzyyyyyyyyyyyyydt-3.rev.dnainternet.fi (dc75zzyyyyyyyyyyyyydt-3.rev.dnainternet.fi. [2001:14ba:16f3:4a00::7]) by smtp.gmail.com with ESMTPSA id d25-20020a19e619000000b004ab52b0bcf9sm2440008lfh.207.2022.11.15.21.32.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 21:32:32 -0800 (PST) Date: Wed, 16 Nov 2022 07:32:12 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Mark Brown , Matti Vaittinen , linux-kernel@vger.kernel.org Subject: [PATCH RESEND] lib/test_linear_ranges: Use LINEAR_RANGE() Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749629798161693085?= X-GMAIL-MSGID: =?utf-8?q?1749629798161693085?= New initialization macro for linear ranges was added. Slightly simplify the test code by using this macro - and at the same time also verify the macro is working as intended. Use the newly added LINEAR_RANGE() initialization macro for linear range test. Signed-off-by: Matti Vaittinen --- As unrelated side-note: It slightly bugs me that the regulator framework duplicates this initialization macro as it was originally left there. Would it be worth the hassle to mass-convert users of REGULATOR_LINEAR_RANGE() to use the LINEAR_RANGE() and remove the original macro? lib/test_linear_ranges.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) base-commit: 094226ad94f471a9f19e8f8e7140a09c2625abaa diff --git a/lib/test_linear_ranges.c b/lib/test_linear_ranges.c index 676e0b8abcdd..c18f9c0f1f25 100644 --- a/lib/test_linear_ranges.c +++ b/lib/test_linear_ranges.c @@ -107,17 +107,8 @@ static const unsigned int range2_vals[] = { RANGE2_MIN, RANGE2_MIN + #define SMALLEST_VAL RANGE1_MIN static struct linear_range testr[] = { - { - .min = RANGE1_MIN, - .min_sel = RANGE1_MIN_SEL, - .max_sel = RANGE1_MAX_SEL, - .step = RANGE1_STEP, - }, { - .min = RANGE2_MIN, - .min_sel = RANGE2_MIN_SEL, - .max_sel = RANGE2_MAX_SEL, - .step = RANGE2_STEP - }, + LINEAR_RANGE(RANGE1_MIN, RANGE1_MIN_SEL, RANGE1_MAX_SEL, RANGE1_STEP), + LINEAR_RANGE(RANGE2_MIN, RANGE2_MIN_SEL, RANGE2_MAX_SEL, RANGE2_STEP), }; static void range_test_get_value(struct kunit *test)