From patchwork Fri Jun 8 07:09:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10453909 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 604ED60234 for ; Fri, 8 Jun 2018 07:09:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41A8229258 for ; Fri, 8 Jun 2018 07:09:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3433229294; Fri, 8 Jun 2018 07:09:13 +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 D913C29258 for ; Fri, 8 Jun 2018 07:09:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751079AbeFHHJM (ORCPT ); Fri, 8 Jun 2018 03:09:12 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:39613 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751088AbeFHHJM (ORCPT ); Fri, 8 Jun 2018 03:09:12 -0400 Received: by mail-lf0-f65.google.com with SMTP id t134-v6so18463895lff.6 for ; Fri, 08 Jun 2018 00:09:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=7ufeYXe1RUx7TjN/VLEab6FN45XgNp8ZFi9G7WbGHnU=; b=BuKZD/bwyil78zYLMyLvIugDKWXzKddQH3viIjKaYuj/N7rjhITWi315Tz4BC9vPOk btgByQT3TrDEUpKox1hCSqG4jT0GR7geIZDMuo2UYK8vG4vX4m1Cq8bQ/P5WB/ER/gGA Xn3lyH53s4JMSJ+Xz1dpUZdpwpEti5sL1lfwM= 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; bh=7ufeYXe1RUx7TjN/VLEab6FN45XgNp8ZFi9G7WbGHnU=; b=J9gZWo3GeSvi48iGUWnWBxCvTrT40BbNOiXncAK6mygn4jlugGo8vsCHjOzH2Y8u4S QDViYyPM4ku4q2p7MAWfB4M2K/3NsGZ3cb6adNIopLHGB6nwBea0JDipQehhrmvdunl8 WKqo7FBk8Y34CfflKal/ILqoKBMn2xMGugzguDeQnMke9jPQ/COu6YCe4ac2Rr9sNzNu rjjztAmATfpNlM0JzTt9RgaG2Mgxl+UghT6MjMWxbDUpgzOK5csU92CF/Q2qnYW+7AMK 8ND6bqvfaeGMtVBzFN2ReA5SBqRVLDR2BO2tLS5n3KYOhTB5jH7TLEkU2qlcbQ2oOn+r 6n4Q== X-Gm-Message-State: APt69E3smonJ9U+lhj/ASuX9ZT+BJcgYjNPVaZjgmIx+jkplSnwb4Cjf NxP2Mx8OaO/6hlUPQ+d4TFgMWw== X-Google-Smtp-Source: ADUXVKIZOxKilpQLg5QjYwA6EmDdW//a5pF+6u+wXANu9pT9sIrnh/jok29GE4e0MCYpc4xMSKrY7A== X-Received: by 2002:a2e:2b1b:: with SMTP id q27-v6mr3531037lje.145.1528441750812; Fri, 08 Jun 2018 00:09:10 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id p5-v6sm11961808ljh.3.2018.06.08.00.09.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Jun 2018 00:09:09 -0700 (PDT) From: Linus Walleij To: Peter Huewe , Jarkko Sakkinen , Jason Gunthorpe Cc: linux-integrity@vger.kernel.org, Linus Walleij , Mark Brown Subject: [PATCH] tpm_tis_spi: Pass the SPI IRQ down to the driver Date: Fri, 8 Jun 2018 09:09:07 +0200 Message-Id: <20180608070907.15185-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.0 Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP An SPI TPM device managed directly on an embedded board using the SPI bus and some GPIO or similar line as IRQ handler will pass the IRQn from the TPM device associated with the SPI device. This is already handled by the SPI core, so make sure to pass this down to the core as well. (The TPM core habit of using -1 to signal no IRQ is dubious (as IRQ 0 is NO_IRQ) but I do not want to mess with that semantic in this patch.) Cc: Mark Brown Signed-off-by: Linus Walleij Reviewed-by: Jarkko Sakkinen --- drivers/char/tpm/tpm_tis_spi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c index 424ff2fde1f2..9914f6973463 100644 --- a/drivers/char/tpm/tpm_tis_spi.c +++ b/drivers/char/tpm/tpm_tis_spi.c @@ -199,6 +199,7 @@ static const struct tpm_tis_phy_ops tpm_spi_phy_ops = { static int tpm_tis_spi_probe(struct spi_device *dev) { struct tpm_tis_spi_phy *phy; + int irq; phy = devm_kzalloc(&dev->dev, sizeof(struct tpm_tis_spi_phy), GFP_KERNEL); @@ -211,7 +212,13 @@ static int tpm_tis_spi_probe(struct spi_device *dev) if (!phy->iobuf) return -ENOMEM; - return tpm_tis_core_init(&dev->dev, &phy->priv, -1, &tpm_spi_phy_ops, + /* If the SPI device has an IRQ then use that */ + if (dev->irq > 0) + irq = dev->irq; + else + irq = -1; + + return tpm_tis_core_init(&dev->dev, &phy->priv, irq, &tpm_spi_phy_ops, NULL); }