From patchwork Wed May 3 21:26:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 9710441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 19F8F6021C for ; Wed, 3 May 2017 21:26:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0936128650 for ; Wed, 3 May 2017 21:26:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1EB028663; Wed, 3 May 2017 21:26:21 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 63CE328660 for ; Wed, 3 May 2017 21:26:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1d61mu-0004zr-7Y; Wed, 03 May 2017 21:26:20 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1d61ms-0004zm-RZ for tpmdd-devel@lists.sourceforge.net; Wed, 03 May 2017 21:26:18 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of obsidianresearch.com designates 184.70.90.242 as permitted sender) client-ip=184.70.90.242; envelope-from=jgunthorpe@obsidianresearch.com; helo=quartz.orcorp.ca; Received: from quartz.orcorp.ca ([184.70.90.242]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) id 1d61mp-0003jh-AV for tpmdd-devel@lists.sourceforge.net; Wed, 03 May 2017 21:26:18 +0000 Received: from [10.0.0.156] (helo=jggl.edm.orcorp.ca) by quartz.orcorp.ca with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1d61mg-0006R3-3L; Wed, 03 May 2017 15:26:06 -0600 Received: from jgg by jggl.edm.orcorp.ca with local (Exim 4.86_2) (envelope-from ) id 1d61mg-00089t-0o; Wed, 03 May 2017 15:26:06 -0600 Date: Wed, 3 May 2017 15:26:05 -0600 From: Jason Gunthorpe To: Jerry Snitselaar Message-ID: <20170503212605.GA26863@obsidianresearch.com> References: <20170503164857.GA20369@obsidianresearch.com> <20170503210159.ook77o4myjebl4xr@rhwork> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170503210159.ook77o4myjebl4xr@rhwork> User-Agent: Mutt/1.5.24 (2015-08-30) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.156 X-Headers-End: 1d61mp-0003jh-AV Cc: tpmdd-devel@lists.sourceforge.net, rafael@kernel.org Subject: Re: [tpmdd-devel] [PATCH] tpm_ts: Consolidate the platform and acpi probe flow X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces@lists.sourceforge.net X-Virus-Scanned: ClamAV using ClamSMTP On Wed, May 03, 2017 at 02:01:59PM -0700, Jerry Snitselaar wrote: > I haven't had a chance to dig into it yet, but I'm seeing this with the patch on top of tpmdd/next: > > [ 1.041046] tpm_tis MSFT0101:00: 2.0 TPM (device-id 0x1A, rev-id 16) > [ 1.293032] genirq: Flags mismatch irq 9. 00000000 (tpm0) vs. 00000080 (acpi) Hum. I think this means that res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); Did not return the IRQ for the TPM when the platform device matched via ACPI? Can you confirm that? I see there is a bug here, and it should be using platform_get_irq.. I think this incremental patch will make the driver load for you. However, can you confirm that same IRQ setting (eg no IRQ) is selected before/after this patch? >From 233d05aad66cbb828892f65b4dd722f3a7042241 Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Wed, 3 May 2017 15:24:32 -0600 Subject: [PATCH] tpm_tis: Use platform_get_irq Replace the open coded IORESOURCE_IRQ with platform_get_irq, which supports more cases. This also fixes a typo with force mode - IRQ autoprobing was being turned on for failure to get an IRQ in normal mode, which is backwards to the comment and intent. Signed-off-by: Jason Gunthorpe --- drivers/char/tpm/tpm_tis.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index ddad56a4a958f1..54d90e31a7b690 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c @@ -284,11 +284,9 @@ static int tpm_tis_plat_probe(struct platform_device *pdev) } tpm_info.res = *res; - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (res) { - tpm_info.irq = res->start; - } else { - if (pdev == force_pdev) + tpm_info.irq = platform_get_irq(pdev, 0); + if (tpm_info.irq <= 0) { + if (pdev != force_pdev) tpm_info.irq = -1; else /* When forcing auto probe the IRQ */