From patchwork Fri Jun 8 07:02:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10453899 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 73AEF601D4 for ; Fri, 8 Jun 2018 07:02:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52A8E29346 for ; Fri, 8 Jun 2018 07:02:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44EAF29344; Fri, 8 Jun 2018 07:02:25 +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 DC4CA29344 for ; Fri, 8 Jun 2018 07:02:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751140AbeFHHCY (ORCPT ); Fri, 8 Jun 2018 03:02:24 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:45414 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751027AbeFHHCX (ORCPT ); Fri, 8 Jun 2018 03:02:23 -0400 Received: by mail-lf0-f68.google.com with SMTP id n3-v6so18410647lfe.12 for ; Fri, 08 Jun 2018 00:02:23 -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=Iwn9ITjp4uwYygd5vl7JxOAPUjcu2lvTjZGuGtjzrWpOjWZLU9YQlOjV/kTIbC1Mnf vBFSO33/6/bzS/E0A6gk1uWHOnt2KxtV/Q53PFAP+cafZGSqYMZXe9YbfdbCxU75mjlg CXhW5pX2YKR6GnK8rJtN7y4zkjGDZK7rRnZfU= 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=JJAy1hPa1x1TdnL2Kn0plDzHCaLlzsXqvTjQL7Kw857jKFliDHWfHSHhr9P7Mg0/si QigrNCtrWBo4GPF50E9fEyx/bAMGGcN8Xz7HG4+LtW3bQ0SHS1wF+n72gafJuVKba5RL uL6G6VnzqpoEBWsAX8a6+6TYR19KA8Nn8BZMzzW0x3udVEK/ju1Nz4OYUFCkvx2y+eK0 E5c2J+bGIcfJiPW03qOJwaOmQLJVExXqqrv3ytfFindYJj2jwq7ltSz0tTESCCsyk9g2 4rrcGloRYn0ZEg/PsdMgHmWhoWqrL7NjcRg6L7I65W90clOc5y5z4athya/cMKGPy+ux uROg== X-Gm-Message-State: APt69E0knycrebjKFAu3FHzJEIZ6y1eJrDXqWfM8J3HuhbX1JkA1Dcq/ 8duytCQFI+MOYWv2QCbIUZ19qBWfNBs= X-Google-Smtp-Source: ADUXVKKYO+YOjikqJw3vCikcK1Wuc9EVaKnECDz1Xp0Md0u/dTdETdANW28kzA20zXpqs98Alq5tJg== X-Received: by 2002:a2e:878f:: with SMTP id n15-v6mr3526535lji.69.1528441342470; Fri, 08 Jun 2018 00:02:22 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l20-v6sm2138674lfg.14.2018.06.08.00.02.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Jun 2018 00:02:20 -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:02:09 +0200 Message-Id: <20180608070209.14769-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 --- 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); }