From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752094AbbASXEn (ORCPT ); Mon, 19 Jan 2015 18:04:43 -0500 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:39597 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751225AbbASXEm (ORCPT ); Mon, 19 Jan 2015 18:04:42 -0500 Date: Mon, 19 Jan 2015 23:04:27 +0000 From: Russell King - ARM Linux To: Greg Kroah-Hartman Cc: Wolfram Sang , linux-mips@linux-mips.org, Pantelis Antoniou , linux-kernel@vger.kernel.org, Julia Lawall , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Jean Delvare Subject: Re: [PATCH] i2c: drop ancient protection against sysfs refcounting issues Message-ID: <20150119230427.GH26493@n2100.arm.linux.org.uk> References: <1421693756-12917-1-git-send-email-wsa@the-dreams.de> <20150119190142.GA9451@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150119190142.GA9451@kroah.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 20, 2015 at 03:01:42AM +0800, Greg Kroah-Hartman wrote: > On Mon, Jan 19, 2015 at 07:55:56PM +0100, Wolfram Sang wrote: > > diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c > > index 39d25a8cb1ad..15cc5902cf89 100644 > > --- a/drivers/i2c/i2c-core.c > > +++ b/drivers/i2c/i2c-core.c > > @@ -41,7 +41,6 @@ > > #include > > #include > > #include > > -#include > > #include > > #include > > #include > > @@ -1184,8 +1183,7 @@ EXPORT_SYMBOL_GPL(i2c_new_dummy); > > > > static void i2c_adapter_dev_release(struct device *dev) > > { > > - struct i2c_adapter *adap = to_i2c_adapter(dev); > > - complete(&adap->dev_released); > > + /* empty, but the driver core insists we need a release function */ > > Yeah, it does, but I hate to see this in "real" code as something is > probably wrong with it if it happens. > > Please move the rest of 'i2c_del_adapter' into the release function > (what was after the wait_for_completion() call), and then all should be > fine. Are you sure about that? Some drivers do this, eg, i2c_del_adapter(&drv_data->adapter); free_irq(drv_data->irq, drv_data); where drv_data was allocated using devm_kzalloc(), and so will be released when the ->remove callback (which calls the above i2c_del_adapter()) returns... freeing the embedded device struct. -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net.