From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752221AbcBMBLh (ORCPT ); Fri, 12 Feb 2016 20:11:37 -0500 Received: from quartz.orcorp.ca ([184.70.90.242]:48562 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751950AbcBMBLg (ORCPT ); Fri, 12 Feb 2016 20:11:36 -0500 Date: Fri, 12 Feb 2016 18:11:30 -0700 From: Jason Gunthorpe To: Stefan Berger Cc: Jarkko Sakkinen , linux-kernel@vger.kernel.org, Peter Huewe , tpmdd-devel@lists.sourceforge.net Subject: Re: [PATCH 2/3] tpm: Get rid of chip->pdev Message-ID: <20160213011130.GA2547@obsidianresearch.com> References: <1455321871-28296-1-git-send-email-jgunthorpe@obsidianresearch.com> <1455321871-28296-3-git-send-email-jgunthorpe@obsidianresearch.com> <201602130037.u1D0bDEN029756@d01av04.pok.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201602130037.u1D0bDEN029756@d01av04.pok.ibm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.160 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 12, 2016 at 07:37:10PM -0500, Stefan Berger wrote: > Jason Gunthorpe wrote on 02/12/2016 > 07:04:30 PM: > > > > This is a hold over from before the struct device conversion. > > > > - All prints should be using &chip->dev, which is the Linux > > standard. This changes prints to use tpm0 as the device name, > > not the PnP/etc ID. > > - The few places involving sysfs/modules that really do need the > > parent just use chip->dev.parent instead > > - We no longer need to get_device(pdev) in any places since it is no > > longer used by any of the code. The kref on the parent is held > > by the device core during device_add and dropped in device_del > That is exactly what was needed for the vtpm driver and now you're > removing it. Is that still going to work after this change? Or do we > need to re-add it as get/put_device(chip->dev.parent) ? That code was not correct, the get_device side has racy lack-of-locking problems and it serves no purpose for the tpm core or any existing driver. I already fixed this once in commit ba0ef85479c46a 'tpm: Fix initialization of the cdev' - that solves the racing of get_device, and grabs the correct device kref, but I forgot to delete the broken residual get_device. Sigh. It is unfortunate that bogus code sent you down this rabbit hole. My bad :( I'll send you something else that might work for vtpm... Jason