Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753435AbcDTFeO (ORCPT ); Wed, 20 Apr 2016 01:34:14 -0400 Received: from mga01.intel.com ([192.55.52.88]:52187 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751767AbcDTFeM (ORCPT ); Wed, 20 Apr 2016 01:34:12 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,508,1455004800"; d="scan'208";a="88424455" Date: Wed, 20 Apr 2016 08:33:41 +0300 From: Jarkko Sakkinen To: Jason Gunthorpe Cc: Stefan Berger , tpmdd-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v11 1/4] tpm: Remove all uses of drvdata from the TPM Core Message-ID: <20160420053341.GA10438@intel.com> References: <1461000376-2888-1-git-send-email-stefanb@linux.vnet.ibm.com> <1461000376-2888-2-git-send-email-stefanb@linux.vnet.ibm.com> <20160419101214.GA11574@intel.com> <57160A26.5040805@linux.vnet.ibm.com> <20160419170645.GA20844@obsidianresearch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160419170645.GA20844@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 Content-Length: 1914 Lines: 40 On Tue, Apr 19, 2016 at 11:06:45AM -0600, Jason Gunthorpe wrote: > On Tue, Apr 19, 2016 at 06:36:22AM -0400, Stefan Berger wrote: > > On 04/19/2016 06:12 AM, Jarkko Sakkinen wrote: > > >On Mon, Apr 18, 2016 at 01:26:13PM -0400, Stefan Berger wrote: > > >>From: Jason Gunthorpe > > >> > > >>The final thing preventing this was the way the sysfs files were > > >>attached to the pdev. Follow the approach developed for ppi and move > > >>the sysfs files to the chip->dev with symlinks from the pdev > > >>for compatibility. Everything in the core now sanely uses container_of > > >>to get the chip. > > >Can you give me a quick recap why this patch was mandatory to make the > > >patch set work? Which regression in the earlier versions of the patch > > >set this fixes? > > > > The below patch removes usage of dev_get_drvdata() for retrieving the chip. > > With Christophe's series dropping the priv field I now can use the drvdata > > to store proxy_dev rather than re-introducing the priv field in the chip > > structure. Besides that it doesn't seem necessary to use the drvdata field > > to get from the chip to the device if a simple container_of can do it. > > More specifically, since the vtpm patches use a NULL parent, the > approach of putting the sysfs files on the parent is no longer > workable. > > The early vtpm patches simply moved the sysfs files to the tpm_chip > when a parent is NULL, which is inconsistent for userspace. This also > created a problem where drvdata on the chip now had to point back to > the chip, meaning it became unusable for its new intended purpose. > > The fix is to make everything uniform and put the sysfs files in the > correct place for all drivers (under the chip) and use symlinks for > compat. OK, thanks for explaining this, make perfect sense now. I'll do a more detailed review (and testing) later on. > Jason /Jarkko