From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754903AbcIEFom (ORCPT ); Mon, 5 Sep 2016 01:44:42 -0400 Received: from mga02.intel.com ([134.134.136.20]:37970 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753038AbcIEFok (ORCPT ); Mon, 5 Sep 2016 01:44:40 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,285,1470726000"; d="scan'208";a="1045710720" Date: Mon, 5 Sep 2016 08:44:34 +0300 From: Jarkko Sakkinen To: Jason Gunthorpe Cc: Peter Huewe , Marcel Selhorst , "moderated list:TPM DEVICE DRIVER" , open list Subject: Re: [PATCH] tpm: move struct tpm_class_ops to drivers/char/tpm/tpm.h Message-ID: <20160905054434.GB5712@intel.com> References: <1472852886-7640-1-git-send-email-jarkko.sakkinen@linux.intel.com> <20160902221122.GA1897@obsidianresearch.com> <20160902223522.GA27454@intel.com> <20160902224531.GC1897@obsidianresearch.com> <20160903062221.GA2061@intel.com> <20160903062605.GB2061@intel.com> <20160904201406.GA9854@obsidianresearch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160904201406.GA9854@obsidianresearch.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 04, 2016 at 02:14:06PM -0600, Jason Gunthorpe wrote: > On Sat, Sep 03, 2016 at 09:26:05AM +0300, Jarkko Sakkinen wrote: > > > > > > OK, how would one get the chip instance? > > Most subsystems have a get function that returns a kref'd pointer. For > TPM all we really need today is a 'get_default_tpm_for_ns' kind of > function. Sorry, but I have no idea what you are talking about. This does not imply that these structure definitions need to be in include/linux/tpm.h since you are talking something that does not exist. > > This still doesn't explain why moving the structures inside the driver > > would be wrong. Even if outside callers would use a pointer the > > structure could be opaque. > > For instance, if we did a get function then the 'put' function would > be an inline around dev_put and that needs to see inside the chip. I do not see any get/put functionality in include/linux/tpm.h. > This is a well trodden pattern in the kernel, there is no reason to do > something different for tpm. /Jarkko