Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753977AbXJKXe3 (ORCPT ); Thu, 11 Oct 2007 19:34:29 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752648AbXJKXeW (ORCPT ); Thu, 11 Oct 2007 19:34:22 -0400 Received: from mga11.intel.com ([192.55.52.93]:22267 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752450AbXJKXeV (ORCPT ); Thu, 11 Oct 2007 19:34:21 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.21,261,1188802800"; d="scan'208";a="170124318" X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C80C5F.25B8B407" Subject: RE: TPM driver changes to support multiple locality Date: Thu, 11 Oct 2007 16:33:36 -0700 Message-ID: In-Reply-To: <20071011160221.87f77c61.randy.dunlap@oracle.com> X-MS-Has-Attach: yes X-MS-TNEF-Correlator: Thread-Topic: TPM driver changes to support multiple locality Thread-Index: AcgMWuayc76pXWlNSleAG87w4tTQvAAAIS6g References: <27383.1192045583@turing-police.cc.vt.edu><20071011115429.92326cbd.randy.dunlap@oracle.com><20071011143917.0eb75029.randy.dunlap@oracle.com> <20071011160221.87f77c61.randy.dunlap@oracle.com> From: "Agarwal, Lomesh" To: "Randy Dunlap" Cc: , X-OriginalArrivalTime: 11 Oct 2007 23:33:37.0865 (UTC) FILETIME=[25FA5B90:01C80C5F] Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 10728 Lines: 191 This is a multi-part message in MIME format. ------_=_NextPart_001_01C80C5F.25B8B407 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable -----Original Message----- From: Randy Dunlap [mailto:randy.dunlap@oracle.com]=20 Sent: Thursday, October 11, 2007 4:02 PM To: Agarwal, Lomesh Cc: Valdis.Kletnieks@vt.edu; linux-kernel@vger.kernel.org Subject: Re: TPM driver changes to support multiple locality On Thu, 11 Oct 2007 15:46:03 -0700 Agarwal, Lomesh wrote: > Attached is the patch which resolves all the comments. Inline patches are preferred so that reviewers can comment on them more easily. What mail client are you using? [Agarwal, Lomesh] I am using MS Outlook. Earlier you said inline patches have problem because of mail client. That's why I sent it as attachment. The patch has trailing CRs on each line ("DOS mode"). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Just verifying: this TPM device has interrupts per locality? + /* check if interrupt is meant for this locality */ + if (check_locality(chip, locality) < 0) + return IRQ_NONE; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Agarwal, Lomesh] TPM device has only one interrupt. so on receiving interrupt driver has to make sure that its meant for its locality. init_tis() still seems to have some problems. static int __init init_tis(void) { +#define DEVNAME_SIZE 10 + int rc; =20 + if ((locality < 0) || (locality > 4)) + return PTR_ERR(pdev); pdev hasn't been set (so it's NULL). + pdev =3D platform_device_register_simple(devname, -1, NULL, 0); + if (IS_ERR(pdev)) return PTR_ERR(pdev); Error path above needs to call driver_unregister(). [Agarwal, Lomesh] attached is the new patch. --- ~Randy ------_=_NextPart_001_01C80C5F.25B8B407 Content-Type: application/octet-stream; name="tpm_tis.c.patch" Content-Transfer-Encoding: base64 Content-Description: tpm_tis.c.patch Content-Disposition: attachment; filename="tpm_tis.c.patch" QWRkaW5nIHN1cHBvcnQgZm9yIG11bHRpcGxlIGxvY2FsaXRpZXMgaW4gdHBtIGRyaXZlcgp0aGlz IGRyaXZlciBjYW4gYmUgaW5zdGF0aWF0ZWQgd2l0aCBhIGxvY2FsaXR5IHBhcmFtZXRlciBhbmQg dGhhdCBpbnN0YW5jZQp3aWxsIG9wZXJhdGUgb24gZ2l2ZW4gbG9jYWxpdHkuCkJ5IGRlZmF1bHQg aXQgd29ya3Mgb24gbG9jYWxpdHkgMApTaWduZWQtb2ZmLWJ5OiB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lkcml2ZXJfdW5yZWdpc3RlcigmdGlzX2Rydik7CiAJCQlyZXR1cm4gUFRSX0VS UihwZGV2KTsKKwkJfQogCQlpZigocmM9dHBtX3Rpc19pbml0KCZwZGV2LT5kZXYsIDAsIDApKSAh PSAwKSB7CiAJCQlwbGF0Zm9ybV9kZXZpY2VfdW5yZWdpc3RlcihwZGV2KTsKIAkJCWRyaXZlcl91 bnJlZ2lzdGVyKCZ0aXNfZHJ2KTsKKwkJCWtmcmVlKGRldm5hbWUpOwogCQl9CiAJCXJldHVybiBy YzsKIAl9CkBAIC02OTIsNiArNzI0LDcgQEAgc3RhdGljIHZvaWQgX19leGl0IGNsZWFudXBfdGlz KHZvaWQpCiAJaWYgKGZvcmNlKSB7CiAJCXBsYXRmb3JtX2RldmljZV91bnJlZ2lzdGVyKHBkZXYp OwogCQlkcml2ZXJfdW5yZWdpc3RlcigmdGlzX2Rydik7CisJCWtmcmVlKGRldm5hbWUpOwogCX0g ZWxzZQogCQlwbnBfdW5yZWdpc3Rlcl9kcml2ZXIoJnRpc19wbnBfZHJpdmVyKTsKIH0K ------_=_NextPart_001_01C80C5F.25B8B407-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/