From patchwork Sun Jun 7 13:56:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Kondratiev X-Patchwork-Id: 6561451 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 768729F46A for ; Sun, 7 Jun 2015 13:56:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 78E3A20528 for ; Sun, 7 Jun 2015 13:56:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73BB5205B7 for ; Sun, 7 Jun 2015 13:56:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753186AbbFGN4t (ORCPT ); Sun, 7 Jun 2015 09:56:49 -0400 Received: from sabertooth02.qualcomm.com ([65.197.215.38]:47820 "EHLO sabertooth02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752821AbbFGN4o (ORCPT ); Sun, 7 Jun 2015 09:56:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1433685404; x=1465221404; h=from:cc:to:subject:date:message-id:in-reply-to: references; bh=VLnZCBg7U6kNWv7EZ1PvIBuHW8sRpliVIeKhxW7FTx0=; b=ee6jBWojMSNrHKQ6MxRnovXXRUMk9YzXtsrxu7QXOVUFxp1sHKXahA53 kB/FLfWGzk+KRY3fIk1L10PrqENJNmHvzjSjDYUNHB4RGZ+eMCi85Z2ea IKCbuBfy/GO6UyXpafCgx8wZm3A2fCnq50B4uGYJfTeG2R2OibNHoA4Ny c=; X-IronPort-AV: E=McAfee;i="5700,7163,7824"; a="91494593" Received: from ironmsg03-r.qualcomm.com ([172.30.46.17]) by sabertooth02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Jun 2015 06:56:43 -0700 From: Vladimir Kondratiev Cc: Vladimir Kondratiev , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com X-IronPort-AV: E=Sophos;i="5.13,568,1427785200"; d="scan'208";a="934590316" Received: from lx-wigig-72.mea.qualcomm.com ([10.18.134.253]) by Ironmsg03-R.qualcomm.com with ESMTP; 07 Jun 2015 06:56:42 -0700 To: Kalle Valo Subject: [PATCH 5/6] wil6210: platform hooks for modile init/exit Date: Sun, 7 Jun 2015 16:56:30 +0300 Message-Id: <1433685391-9026-6-git-send-email-qca_vkondrat@qca.qualcomm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1433685391-9026-1-git-send-email-qca_vkondrat@qca.qualcomm.com> References: <1433685391-9026-1-git-send-email-qca_vkondrat@qca.qualcomm.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Provide platform hooks for module init/exit. If platform require to perform some specific actions in global context, this is where to do so. Example may be turning on power for the PCIE based on DT information. Signed-off-by: Vladimir Kondratiev --- drivers/net/wireless/ath/wil6210/pcie_bus.c | 22 +++++++++++++++++++++- drivers/net/wireless/ath/wil6210/wil_platform.c | 9 +++++++++ drivers/net/wireless/ath/wil6210/wil_platform.h | 3 +++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c index 58c7916..a4417d4 100644 --- a/drivers/net/wireless/ath/wil6210/pcie_bus.c +++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c @@ -291,7 +291,27 @@ static struct pci_driver wil6210_driver = { .name = WIL_NAME, }; -module_pci_driver(wil6210_driver); +static int __init wil6210_driver_init(void) +{ + int rc; + + rc = wil_platform_modinit(); + if (rc) + return rc; + + rc = pci_register_driver(&wil6210_driver); + if (rc) + wil_platform_modexit(); + return rc; +} +module_init(wil6210_driver_init); + +static void __exit wil6210_driver_exit(void) +{ + pci_unregister_driver(&wil6210_driver); + wil_platform_modexit(); +} +module_exit(wil6210_driver_exit); MODULE_LICENSE("Dual BSD/GPL"); MODULE_AUTHOR("Qualcomm Atheros "); diff --git a/drivers/net/wireless/ath/wil6210/wil_platform.c b/drivers/net/wireless/ath/wil6210/wil_platform.c index 976a071..1db680f 100644 --- a/drivers/net/wireless/ath/wil6210/wil_platform.c +++ b/drivers/net/wireless/ath/wil6210/wil_platform.c @@ -17,6 +17,15 @@ #include "linux/device.h" #include "wil_platform.h" +int __init wil_platform_modinit(void) +{ + return 0; +} + +void wil_platform_modexit(void) +{ +} + /** * wil_platform_init() - wil6210 platform module init * diff --git a/drivers/net/wireless/ath/wil6210/wil_platform.h b/drivers/net/wireless/ath/wil6210/wil_platform.h index 158c73b..d7fa19b 100644 --- a/drivers/net/wireless/ath/wil6210/wil_platform.h +++ b/drivers/net/wireless/ath/wil6210/wil_platform.h @@ -31,4 +31,7 @@ struct wil_platform_ops { void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops); +int __init wil_platform_modinit(void); +void wil_platform_modexit(void); + #endif /* __WIL_PLATFORM_H__ */