Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2769782rwd; Fri, 16 Jun 2023 08:02:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ52hCol7L+B6Cs59RYnUEf/BEpPRCpAWv0R15LpQciiF/gZun+0t6ru7z7jOHvUJMn8BW8o X-Received: by 2002:a05:6a21:2d86:b0:10c:6dbc:2810 with SMTP id ty6-20020a056a212d8600b0010c6dbc2810mr2228669pzb.62.1686927749239; Fri, 16 Jun 2023 08:02:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686927749; cv=none; d=google.com; s=arc-20160816; b=kQsEdvdbey2nO8McFi7ueCBLlElKC0PZx8486W4zXWh64x+rB2ZxUh8wBSpsqS3Lwl 5mqZJpQk13HfiqfeYv7k97xIQ48qFPE4uaH1G6R2j7NjwWqJXoZQoGqB1iPoZ7d+jmmQ Wv+R2CJnLwuZ3BP3Mii/CzXf2kF2BqLCM1Vk3wSXaCaSt2jXVKsF4cFi3kqOq9TqE4qi PmtAcpghPQixV+NrFR/P2lRpnfusKrDbxfVfvKd1Z1QmhPQatSPZpntl00YVxiGq9dOs ePkmxP1yk25cjyxYy3eHJRlDWzB5JmpTw/U/VaLDoXxCM6otV4uwJ+STHqGe3q9Q8ubN wh2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Ahh/fsHN0q/hwtYc32l43F0+Yd52MfDa7q87AdE5jk0=; b=OyqBrxQfEJQGR3Se6MvSKLwVcgg1krZAcJtYsF71sZHdfx97V1//DhmdvbIoMY+2/0 leBJNB0nspBUVdIGgzPRBxOAQ6HCuyLobQHC0eMyeYxCDrgS7b/c3XtlMeUOd8BNnhMU O7rTnfBhFC0G5IBOuRO7eNsv7qm5vOgRslzRZ/xg/HLXOe2XvYlyMd0SZjoocFRGQ5Oz VustlYSq2jtWqwHeEn6FBtadhFRw++fikamPv9Tl5o6O6MZKk4BevTkZdLgkF0Myanjc JFTNZYLicrAS9JfVhFQRd/d1Twtfi3ozB5CjVJUbz8aaw2myCnkTRD0ljPBxXEK4+xhu auRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lPYbMMdP; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020aa78f29000000b0063d19a45a93si3235780pfr.280.2023.06.16.08.02.16; Fri, 16 Jun 2023 08:02:29 -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=@intel.com header.s=Intel header.b=lPYbMMdP; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345489AbjFPO0O (ORCPT + 99 others); Fri, 16 Jun 2023 10:26:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345434AbjFPO0N (ORCPT ); Fri, 16 Jun 2023 10:26:13 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02BC230E3; Fri, 16 Jun 2023 07:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686925571; x=1718461571; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=jbvx+fzCk6wuoZXDOskZS3VFaadcPZdfZkhrwY1ULLc=; b=lPYbMMdPn16dDXSSud8doBGuw+4pB1fxXcWMrTmIYmPVIIasgccFYdRN W2r0LAgibmZvQ9eZar0E0RSFBn+4oipgbfXsLppaLJpzL5DPiG4EGbKrK krZ2nlO1UXjMxJ2mpyHRc3mQKrydzAuz6p46Eb4xBfWaElBfJbYBqIwdl wefvLozWVDvAgFNd3m0tKYxZ1TyiGXrz7AEp/0FYDnD/0DZAn+y0vxknq dT3sIiOu3Nv1wL/gGP7i/LCnblQvka8B92UDiqYKiG5GF+DKRwCZdAOqm S1Xvg/apXfCKdUI0ELZ9fPhbmCMwENnYZuoiTARIkESOB96Q+fPVNOvQT Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="348934347" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="348934347" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 07:26:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="716043859" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="716043859" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 16 Jun 2023 07:26:08 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id BC90E379; Fri, 16 Jun 2023 17:26:17 +0300 (EEST) From: Andy Shevchenko To: Jens Axboe , Greg Kroah-Hartman , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v1 1/1] pktcdvd: Use clamp_val() instead of min()+max() Date: Fri, 16 Jun 2023 17:26:14 +0300 Message-Id: <20230616142614.36206-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 In a couple of places replace min()+max() pair by clamp_val(). Signed-off-by: Andy Shevchenko --- drivers/block/pktcdvd.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index a1428538bda5..18a960bb6165 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -208,14 +208,11 @@ static DEVICE_ATTR_RO(size); static void init_write_congestion_marks(int* lo, int* hi) { if (*hi > 0) { - *hi = max(*hi, 500); - *hi = min(*hi, 1000000); + *hi = clamp_val(*hi, 500, 1000000); if (*lo <= 0) *lo = *hi - 100; - else { - *lo = min(*lo, *hi - 100); - *lo = max(*lo, 100); - } + else + *lo = clamp_val(*lo, 100, *hi - 100); } else { *hi = -1; *lo = -1; -- 2.40.0.1.gaa8946217a0b