From patchwork Mon Oct 30 10:35:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10032303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 226D96039A for ; Mon, 30 Oct 2017 10:35:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24F292861E for ; Mon, 30 Oct 2017 10:35:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1994E28768; Mon, 30 Oct 2017 10:35:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B214E2861E for ; Mon, 30 Oct 2017 10:35:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752258AbdJ3Kfp (ORCPT ); Mon, 30 Oct 2017 06:35:45 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:51898 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751770AbdJ3Kfo (ORCPT ); Mon, 30 Oct 2017 06:35:44 -0400 Received: by mail-lf0-f65.google.com with SMTP id r129so14339212lff.8; Mon, 30 Oct 2017 03:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=iOiQFIwDtjDgb2W9lydvgdamoJ6aO1rVC1DCZWBH7UI=; b=b/pXBRAP/q6/Z8agIK0DhCjCWGezD3ClO1iEIW0GxDlcJbk7XlITwJKfXKzII3aK16 BYhXfhyIEqw1zkZDN5j6E80YOLJX0x+cLPamjict8wAZ1wX2O/NTtZFpvoC/ylXZ/Xv1 1bvwzH/2nRCwxhNgThKxVsroZSaSKEvBOQlEsvJx00COLsyXidgdlSwda/PCkeNYYL8H AJs193Y7Mzig0CEj5ohE+3zvQgJUnLJNVoZSjETHAyWVhRNsSDz4pgqJVbDGShcRWfJ0 Lg9cwlIlc7gTUbNlY44DLpyOV6U3f8jLpSRv0rc/UAjuK9Aq56zyI/4JMBcVcGME20Ea FEOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=iOiQFIwDtjDgb2W9lydvgdamoJ6aO1rVC1DCZWBH7UI=; b=DKgFOPBnFSRDLrOGwi1htVcbkRtMUCjO+huIavjk/NhaM5xxJqYkNUoAEH7g1ExeS1 Pg1ivD8LBUz3ZETWQfYeMaTdGP7IBiSGPHpx3Q9GnL8cGj+tL1hReFkf2BFXdV2EkagN DGxqbHhVwgvBhstHMuoVMFo+LkzmNgHF4Uer3hheYZIi6asZ/13/bfEmrMJ7z8LdH/8U tzOxJh91QDHYif7FcLPX5S4KDnkf8lX9jn94EO4uPIv93QSGvsSQgMboTdpYbMOlb5ZP dsnwtx4B89twk3df1u8jzDleeNX+Uwrm3ceT6ZSRPyxKag4ghx6HwtHyYCQujT2Erfzr cUXQ== X-Gm-Message-State: AMCzsaVSuAJYu6clrIi1+xnx7gsOWTwKUma5KF7p96+NzxXIoKjo9RJb Qz5XPlRjeLh4KYP8Lhb+IKs= X-Google-Smtp-Source: ABhQp+QQF4Adzn4PKirq2qoiUkHmKYktuKMtmd3n91VQgy91ajVygV0c3rSgy+O6xI1xdZOypO0Ndg== X-Received: by 10.25.18.71 with SMTP id h68mr2733558lfi.50.1509359742692; Mon, 30 Oct 2017 03:35:42 -0700 (PDT) Received: from xi.terra (c-fab8e655.07-184-6d6c6d4.cust.bredbandsbolaget.se. [85.230.184.250]) by smtp.gmail.com with ESMTPSA id g192sm2538675lfg.42.2017.10.30.03.35.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Oct 2017 03:35:41 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.89) (envelope-from ) id 1e97Px-0003c1-CE; Mon, 30 Oct 2017 11:35:41 +0100 From: Johan Hovold To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen , Johan Hovold Subject: [PATCH v2 2/3] spi: document odd controller reference handling Date: Mon, 30 Oct 2017 11:35:26 +0100 Message-Id: <20171030103527.13535-2-johan@kernel.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171030103527.13535-1-johan@kernel.org> References: <20171030103527.13535-1-johan@kernel.org> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Document the fact that a reference to the controller is dropped as part of deregistration. This is an odd pattern as the reference is typically taken in __spi_alloc_controller() rather than spi_register_controller(). Most controller drivers gets it right these days and notably the device-managed interface relies on this behaviour. Signed-off-by: Johan Hovold --- drivers/spi/spi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 3ff0ee88c467..b33a727a0158 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2200,7 +2200,7 @@ static void devm_spi_unregister(struct device *dev, void *res) * Context: can sleep * * Register a SPI device as with spi_register_controller() which will - * automatically be unregister + * automatically be unregistered and freed. * * Return: zero on success, else a negative error code. */ @@ -2241,6 +2241,8 @@ static int __unregister(struct device *dev, void *null) * only ones directly touching chip registers. * * This must be called from context that can sleep. + * + * Note that this function also drops a reference to the controller. */ void spi_unregister_controller(struct spi_controller *ctlr) {