Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2541245ybc; Mon, 18 Nov 2019 00:15:45 -0800 (PST) X-Google-Smtp-Source: APXvYqzfVutSxlDGmg6pCg0++s1h5xy9oQeXFg8PAGoX9jgKazVuEvsTMEwUWEAcPhDWa1vJ7EaH X-Received: by 2002:a17:906:95c1:: with SMTP id n1mr24655957ejy.158.1574064945745; Mon, 18 Nov 2019 00:15:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574064945; cv=none; d=google.com; s=arc-20160816; b=FSLSjyy5vaPOu7MNiwxriED/00cSWccYzwQPomUZ6RFM9tXVUIStPPMyBILd35V7JA 8BwOVF/bDUGimT7NC2/1ox5gUwQarrxoPcYLOzWneNKe+bXEuGWVTBkmSExV7cL77gWC BIk1UIQ0Y2/7H5jh1MmYo4Z8ULmhyob9LKmrc9jvOLf2pOl8dv1Qu63sJ0liq9+RMH10 1jHIIVrL98R0DTfvciNaYNwz1kiCXRgwHrbUNq0grAlF3Wy2+GctM6FDcIxrftjG+4k9 OAgPNL4OnxJbMxtAdr2C27NQSaS90FSiYJF5AwGli38sS8F/wUZKeeP9BF2Vdn0jAsIN ZPCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WfexHpWcIrQXmVfcG0GcZ93etwBkQVdS9FVbZmWYJFk=; b=En1vOQ58ZWXWRZmQMUib3x3ovNES6GZC+H/mTJJUpRVgF7fRCGAsf8zphi4Nag2G1v S1mbL7XZk1b6RKSX1ca9KRTA/f2n1JCGg+2ZXPGAG2aF0VBQnzsn/2zTmDEc62ds0Y9p 0npU0xVe0zVuY7V3YBmgMxDOdguHro6msF35fwkQDQkIygWidwzX9lGUqqKqgI+EsKLG JBualb1QPK9rOeQf0afIzeBP2Bm87WWU9Ma9lCBL5t0brsknuxfkxqaX0YSgO+NJ24uE kvhXb+LwQfUUXlQGT4gurg8qM8nCr0rxEvneqOTPgl49lRY7mbl2YfLTIY1sQeXJD3Yf 5LcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=w7LPovea; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13si10926383ejx.144.2019.11.18.00.15.22; Mon, 18 Nov 2019 00:15:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=w7LPovea; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726563AbfKRINp (ORCPT + 99 others); Mon, 18 Nov 2019 03:13:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:49310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726371AbfKRINo (ORCPT ); Mon, 18 Nov 2019 03:13:44 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7EAE42073A; Mon, 18 Nov 2019 08:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574064824; bh=hWugHNSg6FXiyf5zMGSCMUjQJ73H/jew3AKUJQutvGA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=w7LPovea5sx/z5aH9l7zhX+zhq2nGXRvh4TWOe/5DnCET5I57moGxzgzZG4cv1tzx oZ6noF4fkkWWkxvHwcA1ScIgW0R3Uo4Q203AaLxv/l8QSUBboEdG+nbc1qn9HrAvan Agrb9hSGZYui8NTNvZoNhWCOb0Xx7H14tyqmqHiY= Date: Mon, 18 Nov 2019 09:13:41 +0100 From: Greg Kroah-Hartman To: patrick.rudolph@9elements.com Cc: linux-kernel@vger.kernel.org, Arthur Heymans , Allison Randal , Thomas Gleixner , Alexios Zavras , furquan@chromium.org Subject: Re: [PATCH 2/3] firmware: google: Unregister driver_info on failure and exit in gsmi Message-ID: <20191118081341.GA133533@kroah.com> References: <20191115134842.17013-1-patrick.rudolph@9elements.com> <20191115134842.17013-3-patrick.rudolph@9elements.com> <20191116134001.GE454551@kroah.com> <246585089f8b0730bc4e0ddae2e6a877009e1307.camel@9elements.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <246585089f8b0730bc4e0ddae2e6a877009e1307.camel@9elements.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 18, 2019 at 08:59:32AM +0100, patrick.rudolph@9elements.com wrote: > On Sat, 2019-11-16 at 14:40 +0100, Greg Kroah-Hartman wrote: > > On Fri, Nov 15, 2019 at 02:48:38PM +0100, > > patrick.rudolph@9elements.com wrote: > > > From: Arthur Heymans > > > > > > Fix a bug where the kernel module couldn't be loaded after > > > unloading, > > > as the platform driver wasn't released on exit. > > > > > > Signed-off-by: Arthur Heymans > > > --- > > > drivers/firmware/google/gsmi.c | 6 ++++++ > > > 1 file changed, 6 insertions(+) > > > > > > diff --git a/drivers/firmware/google/gsmi.c > > > b/drivers/firmware/google/gsmi.c > > > index edaa4e5d84ad..974c769b75cf 100644 > > > --- a/drivers/firmware/google/gsmi.c > > > +++ b/drivers/firmware/google/gsmi.c > > > @@ -1016,6 +1016,9 @@ static __init int gsmi_init(void) > > > dma_pool_destroy(gsmi_dev.dma_pool); > > > platform_device_unregister(gsmi_dev.pdev); > > > pr_info("gsmi: failed to load: %d\n", ret); > > > +#ifdef CONFIG_PM > > > + platform_driver_unregister(&gsmi_driver_info); > > > +#endif > > > return ret; > > > } > > > > > > @@ -1037,6 +1040,9 @@ static void __exit gsmi_exit(void) > > > gsmi_buf_free(gsmi_dev.name_buf); > > > dma_pool_destroy(gsmi_dev.dma_pool); > > > platform_device_unregister(gsmi_dev.pdev); > > > +#ifdef CONFIG_PM > > > + platform_driver_unregister(&gsmi_driver_info); > > > > Why the #ifdef here? Why does PM change things? > > > The driver is only registered if CONFIG_PM is selected, thus it only > needs to be unregistered if CONFIG_PM is selected. > > See 8942b2d5094b0 for reference. That is a "fun" abuse of the platform driver interface :( Why not just have this registration of your device for the "normal" device your driver binds to? Why create a special platform device instead? That means you have double the number of "devices" for your single real device. thanks, greg k-h