Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4173941pxb; Mon, 27 Sep 2021 10:54:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/RK1I+FLiAHQlLkMCmJc+6Ut2uiAiPsbPQS79sTtBQ2cmh65nxhd0DFXwXahvWbWat5wL X-Received: by 2002:a17:902:c245:b0:13e:2254:d3d6 with SMTP id 5-20020a170902c24500b0013e2254d3d6mr1222609plg.52.1632765279370; Mon, 27 Sep 2021 10:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632765279; cv=none; d=google.com; s=arc-20160816; b=sqEw4NVtBvZwLQSA+HGj8X6wsk+SU96oEfKKDreQ01FJ3gzS4OsYigUgyXeQdTYB1l MLITNVIdw3heFX9QYX0bHDJkGxIdtlLetoIMGVxFdjkW0AJyS008q/7AqI+qvfCaOEsJ D8WG1HeJcAsn6RmuSj0cUpWjoDULftsak5Jk0RXeHHtpUEeeuNcnpNmqVzT0o/uA+4z0 IVxUfJ2IQgnoAncmVlOEAQN8Ab4343iSSz1BVA2VdZcQ7Emn7nFMankTC7V8BRlRQLQe Cr9SI69PuBWn7aCxRb6vXMcCnFDLF2NT2+Al4ORA7MoGtPMfYy1bT8gq8GFkC6QR1Zm8 yXIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:reply-to :from:subject:message-id; bh=5+Wv8hUnXx2wiTtz87eTnvSV1DvadV8LhU+KeKoVDAc=; b=XBpgTVyhpY1Rk5+9QNOagziUgbasg6ENtwr6+UcMw40pLDD7AA/S5J+I0A4Y76o2pJ T9r5dauCQ0teBh3rkAsnAFP/TqdxJV/kFfbT0a/blPJQAbVmuGD2ssRRuuK3UikUNIv0 bKse444k8rE+P6kfAn0fdKvdWovuyNWwL9Nq81LF8n4C+4Xj0bDem3p/1abzaQERxafM POAKGMMagmlUWaVY6/3bBzNf+jsWhg87GU4bLrnRSdEGUq27/TKQ21qKzN5CzYRQJ2yj jPO6XZOzQKojadcxllyAUiFMO/qryp/JRZk1HR/fdgHyPgjlZzpy6Iq9Yn3D11KgQDUm WOCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si1835459pfb.92.2021.09.27.10.54.26; Mon, 27 Sep 2021 10:54:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235844AbhI0Ryy (ORCPT + 99 others); Mon, 27 Sep 2021 13:54:54 -0400 Received: from mga07.intel.com ([134.134.136.100]:49997 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235703AbhI0Ryr (ORCPT ); Mon, 27 Sep 2021 13:54:47 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10120"; a="288190732" X-IronPort-AV: E=Sophos;i="5.85,327,1624345200"; d="scan'208";a="288190732" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2021 10:53:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,327,1624345200"; d="scan'208";a="456328547" Received: from linux.intel.com ([10.54.29.200]) by orsmga002.jf.intel.com with ESMTP; 27 Sep 2021 10:53:09 -0700 Received: from debox1-desk1.jf.intel.com (debox1-desk1.jf.intel.com [10.54.75.53]) by linux.intel.com (Postfix) with ESMTP id 66BCA5802BD; Mon, 27 Sep 2021 10:53:09 -0700 (PDT) Message-ID: <10bee4a609c48b8e10458c25755f17222c43c33c.camel@linux.intel.com> Subject: Re: [PATCH 2/2] platform/x86: Add Intel Software Defined Silicon driver From: "David E. Box" Reply-To: david.e.box@linux.intel.com To: Greg KH Cc: lee.jones@linaro.org, hdegoede@redhat.com, mgross@linux.intel.com, andriy.shevchenko@linux.intel.com, srinivas.pandruvada@intel.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Date: Mon, 27 Sep 2021 10:53:09 -0700 In-Reply-To: References: <20210924213157.3584061-1-david.e.box@linux.intel.com> <20210924213157.3584061-2-david.e.box@linux.intel.com> <3392aea6b112926b063bbe46b1decaad4c9f9e6e.camel@linux.intel.com> Organization: David E. Box Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-09-27 at 06:03 +0200, Greg KH wrote: > On Sun, Sep 26, 2021 at 06:15:16PM -0700, David E. Box wrote: > > > > +static int sdsi_remove(struct platform_device *pdev) > > > > +{ > > > > +       struct sdsi_priv *priv = platform_get_drvdata(pdev); > > > > + > > > > +       priv->dev_present = false; > > > > +       sysfs_remove_bin_file(&priv->pdev->dev.kobj, &priv->registers_bin_attr); > > > > +       misc_deregister(&priv->miscdev); > > > > +       kref_put(&priv->kref, sdsi_priv_release); > > > > > > Why do you need a kref for a structure that already can be controlled by > > > a different lifetime rule? > > > > Which rule am I missing? This kref allows the structure to remain in case the device is removed > > while the file is open. > > This device is on a hardware bus that allows removal? Well the device can be unbound. A test case covers this. > > Anyway, you now are dealing with lifetime rules of 3 structures all at > once, and the interactions between them is not very obvious.  It would > probably be simpler just to stick with 2, right?  You really only care > about the misc structure here. In the case that the device is unbound, both the pdev and miscdev go away. Something has to outlive them in order to handle any open files still trying to use the ioctl. David > > thanks, > > greg k-h