From patchwork Mon Dec 4 17:39:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 10091185 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 C683E60327 for ; Mon, 4 Dec 2017 17:39:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2B2A287A5 for ; Mon, 4 Dec 2017 17:39:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A76E928DAB; Mon, 4 Dec 2017 17:39:23 +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 vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A2FF287A5 for ; Mon, 4 Dec 2017 17:39:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751756AbdLDRjW (ORCPT ); Mon, 4 Dec 2017 12:39:22 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:35856 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751349AbdLDRjW (ORCPT ); Mon, 4 Dec 2017 12:39:22 -0500 Received: by mail-wr0-f193.google.com with SMTP id v105so18185759wrc.3 for ; Mon, 04 Dec 2017 09:39:21 -0800 (PST) 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=dFFU/EOm+9nmCbYUY6sKuIFCzatmWp/jwhKV5qPssA0=; b=FBX+Kg+pcBqTGtD+AE7gEB64szpsU9gWtrXKLETAf3lU0klpcr2S2TrOlKeIDge0pt n49SyT98RIibY3xvJ7o1/DeZ9qZe0Wu2+cE/5v85tOnX9ej+DML5G73lIAQQMHt1DDS/ 3C3h6wk0Hx6iVshlZ/RDefzgvK6e4XBnQGRUbjTX9N1o9JRcbDyckcL7cvwl/8Pd8wpU +LL8qvwbLi2G6mHYV3PTK9PwBa2PeavdT5cQhiU1XhkaSifIeAY96iYNISladte+sLaJ N8uwDLYf+aVjvxs5ri1XdCyFaVnt/BKoWGcGOk3VRJz1XxVEx9V+HAEVZoULHWC8YfDp 7szw== X-Gm-Message-State: AJaThX6sM5BYr+4qmhShggrfejhBNdf0ZWwlN8PukYby0o2M81FrLV0Z pjx5IxT+E994VVUyaaWrbk66pA== X-Google-Smtp-Source: AGs4zMYTnDNoss1eOzDucVVKS19yf30tkGkf52aUEs90wAN3fq/sDa6tUlYDPfo1GejPVu2grrNHBQ== X-Received: by 10.223.147.133 with SMTP id 5mr13335728wrp.230.1512409161022; Mon, 04 Dec 2017 09:39:21 -0800 (PST) Received: from minerva.redhat.com ([149.6.131.75]) by smtp.gmail.com with ESMTPSA id k19sm16201073wrk.88.2017.12.04.09.39.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Dec 2017 09:39:20 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Javier Martinez Canillas , Jason Gunthorpe , linux-integrity@vger.kernel.org, Peter Huewe , Jarkko Sakkinen Subject: [PATCH] tpm: remove type and name fields from the I2C Infineon OF table entries Date: Mon, 4 Dec 2017 18:39:16 +0100 Message-Id: <20171204173916.4874-1-javierm@redhat.com> X-Mailer: git-send-email 2.14.3 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 The commit 21dc02eab989 ("tpm/tpm_i2c_infineon.c: Add OF attributes type and name to the of_device_id table entries") added type and name fields to the OF device ID table entries for the I2C Infineon TPM driver. The only justification for the change in the commit message is that it's probably a good idea to have these fields populated in the OF entries. But I don't think that's true. In fact, I believe that's not correct to add these fields for the following reasons: * The struct of_device_id .type field matches the device_type property in the Device Tree nodes. The ePAPR document says that new use of the property is deprecated and should only be included in cpu and memory nodes for compatibility with the IEEE 1275-derived Device Trees. Also, mainline Device Tree source files don't include this property in the TPM nodes defined. * The struct of_device_id .name field matches the Device Tree node name but the ePAPR document says that the node name should be generic and reflect the function of the device, not it's programming model. So in the case of TPM chips, it should just be "tpm" but the name fields are set in the OF table entries to the actual device model (i.e: slb9645tt). Now, from a practical point of view this means that the OF module aliases for the supported devices include the name and type of the device entries: $ modinfo drivers/char/tpm/tpm_i2c_infineon.ko | grep alias alias: of:Nslb9645ttTtpm*Cinfineon,slb9645ttC* alias: of:Nslb9645ttTtpm*Cinfineon,slb9645tt alias: of:Nslb9635ttTtpm*Cinfineon,slb9635ttC* alias: of:Nslb9635ttTtpm*Cinfineon,slb9635tt alias: of:Ntpm_i2c_infineonTtpm*Cinfineon,tpm_i2c_infineonC* alias: of:Ntpm_i2c_infineonTtpm*Cinfineon,tpm_i2c_infineon But since the device_type isn't set in the tpm DT nodes and the node name is a generic one, the reported MODALIAS when a device is registered via OF won't match the driver's module aliases: $ cat /sys/class/tpm/tpm0/device/modalias of:NtpmTCinfineon,slb9645tt So remove these fields from the OF entries to allow the module aliases to match the MODALIAS reported by the kernel when the device is registered: $ modinfo drivers/char/tpm/tpm_i2c_infineon.ko | grep alias alias: of:N*T*Cinfineon,slb9645ttC* alias: of:N*T*Cinfineon,slb9645tt alias: of:N*T*Cinfineon,slb9635ttC* alias: of:N*T*Cinfineon,slb9635tt alias: of:N*T*Cinfineon,tpm_i2c_infineonC* alias: of:N*T*Cinfineon,tpm_i2c_infineon Signed-off-by: Javier Martinez Canillas Reviewed-by: Jason Gunthorpe Reviewed-by: Jarkko Sakkinen --- drivers/char/tpm/tpm_i2c_infineon.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c index 79d6bbb58e39..005c38879b2e 100644 --- a/drivers/char/tpm/tpm_i2c_infineon.c +++ b/drivers/char/tpm/tpm_i2c_infineon.c @@ -675,24 +675,9 @@ MODULE_DEVICE_TABLE(i2c, tpm_tis_i2c_table); #ifdef CONFIG_OF static const struct of_device_id tpm_tis_i2c_of_match[] = { - { - .name = "tpm_i2c_infineon", - .type = "tpm", - .compatible = "infineon,tpm_i2c_infineon", - .data = (void *)0 - }, - { - .name = "slb9635tt", - .type = "tpm", - .compatible = "infineon,slb9635tt", - .data = (void *)0 - }, - { - .name = "slb9645tt", - .type = "tpm", - .compatible = "infineon,slb9645tt", - .data = (void *)1 - }, + { .compatible = "infineon,tpm_i2c_infineon", .data = (void *)0 }, + { .compatible = "infineon,slb9635tt", .data = (void *)0 }, + { .compatible = "infineon,slb9645tt", .data = (void *)1 }, {}, }; MODULE_DEVICE_TABLE(of, tpm_tis_i2c_of_match);