From patchwork Mon Jan 21 22:50:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 10774653 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9497C1823 for ; Mon, 21 Jan 2019 22:50:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 845752A905 for ; Mon, 21 Jan 2019 22:50:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78A622A992; Mon, 21 Jan 2019 22:50:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14E6A2A905 for ; Mon, 21 Jan 2019 22:50:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727012AbfAUWuN (ORCPT ); Mon, 21 Jan 2019 17:50:13 -0500 Received: from mail-eopbgr130045.outbound.protection.outlook.com ([40.107.13.45]:22368 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726244AbfAUWuN (ORCPT ); Mon, 21 Jan 2019 17:50:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/eOzHYqrmOBXlJY7gn9eTJFUeKWzm3jQXusDybGcOX4=; b=aSsD9COWKXM7XwsH0MyaOK+gHbnTny/drFTVSfOVKY6cKNCNLht83BP/ajZ93j/0piuk+rid9fkLdSjsIjVURQpYhgWk+Juc9FiV/GUWrQFZEsxn2B03BDr5bAHJZGNjP+eKLnjytgy5cf8RR/E0XnO9cE9VCylPD4EMyR5mIKs= Received: from VI1PR04MB5533.eurprd04.prod.outlook.com (20.178.122.159) by VI1PR04MB5983.eurprd04.prod.outlook.com (20.178.123.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1537.27; Mon, 21 Jan 2019 22:50:04 +0000 Received: from VI1PR04MB5533.eurprd04.prod.outlook.com ([fe80::92d:bf44:9c1d:b907]) by VI1PR04MB5533.eurprd04.prod.outlook.com ([fe80::92d:bf44:9c1d:b907%6]) with mapi id 15.20.1537.031; Mon, 21 Jan 2019 22:50:04 +0000 From: Leonard Crestez To: Lorenzo Pieralisi , "Lukas F . Hartmann" , Lucas Stach CC: Ulf Hansson , Richard Zhu , Shawn Guo , "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "kernel@pengutronix.de" , dl-linux-imx Subject: [PATCH 1/2] PCI: imx: Fix probe failure without power domain Thread-Topic: [PATCH 1/2] PCI: imx: Fix probe failure without power domain Thread-Index: AQHUsdumnhpLtdU11UCqN+1L30Gg6Q== Date: Mon, 21 Jan 2019 22:50:04 +0000 Message-ID: <375a852ae9170a5f8f53fdd364a7fb7ea642e89c.1548110502.git.leonard.crestez@nxp.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [95.76.156.53] x-mailer: git-send-email 2.17.1 x-clientproxiedby: AM5PR0701CA0051.eurprd07.prod.outlook.com (2603:10a6:203:2::13) To VI1PR04MB5533.eurprd04.prod.outlook.com (2603:10a6:803:d2::31) authentication-results: spf=none (sender IP is ) smtp.mailfrom=leonard.crestez@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR04MB5983;6:xpvHiiygtrTJpMunqQwxNDslS/gA9flwsUmmkbE8mMx1laICzaQFW9UP6naTHKNo5fB7yrPAe9bcA2ToIFrqkDo4J0edKyFKy4gq1gMh217k5kAV2TgWBttkbwjXvnwwVdGJnaVR2Uto65kNAhqVjgqOXBMtAWeDGsJ89xoWPRb63CAdXZB03hUjjwL+6q6NXQ67gs8Rb3wyqUEbmRsLJr9aQ3IVkPu0zq2FguwhMu6/8OOt+Juzs4wYfVF08l5XV4wj7RuGDMfRYSxG+BwWKt4ZkAaQSKrUjnGdWMDcU23jbrOhZnc7v3/qHB76DHEz5P7CoYXklF4Qw+OQNOpCDigyAQNi43enlbnM0wX64TOJqzsMTR63pd2WC7d1sddg2p5Nu9IEUfyJCwRPQ+I2BNwas6I9BCtk+fyMWRCQrPhQpGHu0HMfovo6hCKQabM3IWwCZom1wgvVqE9ZEhZS4w==;5:eGTjx6pPm8lwsqp6yVdfSXPGdYTAf9F71TeKi78o6pmlSph4z5LTeWRuZ5drRCwFWgofFzWBOLUuJRzklTObVOSxiulREVEgcvjbZylNP58g043Z0zPd6wkeQQE3tCFL3cFnJGSDMoiIms/6TPOQ1PQID2PZLdgHmeLRf9fChAErCznzrvkXaltT9qMFyVG+TI1Pv84qmQh4Shof5nBUNg==;7:WL4EHmklM6UKMDcjV3muyW+ZV9FEcBPleJEDnszjmNw5O6/S8AMUXm5I0rmEWn7Du5fWZ7gq2WN1tRQ/qQplCZsAQtWSd+qTZETw/fdnXRjG6CWER+hOCv55AmbRyC7YlYFoMxKRpuJAeRrxpTpcjA== x-ms-office365-filtering-correlation-id: 351c1547-00ba-4181-e170-08d67ff2c858 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB5983; x-ms-traffictypediagnostic: VI1PR04MB5983: x-microsoft-antispam-prvs: x-forefront-prvs: 0924C6A0D5 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(136003)(346002)(376002)(366004)(39860400002)(199004)(189003)(4326008)(99286004)(478600001)(71190400001)(71200400001)(76176011)(5024004)(256004)(52116002)(68736007)(6436002)(25786009)(6486002)(386003)(106356001)(53936002)(66066001)(50226002)(6506007)(36756003)(186003)(97736004)(102836004)(26005)(8676002)(305945005)(54906003)(11346002)(6512007)(8936002)(446003)(486006)(316002)(44832011)(6116002)(118296001)(110136005)(476003)(86362001)(2616005)(14454004)(2906002)(3846002)(81166006)(81156014)(7736002)(105586002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB5983;H:VI1PR04MB5533.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: v/aAnTqVn6dRzIP5LzBP0D8nr4IjG6kXT0+uHc612fC326H1s0UA8OSmS7rNFYdR5vX6ueAyV/LSPaJ1NM8cINBm2gVOc8vHL2etzUT+CZN0buF+e32fDKQqtE6JMtpaBTm9FAUWm+769qEhb+1s+aTcNUgzfO8ghL9ogpvtalo/dVG+3F4lQFr/EaKZITYjK79lcd5wk+JuCNxn/gQkVdHEvmxpxy04K2yBK89Y1dg4bdMsxj4Duflwm15f+Mdr3QhSWm4hqCdRuP9X2Yb7sg1ZkhNEhICWk5UNgRkKoNB6TDY/uzN1er5bvyRDSBC9pCHQ1PAy/ja+P7WgYCKMHA1PwKjHUp0SizGcpKxbg4Lt8GKpGwI4U69xVBvo59t8L36EhhNrqQHNkvuxLrAb4ilMduA2mS2OAMJf1Jxx5Qo= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 351c1547-00ba-4181-e170-08d67ff2c858 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2019 22:50:03.2450 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5983 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On chips without a separate power domain for PCI (such as 6q/6qp) the imx6_pcie_attach_pd function incorrectly returns an error. Fix by returning 0 if dev_pm_domain_attach_by_name doesn't find anything. Fixes: 3f7cceeab895 ("PCI: imx: Add multi-pd support") Reported-by: Lukas F.Hartmann Signed-off-by: Leonard Crestez --- drivers/pci/controller/dwc/pci-imx6.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 52e47dac028f..ac5f6ae0b254 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -308,10 +308,13 @@ static int imx6_pcie_attach_pd(struct device *dev) return 0; imx6_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie"); if (IS_ERR(imx6_pcie->pd_pcie)) return PTR_ERR(imx6_pcie->pd_pcie); + /* Do nothing when power domain missing */ + if (!imx6_pcie->pd_pcie) + return 0; link = device_link_add(dev, imx6_pcie->pd_pcie, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); if (!link) { From patchwork Mon Jan 21 22:50:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonard Crestez X-Patchwork-Id: 10774655 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 16E5A14E5 for ; Mon, 21 Jan 2019 22:50:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 085302A905 for ; Mon, 21 Jan 2019 22:50:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F09232A992; Mon, 21 Jan 2019 22:50:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0A742A905 for ; Mon, 21 Jan 2019 22:50:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726244AbfAUWuP (ORCPT ); Mon, 21 Jan 2019 17:50:15 -0500 Received: from mail-eopbgr130045.outbound.protection.outlook.com ([40.107.13.45]:22368 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727166AbfAUWuO (ORCPT ); Mon, 21 Jan 2019 17:50:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=79pfXeP5i6jnruNbkOwI/Y5CEkeP4ptLmQyPBOtIdk0=; b=ZxciCHebneHMQzg/rtu6CykYKbldYT9j/NSK/lDOZj4BgAP3JRcE6OXGp3l9tnvrZ0X8KJXged3QwWJ2OA6K60SncCRZQtuQLy3GXiii8+kxV7DPR1R4Inc2a9/Lp61xxZ0bsBhPEFe/Ggx3EzP8XXRgaCV7mZs+UoeqF5TqQTs= Received: from VI1PR04MB5533.eurprd04.prod.outlook.com (20.178.122.159) by VI1PR04MB5983.eurprd04.prod.outlook.com (20.178.123.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1537.27; Mon, 21 Jan 2019 22:50:05 +0000 Received: from VI1PR04MB5533.eurprd04.prod.outlook.com ([fe80::92d:bf44:9c1d:b907]) by VI1PR04MB5533.eurprd04.prod.outlook.com ([fe80::92d:bf44:9c1d:b907%6]) with mapi id 15.20.1537.031; Mon, 21 Jan 2019 22:50:05 +0000 From: Leonard Crestez To: Lorenzo Pieralisi , "Lukas F . Hartmann" , Lucas Stach CC: Ulf Hansson , Richard Zhu , Shawn Guo , "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "kernel@pengutronix.de" , dl-linux-imx Subject: [PATCH 2/2] PCI: imx: Fix checking pd_pcie_phy device_link Thread-Topic: [PATCH 2/2] PCI: imx: Fix checking pd_pcie_phy device_link Thread-Index: AQHUsdumLb5Dn4fO6kGAXVWrfR34gQ== Date: Mon, 21 Jan 2019 22:50:05 +0000 Message-ID: <8911de1e25f5c7d8ce328b623a980f2746787a87.1548110502.git.leonard.crestez@nxp.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [95.76.156.53] x-mailer: git-send-email 2.17.1 x-clientproxiedby: AM5PR0701CA0051.eurprd07.prod.outlook.com (2603:10a6:203:2::13) To VI1PR04MB5533.eurprd04.prod.outlook.com (2603:10a6:803:d2::31) authentication-results: spf=none (sender IP is ) smtp.mailfrom=leonard.crestez@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR04MB5983;6:7t1e3MKFsE9Qwoh3sFXV+q0u255YYvwKFEquvY49bdhZcTmFNZy0jSJldm2gsUuRiDlRQEcLiwXT/F5ZC3+iLJoAEQcUqZfkHTdrxtzy4HFPNN9EIw8TCAR/mVlGiEWUtHEXpd/33DRHh+vbgxYdmo9XXVRQaC53xO6PdPye11hDWpfgi0s6NYdByF88FCTi1Z9uOQAqhc1TavYyqfL13HfCQaBxf14ATWu2U+7DNK1RNsY2Q3mJ/tUTRfdrlmEbVZCAfhcjn8GtkgPKz35l1QVYY1yi0dgAoUAIyjbSPI2ESB00NPzKhRFsX/m5l3hGex53zBy0X09K2adotRbtX9EtZcGzBdJROmaQkrnYIv8UyBX+Xgynulcf9rVsZyctnMdC/kTuq6MQCAPJO2GAN5xxJ/cUMbB3N8qzghffVoyS15hEPsHvkxh9Xc4NrkDaLhU0MePefiynD1sI8Cv1OQ==;5:IaJNOlqgLgtrFT9QVog6MIU7VEma75FXNSXSezSGADQ68ksm+KCjx5c20FQNt/LF11EgWbOcPDBvAVwgkzztfPoKSDKwzuuQ6xUu7+5q3sYoPhBwK1W5m5bCZ2oOafrbWwke8uYOPnwgXU7NSXbBWLldwSsenuKFM/WgRWNJ+ajEM8E35ttBvERBUfwkTQ7H2O5838SbK8vJS+PM6o/IRA==;7:K1MHbGKsUM/3G7j5+jD80RALbO3tPFsEnr5Urc5usS8t0ziF7fUTrRaDIr+8vrwnLoFKBwtA7O1xJ07VXL5YBjCZF539ZM6FK8Zmentd0JyiljbFutrXgbS6oT/SEM2tJz8ItLAKkHaxovLxqHph/A== x-ms-office365-filtering-correlation-id: 1f072b45-2107-4a58-39bf-08d67ff2c8f7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB5983; x-ms-traffictypediagnostic: VI1PR04MB5983: x-microsoft-antispam-prvs: x-forefront-prvs: 0924C6A0D5 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(136003)(346002)(376002)(366004)(39860400002)(199004)(189003)(4326008)(99286004)(478600001)(71190400001)(71200400001)(76176011)(5024004)(256004)(52116002)(68736007)(6436002)(25786009)(6486002)(386003)(106356001)(53936002)(66066001)(50226002)(6506007)(36756003)(186003)(97736004)(102836004)(26005)(8676002)(305945005)(54906003)(11346002)(6512007)(8936002)(446003)(486006)(316002)(44832011)(6116002)(118296001)(110136005)(476003)(86362001)(2616005)(14454004)(2906002)(3846002)(81166006)(81156014)(7736002)(105586002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB5983;H:VI1PR04MB5533.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: tOXcUpF3ZqwXzXORk9TPPbqIgcERuafrXRoKshHuWYx3EqXd0N/AUi+wMSE1Q8pnbXYET9EeqIRsWcAPzpnmYI8iVF/QieNap+x74FrdkT0uVmyVW3Wyv5qw6UclHi5NV2kHyNDxNbru1IPuS4r8PfWf/KDv4H/4WpyaeVny3BVoBFiug3Fyn2wVv04z50CpN1yrm12U1EM455/sNOp5srVtl/2eA49GxSLYuzCJQFZ8x8lWCUoKb2/2C/fZvscWE2PzhAXExHRekTpUkcEYNmL4tMkJugUTDRsWfBXr0jT8jGOYqFW0HOi+IJwczQ42XrsRI7Io/f+IV5H8VEZBLzK8yU+372w77e8PY4zUdqBgAcTkLdQJ/3eynqt87AdEerktifTgu+fpkKYidDA8PySbvjt08jVIBJiPh5Emfuw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f072b45-2107-4a58-39bf-08d67ff2c8f7 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2019 22:50:04.2827 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5983 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This check was completely wrong. It doesn't break anything specific because adding the second device_link can't fail. Fixes: 3f7cceeab895 ("PCI: imx: Add multi-pd support") Signed-off-by: Leonard Crestez --- drivers/pci/controller/dwc/pci-imx6.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index ac5f6ae0b254..80f843030e36 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -324,17 +324,17 @@ static int imx6_pcie_attach_pd(struct device *dev) imx6_pcie->pd_pcie_phy = dev_pm_domain_attach_by_name(dev, "pcie_phy"); if (IS_ERR(imx6_pcie->pd_pcie_phy)) return PTR_ERR(imx6_pcie->pd_pcie_phy); - device_link_add(dev, imx6_pcie->pd_pcie_phy, + link = device_link_add(dev, imx6_pcie->pd_pcie_phy, DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); - if (IS_ERR(link)) { - dev_err(dev, "Failed to add device_link to pcie_phy pd: %ld\n", PTR_ERR(link)); - return PTR_ERR(link); + if (!link) { + dev_err(dev, "Failed to add device_link to pcie_phy pd.\n"); + return -EINVAL; } return 0; }