From patchwork Thu Aug 8 05:10:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Niethe X-Patchwork-Id: 1143830 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 463xKp11NTz9sN1 for ; Thu, 8 Aug 2019 15:11:10 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MPENRMkX"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 463xKn75WQzDqWL for ; Thu, 8 Aug 2019 15:11:09 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::441; helo=mail-pf1-x441.google.com; envelope-from=jniethe5@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MPENRMkX"; dkim-atps=neutral Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 463xKb00dvzDqVd for ; Thu, 8 Aug 2019 15:10:58 +1000 (AEST) Received: by mail-pf1-x441.google.com with SMTP id p184so43388692pfp.7 for ; Wed, 07 Aug 2019 22:10:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=svDROxsL82cGbp6ZSNcOWjFl1zwSfI2RCDvVR7rCnho=; b=MPENRMkXm0M1S73FljWNsU4h0TPPnd6p+k2jtM92u+KE6b5cPqb1DCL33DINDdHtGj NmzNMW1UJnRGREUVtE6j6C0a0lXc36iu9E8ns5kJNjEmlXI8xtt6Yf6bNazANx+PlABU buW59iQ291q6vr1VmqdYmRojrRUcVPYX2h930drKBkrW1+AM17KzCfVwTeYDXd2F4afw sUS6PKznAmpZFP4lmoEpfJhbeZaM1YmuIXbq/LNlbi2E8zBFfo7mtyIMEX9NOKxlgNti kCwXHKVpdoO6Kp9LSALCXfMDDb2c+lPWlrgKpFRyoA1IPGjdSzZwlJPQhZH/M9VSNSvr DiEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=svDROxsL82cGbp6ZSNcOWjFl1zwSfI2RCDvVR7rCnho=; b=rTjKVg4fJZk04nxDf2czK9lr3yAaiXwWVYN6bcpYtrB0m0AM13p3DghkDg8kr00lyO FU2TUCgKeTHPjZkL0dc/zb2l+bNFKt4eQh2Jy559pCbER+fHsUlMUzJta3VP22TFEI6v rEDwK1yaO8kaFbFisLXBmP647DJXhGMkmqz4Fmbie0OQYpdEi7gFdgujuJDvCC5TDQr5 +Eq3b5Z0LTYoEDrfTvo258h0HsIZfkaOAlW2XdLNLJ5OIyRa8r5JptHQq3xAiSMRH7LX u61HxRWrtZfdi+N2FzNRKxmFdM1VJIKclYTId/4+w630kb43rn3N9ePUIMnJEdGujdY5 guiA== X-Gm-Message-State: APjAAAWCVSY4OPMiTaNC7KwDKQzooBdwMKPVKtsFLP+FrcO69d1s/KxO PmOp613ovlXo19PzojRBw3ir4ArE X-Google-Smtp-Source: APXvYqx3BcfSUpCEaM/j4mKmUhkyA1zRP7qsdfH3kFRIUtmBET6ex27Cm8hzFRl151+ShuFAoTM3qw== X-Received: by 2002:a17:90a:9488:: with SMTP id s8mr2158599pjo.2.1565241054936; Wed, 07 Aug 2019 22:10:54 -0700 (PDT) Received: from pasglop.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id o130sm151690403pfg.171.2019.08.07.22.10.53 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 07 Aug 2019 22:10:54 -0700 (PDT) From: Jordan Niethe To: skiboot@lists.ozlabs.org Date: Thu, 8 Aug 2019 15:10:08 +1000 Message-Id: <20190808051008.6962-1-jniethe5@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Skiboot] [PATCH] hw/phb4: Use standard MIN/MAX macro definitions X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The max() macro definition actually returns the smallest value. Macro definitions for MIN and MAX are already provided in skiboot.h. Remove the redundant/incorrect versions here and switch to using the standard ones. Signed-off-by: Jordan Niethe --- hw/phb4.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index 39d0151c9aa1..a8fbf817ad2c 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -2574,9 +2574,6 @@ static void phb4_lane_eq_change(struct phb4 *p, uint32_t vdid) p->lane_eq_en = !phb4_lane_eq_retry_whitelist(vdid); } -#define min(x,y) ((x) < (y) ? x : y) -#define max(x,y) ((x) < (y) ? x : y) - static bool phb4_link_optimal(struct pci_slot *slot, uint32_t *vdid) { struct phb4 *p = phb_to_phb4(slot->phb); @@ -2603,9 +2600,9 @@ static bool phb4_link_optimal(struct pci_slot *slot, uint32_t *vdid) phb4_get_info(slot->phb, bdfn, &dev_speed, &dev_width); /* Work out if we are optimally trained */ - target_speed = min(phb_speed, dev_speed); + target_speed = MIN(phb_speed, dev_speed); optimal_speed = (trained_speed >= target_speed); - target_width = min(phb_width, dev_width); + target_width = MIN(phb_width, dev_width); optimal_width = (trained_width >= target_width); optimal = optimal_width && optimal_speed; retry_enabled = (phb4_chip_retry_workaround() && @@ -3366,7 +3363,7 @@ static int64_t phb4_creset(struct pci_slot *slot) */ creset_time = tb_to_msecs(mftb() - p->creset_start_time); if (creset_time < 250) - wait_time = max(100, 250 - creset_time); + wait_time = MAX(100, 250 - creset_time); else wait_time = 100; PHBDBG(p, "CRESET: wait_time = %lld\n", wait_time);