From patchwork Mon Oct 31 08:56:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13149 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2192673wru; Mon, 31 Oct 2022 01:58:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43LahvfFShYPz1JoB9MWauOqshWGfr3cqKQ3D3HMMku6lC6gFvI4yoHfYQznZ14Kd6NNjS X-Received: by 2002:a17:907:2c42:b0:7ad:d798:f2d5 with SMTP id hf2-20020a1709072c4200b007add798f2d5mr2514887ejc.386.1667206712499; Mon, 31 Oct 2022 01:58:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667206712; cv=none; d=google.com; s=arc-20160816; b=MSo+ryGZeNDGyn41C15q1wOiNL8FROv7N3EcITvCSiXiRgFZs9fl0WcpUEG6BBPeEs FyFDNOdHCdmmPsBCaNZUJeo4oUBzA83S3BmJIsLEtOmKPDSSSBStKs4hG4GWS5VjQMX4 bZ4N5K70NJvr1Fd44aXO2apKzmVHnle6GrUiLIVE1xJTkLPEPOIJb03Clk7AuNqN2zjl WecVzaMf5rZl/GNYqprUIg9bBsWrsFiwVbJ4aqkIPQWJfXfiydFKYtdZXiqwOo1YnKmw l6aDE+WhVcdlcjHsVoEcCZN9qMeZw6O7h+D7PtyGuWIsYjHzJcddvQGa8peLofnlpJ4D 5IFQ== 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=SIwL+GzxaLPi/piTRLicQ7NbL6+Ua5ZxLU8Xp7eDTmY=; b=He5v0R8NLWUYgjETg8J1ozpKZbmdYWiMBBMnxBv3aZ8TwjFbVMA6fMIdXV2YF3Q1ad ACYQ41W+gqup5pP0fwkc/M1Dge4EOkl++4ZcaDl58gvZ03kVbUEcIv0sGRlMUkufiT2A 921u2lSauV0ipOh0ZZmpPjL3t/3TpxRWLWIjh5DIc8tSACAnz6S/2HNP6TyPDXmac7XA hkfE0RYJKnl1tMtrlHVKPZufd0ZvOw8ORRpw2DvtJyg5MVG53FK8G0nknW3pO67cu/4D sBAcUocjCR5gYxyP6p1vra6EejMxgNfpyGKG1wTIZb/JOQaP5XjsskCrdysMjAiv1hJq s5kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QNm5YNzh; 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 vj23-20020a170907131700b0079fe11e92ddsi4830269ejb.906.2022.10.31.01.58.08; Mon, 31 Oct 2022 01:58:32 -0700 (PDT) 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=QNm5YNzh; 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 S230045AbiJaI4z (ORCPT + 99 others); Mon, 31 Oct 2022 04:56:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229795AbiJaI4y (ORCPT ); Mon, 31 Oct 2022 04:56:54 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CDE8CE37 for ; Mon, 31 Oct 2022 01:56:53 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id t4so5087712lfp.2 for ; Mon, 31 Oct 2022 01:56:53 -0700 (PDT) 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=SIwL+GzxaLPi/piTRLicQ7NbL6+Ua5ZxLU8Xp7eDTmY=; b=QNm5YNzhj88W83pKDzoNtQ8xvO3RGXblw+wh5SX78WBq9Fg982WvWh7L2MXE3QPveb G50s9QAe69+juty5HUvyC5oECuSi2n9aZED6/stnYjlwimnDJEK+7ha9LTOG5hpcNkAm b2CkVH0gPxHn0d8Sq7uxUKSrvVcRpR/XR+PyuiXo/2fQWs5rjrNEacF9JPmSzToZ8Xv9 KEi1XpuXeuYso35I9Q9UO89WgMdja4PwFS3kU8hXdBvAXaWoF7rYeaAXrByNbr258eY4 r1rR4ES0gLtAMCSyV2n4WPy4tnFBj4TK3fEqhUkEr/kvoE9EhKLaq2aQ3+FHAxMUlljs 4zJw== 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=SIwL+GzxaLPi/piTRLicQ7NbL6+Ua5ZxLU8Xp7eDTmY=; b=L8ietpIZdmQN9PFEqMjL8woIqZDOA182nQhEz+r9njfhE+y49qEtzy0vWnY5/Zhcup 9l+Kr394qfqhwT1WmJxKkbQLrGHtBpXlOYBfzJsRX4/uKGISXveyhRGiLxn746Vrv5t4 JbPGS7UiJYgHzoswTeTCVSagmzSSEPvqK4JE4hXsXqFCGU7EXkq683nwy6bViK4hGrrG UN4CzPTYUAkJDe2gyaCk7ob27XtYccV6lRMOd/htmsoFsJ4tAO+v38diFBDK+eQNZ1GV BtvmKgd7xgWaMRVJjCjSpSE5h04oEwTXyQt8ZkBijj05ufbK90VHmSabcd7kO/CvlKKR 8JLg== X-Gm-Message-State: ACrzQf0HD1ncpqGNM8bhqvsNfaFA/gHt2aCMdBC/sZBLMtr05CNUH7Qn xSdg3tKCsVrgPRQw8dCQTvc= X-Received: by 2002:ac2:58ca:0:b0:4a2:7bb1:ad61 with SMTP id u10-20020ac258ca000000b004a27bb1ad61mr4973514lfo.212.1667206611510; Mon, 31 Oct 2022 01:56:51 -0700 (PDT) Received: from dc75zzyyyyyyyyyyyyyby-3.rev.dnainternet.fi (dc75zzyyyyyyyyyyyyyby-3.rev.dnainternet.fi. [2001:14ba:16f3:4a00::2]) by smtp.gmail.com with ESMTPSA id p2-20020ac24ec2000000b00494603953b6sm1204714lfr.6.2022.10.31.01.56.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 01:56:50 -0700 (PDT) Date: Mon, 31 Oct 2022 10:56:46 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Mark Brown , Matti Vaittinen , linux-kernel@vger.kernel.org Subject: [PATCH] lib/test_linear_ranges: Use LINEAR_RANGE() Message-ID: <2678c1902df3d568232507530f0df39cd8733944.1667206528.git.mazziesaccount@gmail.com> 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?1748192946054947646?= X-GMAIL-MSGID: =?utf-8?q?1748192946054947646?= 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 --- lib/test_linear_ranges.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) 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)