From patchwork Fri Dec 9 12:35:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 9468087 X-Patchwork-Delegate: geert@linux-m68k.org 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 3C9C4607D8 for ; Fri, 9 Dec 2016 12:35:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 308BA28631 for ; Fri, 9 Dec 2016 12:35:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2540528633; Fri, 9 Dec 2016 12:35:32 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 CB80228631 for ; Fri, 9 Dec 2016 12:35:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933546AbcLIMfZ (ORCPT ); Fri, 9 Dec 2016 07:35:25 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34181 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933423AbcLIMfX (ORCPT ); Fri, 9 Dec 2016 07:35:23 -0500 Received: by mail-wm0-f68.google.com with SMTP id g23so3803432wme.1; Fri, 09 Dec 2016 04:35:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=/IsfAwDjlJT80MVluBkeBvWHJcp2EcS1EtlO2Z0mR6A=; b=evlRSZTr4EQNpL4z4q7Ixcg1eA04bvwCpOtZJmCBzC4fjs6P0bEGOTm71akIlXzpdz Kri3bOtwqYHTm00LA8hTWDDiIuoa3vYfZwOalCchbWSpHQdarxn/Nnny52zjR24kFnP/ PRfwC4HjZAUfGnrgkwFaQeV0bW5hPtUBL5BBjwQpzJWWU4rvaVsyTprAGWNzaxyj8R0U SZjdX4Gq1Ep/P2wDTL1gSjUba+hT1W899UE89TJgvtvIzhUXOSpF3ntGw1xd6F+Umv6F m7I+H+g5gzafvNB65mFI1IpNKYUzGTYA9SIfICN2+a9I8ZnninKWwb0ip+l6Fte6HOVw WmSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=/IsfAwDjlJT80MVluBkeBvWHJcp2EcS1EtlO2Z0mR6A=; b=byZDOatIV7QBzWrBJPDMTqoaL77aqZCLUeSEfyAmnX3mTe++sheSvMDlp3fBxwiLbw 2VaipOokKqodwc3YsLh5dcaKFcYqxw4vW52dFZeOljUQfawrCVwKRHnIZcfaDtXXprOs z1nliWOFVTS3dCEGjftnhFPZyFl9nuA6jXXl3mxyvbdsg494ElGKVPdGmlwL7M/mpqN3 6yFX4xaK6+ypGtS4n/qP0ofj7OgftNbUS7ToNcSJek9lGW9VCdCptv5DvESnLgOry5Gb WKtPBaO63pjiae1iQpITy3zL+etx7ryhONh+w7fPvNZxPaJxIKlmulJCoxF1GbvbJFU6 rojQ== X-Gm-Message-State: AKaTC00qjjBXIr+iNZhtpn8HTERUAyvfUBKEif5Rdoio9lTX+LU5KJD1ZLlqOpqxmfArpQ== X-Received: by 10.28.51.211 with SMTP id z202mr6891801wmz.125.1481286921609; Fri, 09 Dec 2016 04:35:21 -0800 (PST) Received: from groucho.site (ipbcc17b88.dynamic.kabel-deutschland.de. [188.193.123.136]) by smtp.gmail.com with ESMTPSA id x140sm20360920wme.19.2016.12.09.04.35.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Dec 2016 04:35:21 -0800 (PST) From: Ulrich Hecht To: linux-renesas-soc@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, magnus.damm@gmail.com, Laurent Pinchart Subject: [PATCH v1.5 1/6] v4l: rcar-fcp: Don't get/put module reference Date: Fri, 9 Dec 2016 13:35:07 +0100 Message-Id: <1481286912-16555-2-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481286912-16555-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1481286912-16555-1-git-send-email-ulrich.hecht+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Laurent Pinchart Direct callers of the FCP API hold a reference to the FCP module due to module linkage, there's no need to take another one manually. Take a reference to the device instead to ensure that it won't disappear behind the caller's back. Signed-off-by: Laurent Pinchart --- drivers/media/platform/rcar-fcp.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/rcar-fcp.c b/drivers/media/platform/rcar-fcp.c index 7146fc5..e9f609e 100644 --- a/drivers/media/platform/rcar-fcp.c +++ b/drivers/media/platform/rcar-fcp.c @@ -53,14 +53,7 @@ struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np) if (fcp->dev->of_node != np) continue; - /* - * Make sure the module won't be unloaded behind our back. This - * is a poor man's safety net, the module should really not be - * unloaded while FCP users can be active. - */ - if (!try_module_get(fcp->dev->driver->owner)) - fcp = NULL; - + get_device(fcp->dev); goto done; } @@ -81,7 +74,7 @@ EXPORT_SYMBOL_GPL(rcar_fcp_get); void rcar_fcp_put(struct rcar_fcp_device *fcp) { if (fcp) - module_put(fcp->dev->driver->owner); + put_device(fcp->dev); } EXPORT_SYMBOL_GPL(rcar_fcp_put);