From patchwork Mon Feb 9 17:42:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 5802611 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4C3C0BF440 for ; Mon, 9 Feb 2015 17:42:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D9052011B for ; Mon, 9 Feb 2015 17:42:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A3B0200DB for ; Mon, 9 Feb 2015 17:42:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933239AbbBIRmK (ORCPT ); Mon, 9 Feb 2015 12:42:10 -0500 Received: from mail-wg0-f54.google.com ([74.125.82.54]:45434 "EHLO mail-wg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933313AbbBIRmJ (ORCPT ); Mon, 9 Feb 2015 12:42:09 -0500 Received: by mail-wg0-f54.google.com with SMTP id y19so2245523wgg.13 for ; Mon, 09 Feb 2015 09:42:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=Pcl7UA2FNUISateVJAHuOObpVaqi7G+kekVlClfneoA=; b=HcXOHZGXkE3p42SQKrOrUIDpJG7rfMjlKLuuvGmC2MxoyBkO3hclWkvxMTRkaHVF6A 6WyKCdkkstqj9DGx0fBr9L+SikeZbasZ6UXO0EIuYIFmZziIhCc/bS2Tgnn1rBzj+8Mr Q8wEKplUwvHRGiUohModWPWczBm6iI6br2U6Amr96Ur106YxONw81uyqDsM1M9ynSVzp gtvzOsnnxVfWx8vZ3L+DatXF73yWgqWURUtM5c5LSA5k2T09jg9uyOGTPDFJ2PzWhByT LjdKEq5FCkZ2maEaF2uaGcHdhSQozkj7tLeNqkJJo3yE2tmV6xzpkDFW7UXazZDRgWhF mTHw== X-Received: by 10.194.109.36 with SMTP id hp4mr43260434wjb.17.1423503728259; Mon, 09 Feb 2015 09:42:08 -0800 (PST) Received: from linux-tdhb.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by mx.google.com with ESMTPSA id k6sm15337974wia.6.2015.02.09.09.42.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Feb 2015 09:42:07 -0800 (PST) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: linux-wireless@vger.kernel.org, Hauke Mehrtens Cc: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH RFC] bcma: use two different initcalls if built-in Date: Mon, 9 Feb 2015 18:42:02 +0100 Message-Id: <1423503722-20819-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 MIME-Version: 1.0 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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 This is needed as we can't initialize bus during fs_initcall. Initialization requires SPROM which depends on NVRAM which depends on mtd. Since mtd, spi, nand, spi-nor use standard module_init, we have to do the same in bcma. Without this we'll try to initialize SPROM without having a ready SPROM proviver registered using bcma_arch_register_fallback_sprom. Signed-off-by: Rafa? Mi?ecki --- While this patch seems to work and I can compile bcma as built-in and module, I'm not too proud of it. I don't really like these #if(n)def tricks and I'm afraid bcma_modinit may be called even if bcma_modinit_early failed. Do you see any better idea of solving this? --- drivers/bcma/main.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 9635f10..c394207 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c @@ -637,13 +637,25 @@ static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *env) core->id.rev, core->id.class); } +/* Bus has to be registered early, before any bcma driver */ +static int __init bcma_modinit_early(void) +{ + return bus_register(&bcma_bus_type); +} +#ifndef MODULE +fs_initcall(bcma_modinit_early); +#endif + +/* Initialization has to be done later with SPI/mtd/NAND/SPROM available */ static int __init bcma_modinit(void) { int err; - err = bus_register(&bcma_bus_type); +#ifdef MODULE + err = bcma_modinit_early(); if (err) return err; +#endif err = bcma_host_soc_register_driver(); if (err) { @@ -660,7 +672,7 @@ static int __init bcma_modinit(void) return err; } -fs_initcall(bcma_modinit); +module_init(bcma_modinit); static void __exit bcma_modexit(void) {