From patchwork Wed May 31 11:25:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13261994 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BD0DC7EE23 for ; Wed, 31 May 2023 11:26:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235038AbjEaL0M (ORCPT ); Wed, 31 May 2023 07:26:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232620AbjEaL0K (ORCPT ); Wed, 31 May 2023 07:26:10 -0400 Received: from post.baikalelectronics.com (post.baikalelectronics.com [213.79.110.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4D45CE5; Wed, 31 May 2023 04:26:08 -0700 (PDT) Received: from post.baikalelectronics.com (localhost.localdomain [127.0.0.1]) by post.baikalelectronics.com (Proxmox) with ESMTP id DC144E0DE9; Wed, 31 May 2023 14:26:06 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= baikalelectronics.ru; h=cc:cc:content-transfer-encoding :content-type:content-type:date:from:from:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=post; bh=LHPyA9tgRl2Gs6Hh3GgNy+g6dEDqK2VKmPfH8Gos1h8=; b=mllTnkyiWEER e61pGtlj3+KXm6EsmFlqGkrW/g2YlHYCbDcGrdD8L06jquddFLPLzZ3VCzL0EL8N 541QQYLBIPWUG8cPyqBv5UVambUGkotPR2+dWgCdPSbwZtzzLyykfzc+b3YfzuKO K3Cz4L3Uiwd7YUqXzIC9bZI74RlJqMU= Received: from mail.baikal.int (mail.baikal.int [192.168.51.25]) by post.baikalelectronics.com (Proxmox) with ESMTP id B5583E0DE3; Wed, 31 May 2023 14:26:06 +0300 (MSK) Received: from localhost (10.8.30.6) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 31 May 2023 14:26:06 +0300 From: Serge Semin To: Bjorn Helgaas , Lorenzo Pieralisi , Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Yoshihiro Shimoda , Rob Herring , Manivannan Sadhasivam , Serge Semin , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= CC: Serge Semin , Alexey Malahov , Pavel Parkhomenko , , Subject: [PATCH RESEND v6 01/11] PCI: dwc: Fix erroneous version type test helper Date: Wed, 31 May 2023 14:25:52 +0300 Message-ID: <20230531112602.7222-2-Sergey.Semin@baikalelectronics.ru> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230531112602.7222-1-Sergey.Semin@baikalelectronics.ru> References: <20230531112602.7222-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-Originating-IP: [10.8.30.6] X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Due to an unfortunate mistake the macro function actually checks the IP-core version instead of the IP-core version type which isn't what originally implied. Fix it by introducing a new helper __dw_pcie_ver_type_cmp() with the same semantic as the __dw_pcie_ver_cmp() counterpart except it refers to the dw_pcie.type field in order to perform the passed comparison operation. Fixes: 0b0a780d52ad ("PCI: dwc: Add macros to compare Synopsys IP core versions") Signed-off-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Reviewed-by: Yoshihiro Shimoda --- drivers/pci/controller/dwc/pcie-designware.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 79713ce075cc..adad0ea61799 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -37,17 +37,20 @@ #define __dw_pcie_ver_cmp(_pci, _ver, _op) \ ((_pci)->version _op DW_PCIE_VER_ ## _ver) +#define __dw_pcie_ver_type_cmp(_pci, _type, _op) \ + ((_pci)->type _op DW_PCIE_VER_TYPE_ ## _type) + #define dw_pcie_ver_is(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, ==) #define dw_pcie_ver_is_ge(_pci, _ver) __dw_pcie_ver_cmp(_pci, _ver, >=) #define dw_pcie_ver_type_is(_pci, _ver, _type) \ (__dw_pcie_ver_cmp(_pci, _ver, ==) && \ - __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, ==)) + __dw_pcie_ver_type_cmp(_pci, _type, ==)) #define dw_pcie_ver_type_is_ge(_pci, _ver, _type) \ (__dw_pcie_ver_cmp(_pci, _ver, ==) && \ - __dw_pcie_ver_cmp(_pci, TYPE_ ## _type, >=)) + __dw_pcie_ver_type_cmp(_pci, _type, >=)) /* DWC PCIe controller capabilities */ #define DW_PCIE_CAP_REQ_RES 0