From patchwork Mon Aug 30 09:58:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lamparter X-Patchwork-Id: 141771 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o7UAJWOe003459 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 30 Aug 2010 10:20:33 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Oq1SV-0001jL-Up; Mon, 30 Aug 2010 10:19:23 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Oq1ST-0001j2-V4 for spi-devel-general@lists.sourceforge.net; Mon, 30 Aug 2010 10:19:21 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of diac24.net designates 87.106.131.203 as permitted sender) client-ip=87.106.131.203; envelope-from=equinox@diac24.net; helo=spaceboyz.net; Received: from spaceboyz.net ([87.106.131.203]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1Oq1SQ-0001Z6-KX for spi-devel-general@lists.sourceforge.net; Mon, 30 Aug 2010 10:19:21 +0000 Received: from jupiter.n2.diac24.net ([2001:8d8:81:5c2:21b:fcff:fe4c:9e6f]) by spaceboyz.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.71) (envelope-from ) id 1Oq18T-003kN8-6c; Mon, 30 Aug 2010 11:58:41 +0200 Received: from equinox by jupiter.n2.diac24.net with local (Exim 4.72) (envelope-from ) id 1Oq18P-00A5q1-Uu; Mon, 30 Aug 2010 11:58:40 +0200 Date: Mon, 30 Aug 2010 11:58:37 +0200 From: David Lamparter To: spi-devel-general@lists.sourceforge.net Subject: [PATCH] spi: free children in spi_unregister_master, not siblings Message-ID: <20100830095837.GA2404529@jupiter.n2.diac24.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1Oq1SQ-0001Z6-KX Cc: David Brownell , Atsushi Nemoto , Tony Jones X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 30 Aug 2010 10:20:58 +0000 (UTC) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index b3a1f92..144393c 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -546,11 +546,9 @@ done: EXPORT_SYMBOL_GPL(spi_register_master); -static int __unregister(struct device *dev, void *master_dev) +static int __unregister(struct device *dev, void *null) { - /* note: before about 2.6.14-rc1 this would corrupt memory: */ - if (dev != master_dev) - spi_unregister_device(to_spi_device(dev)); + spi_unregister_device(to_spi_device(dev)); return 0; } @@ -568,8 +566,7 @@ void spi_unregister_master(struct spi_master *master) { int dummy; - dummy = device_for_each_child(master->dev.parent, &master->dev, - __unregister); + dummy = device_for_each_child(master->dev, NULL, _unregister); device_unregister(&master->dev); } EXPORT_SYMBOL_GPL(spi_unregister_master);