All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Grumbach, Emmanuel" <emmanuel.grumbach@intel.com>
To: Arnd Bergmann <arnd@kernel.org>,
	"Coelho, Luciano" <luciano.coelho@intel.com>,
	Kalle Valo <kvalo@codeaurora.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	"Beker, Ayala" <ayala.beker@intel.com>,
	"Korenblit, Miriam Rachel" <miriam.rachel.korenblit@intel.com>,
	"Berg, Johannes" <johannes.berg@intel.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] iwlwifi: work around reverse dependency on MEI
Date: Tue, 7 Dec 2021 13:19:10 +0000	[thread overview]
Message-ID: <SA1PR11MB58258D60F7C1334471E2F434F26E9@SA1PR11MB5825.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20211207125430.2423871-1-arnd@kernel.org>

Hi Arend,

> Subject: [PATCH] iwlwifi: work around reverse dependency on MEI
> 
> From: Arnd Bergmann <arnd@arndb.de>
> 
> If the iwlmei code is a loadable module, the main iwlwifi driver cannot be
> built-in:
> 
> x86_64-linux-ld: drivers/net/wireless/intel/iwlwifi/pcie/trans.o: in function
> `iwl_pcie_prepare_card_hw':
> trans.c:(.text+0x4158): undefined reference to `iwl_mei_is_connected'
> 
> Unfortunately, Kconfig enforces the opposite, forcing the MEI driver to not
> be built-in if iwlwifi is a module.
> 
> There is no easy way to express the correct dependency in Kconfig, this is the
> best workaround I could come up with, turning CONFIG_IWLMEI into a 'bool'
> symbol, and spelling out the exact conditions under which it may be enabled,
> and then using Makefile logic to ensure it is built-in when iwlwifi is.
> 
> A better option would be change iwl_mei_is_connected() so it could be
> called from iwlwifi regardless of whether the mei driver is reachable, but that
> requires a larger rework in the driver.

I can try to do that but I don't really see how..
I can't really make a function that would behave differently based on whether the symbol is available or not.

> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/net/wireless/intel/iwlwifi/Kconfig      | 6 +++---
>  drivers/net/wireless/intel/iwlwifi/Makefile     | 3 +--
>  drivers/net/wireless/intel/iwlwifi/mei/Makefile | 4 +++-
>  3 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/Kconfig
> b/drivers/net/wireless/intel/iwlwifi/Kconfig
> index cf1125d84929..474afc6f82a8 100644
> --- a/drivers/net/wireless/intel/iwlwifi/Kconfig
> +++ b/drivers/net/wireless/intel/iwlwifi/Kconfig
> @@ -93,10 +93,10 @@ config IWLWIFI_BCAST_FILTERING
>  	  expect incoming broadcasts for their normal operations.
> 
>  config IWLMEI
> -	tristate "Intel Management Engine communication over WLAN"
> -	depends on INTEL_MEI
> +	bool "Intel Management Engine communication over WLAN"
> +	depends on INTEL_MEI=y || INTEL_MEI=IWLMVM
> +	depends on IWLMVM=y || IWLWIFI=m
>  	depends on PM
> -	depends on IWLMVM
>  	help
>  	  Enables the iwlmei kernel module.

Johannes suggested to make IWLMVM depend on IWLMEI || !IWLMEI
That worked as well, I just had issues with this in our internal backport based tree.
I need to spend a bit more time on this, but I admit my total ignorance in Kconfig's dialect.


> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/Makefile
> b/drivers/net/wireless/intel/iwlwifi/Makefile
> index 75a703eb1bdf..c117e105fe5c 100644
> --- a/drivers/net/wireless/intel/iwlwifi/Makefile
> +++ b/drivers/net/wireless/intel/iwlwifi/Makefile
> @@ -29,7 +29,6 @@ iwlwifi-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-
> devtrace.o  ccflags-y += -I$(src)
> 
>  obj-$(CONFIG_IWLDVM)	+= dvm/
> -obj-$(CONFIG_IWLMVM)	+= mvm/
> -obj-$(CONFIG_IWLMEI)	+= mei/
> +obj-$(CONFIG_IWLMVM)	+= mvm/ mei/
> 
>  CFLAGS_iwl-devtrace.o := -I$(src)
> diff --git a/drivers/net/wireless/intel/iwlwifi/mei/Makefile
> b/drivers/net/wireless/intel/iwlwifi/mei/Makefile
> index 8e3ef0347db7..98b561c3820f 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mei/Makefile
> +++ b/drivers/net/wireless/intel/iwlwifi/mei/Makefile
> @@ -1,5 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0-only
> -obj-$(CONFIG_IWLMEI)	+= iwlmei.o
> +ifdef CONFIG_IWLMEI
> +obj-$(CONFIG_IWLWIFI)	+= iwlmei.o
> +endif
>  iwlmei-y += main.o
>  iwlmei-y += net.o
>  iwlmei-$(CONFIG_IWLWIFI_DEVICE_TRACING) += trace.o
> --
> 2.29.2


  reply	other threads:[~2021-12-07 13:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07 12:54 [PATCH] iwlwifi: work around reverse dependency on MEI Arnd Bergmann
2021-12-07 13:19 ` Grumbach, Emmanuel [this message]
2021-12-07 13:25   ` Arnd Bergmann
2021-12-07 14:40     ` Johannes Berg
2021-12-07 14:56       ` Arnd Bergmann
2021-12-07 14:10 ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA1PR11MB58258D60F7C1334471E2F434F26E9@SA1PR11MB5825.namprd11.prod.outlook.com \
    --to=emmanuel.grumbach@intel.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=ayala.beker@intel.com \
    --cc=davem@davemloft.net \
    --cc=johannes.berg@intel.com \
    --cc=kuba@kernel.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    --cc=miriam.rachel.korenblit@intel.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.