From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933020AbaFDH45 (ORCPT ); Wed, 4 Jun 2014 03:56:57 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:59732 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932067AbaFDH44 (ORCPT ); Wed, 4 Jun 2014 03:56:56 -0400 From: Arnd Bergmann To: Sebastian Reichel Cc: Carlos Chinea , Ivaylo Dimitrov , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] hsi: omap_ssi_port: use normal module refcounting Date: Wed, 04 Jun 2014 09:56:48 +0200 Message-ID: <7426698.eEpYu3o0WK@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.11.0-18-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V02:K0:TH6f1rPs0FXgoaGg4JYrx1j2T7wyq96g44MXD2x4ep4 LFbhSir7jOSdtGTAx84+u5OfjfwoLHKqnSEBxlR2KbF6HMgM5w 2tBwNTz9l0huMWPe+eXU62Jp6S8RzmpmrLGN0VOI6CCRuyS9p/ J2useuavm7g7jLZ7GZQCCorGejDkioq+BfK8i03wbFsqI1RxiB QG5rZdticAVcBNSr9t6Nb31lvopTVGa3MU1kJ8TrCpf7skLxqM ueGzbRB5R+3goQ0w8eFEE/ZjLvjJQXOIaiY1tjCABEuU1kS8rU MeGqpojxCvyroEON/+uNC1OQKNw6AewNJ5KkY7bQbnt4PSY651 4HCQ3msQ1TWpSNpvY610= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ref_module() function is used for internal housekeeping of the module code, it's not normally used by subsystems or device drivers, and the use of ref_module in the omap_ssi_port driver causes a link build error when modules are disabled: hsi/controllers/omap_ssi_port.c: In function 'ssi_port_probe': hsi/controllers/omap_ssi_port.c:1119:2: error: implicit declaration of function 'ref_module' [-Werror=implicit-function-declaration] This changes the omap_ssi_port driver to use try_module_get() and module_put() instead, which is the normal way to ensure that the driver providing a device used in another module does not go away. Signed-off-by: Arnd Bergmann Cc: Sebastian Reichel Cc: Carlos Chinea Cc: Ivaylo Dimitrov diff --git a/drivers/hsi/controllers/omap_ssi_port.c b/drivers/hsi/controllers/omap_ssi_port.c index b8693f0..6eb7c28 100644 --- a/drivers/hsi/controllers/omap_ssi_port.c +++ b/drivers/hsi/controllers/omap_ssi_port.c @@ -1116,8 +1116,7 @@ static int __init ssi_port_probe(struct platform_device *pd) dev_dbg(&pd->dev, "init ssi port...\n"); - err = ref_module(THIS_MODULE, ssi->owner); - if (err) { + if (!try_module_get(ssi->owner)) { dev_err(&pd->dev, "could not increment parent module refcount (err=%d)\n", err); return -ENODEV; @@ -1254,6 +1253,7 @@ static int __exit ssi_port_remove(struct platform_device *pd) omap_ssi->port[omap_port->port_id] = NULL; platform_set_drvdata(pd, NULL); + module_put(port->owner); pm_runtime_disable(&pd->dev); return 0;