Received: by 10.223.185.116 with SMTP id b49csp5090129wrg; Wed, 7 Mar 2018 06:17:12 -0800 (PST) X-Google-Smtp-Source: AG47ELtgPF7miVCC8yIy2jIF/bzXiYfV+KoYqrOHjIqgjOB6qhI/egYR2wLVpBnw9dJgaDEnCiPT X-Received: by 2002:a17:902:28c3:: with SMTP id f61-v6mr20933116plb.346.1520432232258; Wed, 07 Mar 2018 06:17:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520432232; cv=none; d=google.com; s=arc-20160816; b=T1+/i08GMv3inFnRafzrVNrdowglN5dGK1q9cVW5jVcz2eJedZ6VyjCg8CLKZstF0v 3asiDRKFOWwv0ZK+mjxrDwNW3w/tweblmgLP9ZeMjMtl/qgZx43L2Oj9zjYFKuqB1puK b3c17s+MVlTLkhWL+eS3NZElzhuF/04FgeZpYI+9K8LN4wQLsZHfRAdcEYBkfOMZew/e yweFzDsuvqXC1fspnqGdexBNTxlVaZg726fg4EiKI/LHM3Ab7jn2xob2lMAIpsLmZ5Ig hfXeNvUMX4jefT3xzpGfqMv4BONxaq34rEjHMNUqp3zwwOBFD6+neHynvHcJ0yALqgn4 H+kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=FdxB6C4BuuPlwD4vNiVF5D4MKmtGujIddKOnE0Dj3Ds=; b=SqBTrwC7+ytV47Ko3MSzgnUgXhNnJ1cE1C32u2eRiq/IAsWAIwy3/saV3N4W47I/Wb IwQzp+K9znt18bvAT7oZFvPYnJ9p8k+YPZUg3u2pO1dRU+rxkw0D8Fk/EcC9I2lvWsGR Jf3KkNn0P78OKBvWz9KN0F8cthm+p59lt91D5NPHsYO1ipmIVHugZboSt2ox0hjXijQ3 5Y71wX3duQi+WIUOAWvEAD/hGBZ6sOR7UG2dc6+I0D/jaqc2bEc6F2LKA+RNnw3+0UPn bzf7Hfct8+O6AzyDx7XvmxEyVEkbrIfxoR8j25H5+upPaC2ltCEYPgvf8WGWBZAPc9zA 8VIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=AUux9iU/; 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 y96-v6si12982373plh.796.2018.03.07.06.16.57; Wed, 07 Mar 2018 06:17:12 -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=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=AUux9iU/; 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 S1754528AbeCGOPf (ORCPT + 99 others); Wed, 7 Mar 2018 09:15:35 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:50220 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754510AbeCGOP3 (ORCPT ); Wed, 7 Mar 2018 09:15:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=FdxB6C4BuuPlwD4vNiVF5D4MKmtGujIddKOnE0Dj3Ds=; b=AUux9iU/Rcjn XvE3YymkHszPqQklkIr/VFovbcgWUK2uqaiZuSnof7ISyVSv1A/Thni9e2vFN3IW6CuF6qGQ3b6OR du27fGUsiDiYbqMkoJxu0iUBpHeIukF4Yv3tX+HoL9vuFqGEGhiY/NsSgcxZeexB4FBVKNsKzfzwh reAuU=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1etZqo-0000CG-U0; Wed, 07 Mar 2018 14:15:26 +0000 Received: from broonie by debutante with local (Exim 4.90_1) (envelope-from ) id 1etZqo-0001cw-Ee; Wed, 07 Mar 2018 14:15:26 +0000 From: Mark Brown To: Jarkko Nikula Cc: Mark Brown , stable@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Applied "spi: Fix unregistration of controller with fixed SPI bus number" to the regulator tree In-Reply-To: Message-Id: Date: Wed, 07 Mar 2018 14:15:26 +0000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch spi: Fix unregistration of controller with fixed SPI bus number has been applied to the regulator tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 9fca7d15487654dab119d0868501db30f80ac46a Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Tue, 6 Mar 2018 17:47:22 +0200 Subject: [PATCH] spi: Fix unregistration of controller with fixed SPI bus number Commit 9b61e302210e (spi: Pick spi bus number from Linux idr or spi alias) ceased to unregister SPI buses with fixed bus numbers. Moreover this is visible only if CONFIG_SPI_DEBUG=y is set or when trying to re-register the same SPI controller. rmmod spi_pxa2xx_platform (with CONFIG_SPI_DEBUG=y): [ 26.788362] spi_master spi1: attempting to delete unregistered controller [spi1] modprobe spi_pxa2xx_platform: [ 37.883137] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:19.0/pxa2xx-spi.12/spi_master/spi1' [ 37.894984] CPU: 1 PID: 1467 Comm: modprobe Not tainted 4.16.0-rc4+ #21 [ 37.902384] Call Trace: ... [ 38.122680] kobject_add_internal failed for spi1 with -EEXIST, don't try to register things with the same name in the same directory. [ 38.136154] WARNING: CPU: 1 PID: 1467 at lib/kobject.c:238 kobject_add_internal+0x2a5/0x2f0 ... [ 38.513817] pxa2xx-spi pxa2xx-spi.12: problem registering spi master [ 38.521036] pxa2xx-spi: probe of pxa2xx-spi.12 failed with error -17 Fix this by not returning immediately from spi_unregister_controller() if idr_find() doesn't find controller with given ID/bus number. It finds only those controllers that were registered with dynamic SPI bus numbers. Only conditional cleanup between dynamic and fixed bus numbers is to remove allocated IDR. Fixes: 9b61e302210e (spi: Pick spi bus number from Linux idr or spi alias) Signed-off-by: Jarkko Nikula Signed-off-by: Mark Brown Cc: stable@vger.kernel.org --- drivers/spi/spi.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index b33a727a0158..e90fd442b3f0 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2254,12 +2254,6 @@ void spi_unregister_controller(struct spi_controller *ctlr) mutex_lock(&board_lock); found = idr_find(&spi_master_idr, id); mutex_unlock(&board_lock); - if (found != ctlr) { - dev_dbg(&ctlr->dev, - "attempting to delete unregistered controller [%s]\n", - dev_name(&ctlr->dev)); - return; - } if (ctlr->queued) { if (spi_destroy_queue(ctlr)) dev_err(&ctlr->dev, "queue remove failed\n"); @@ -2272,7 +2266,8 @@ void spi_unregister_controller(struct spi_controller *ctlr) device_unregister(&ctlr->dev); /* free bus id */ mutex_lock(&board_lock); - idr_remove(&spi_master_idr, id); + if (found == ctlr) + idr_remove(&spi_master_idr, id); mutex_unlock(&board_lock); } EXPORT_SYMBOL_GPL(spi_unregister_controller); -- 2.16.2