2023-12-18 15:06:04

by Lukas Bulwahn

[permalink] [raw]
Subject: Re: [PATCH] bcma,ssb: simplify dependency handling for bcma and ssb drivers

On Mon, Dec 18, 2023 at 3:59 PM Kalle Valo <[email protected]> wrote:
>
> Johannes Berg <[email protected]> writes:
>
> > On Mon, 2023-12-18 at 12:58 +0100, Lukas Bulwahn wrote:
> >
> > Dunno, I'm not super involved with this but ...
> >
> >> +++ b/drivers/bcma/Kconfig
> >> @@ -1,12 +1,7 @@
> >> # SPDX-License-Identifier: GPL-2.0
> >> -config BCMA_POSSIBLE
> >> - bool
> >> - depends on HAS_IOMEM && HAS_DMA
> >> - default y
> >> -
> >> menuconfig BCMA
> >> tristate "Broadcom specific AMBA"
> >> - depends on BCMA_POSSIBLE
> >> + depends on HAS_IOMEM && HAS_DMA
> >
> > [...]
> >> config BRCMSMAC
> >> tristate "Broadcom IEEE802.11n PCIe SoftMAC WLAN driver"
> >> - depends on MAC80211
> >> - depends on BCMA_POSSIBLE
> >> + depends on HAS_IOMEM && HAS_DMA && MAC80211
> >> select BCMA
> >
> > to me it kind of seems more obvious for example in this case to say
> > "depend on BCMA_POSSIBLE and select BCMA" rather than open-coding the
> > BCMA dependencies both here and in BCMA? Now granted, they're rather
> > unlikely to _change_, but it still seems more obvious?
>
> I was thinking the same. Lukas, is there a specific reason why you want
> to change this or this just something you noticed by chance?
>

I just noticed this by chance---well, I was wondering what these
config symbols were doing in my kernel build configuration (they are
actually in every config). While reading through the code, I was
confused on what the dependencies were trying to tell me, as the
config symbols and conditions seemed to repeat over and over in
different places.

I thought it was worth a clean up and this was the patch I came up
with in the end.

Lukas


2023-12-18 16:40:45

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH] bcma,ssb: simplify dependency handling for bcma and ssb drivers

Hi Lukas,

thanks for your patch.

On Mon, 18 Dec 2023 16:03:54 +0100
Lukas Bulwahn <[email protected]> wrote:

> While reading through the code, I was
> confused on what the dependencies were trying to tell me, as the
> config symbols and conditions seemed to repeat over and over in
> different places.

The {SSB,BCMA}_POSSIBLE constants are defining the conditions under
which it is possible to 'select' SSB/BCMA.
SSB and BCMA are usually 'select'ed rather than depended on, for better
user experience while configuring.

> I thought it was worth a clean up and this was the patch I came up
> with in the end.

IMO this does not clean up or simplify the code.
It rather makes it more complicated to maintain.

The idea behind the POSSIBLE constants it to _not_ spread the
conditions all across the drivers. That has significant advantages, if
the condition changes.

I also don't see the redundancy in the resulting dependency conditions
as a bad thing. It's better if every option explicitly defines its
dependencies rather than expecting something else to depend on it.
That's fragile.

NAK from me.

--
Michael Büsch
https://bues.ch/


Attachments:
(No filename) (849.00 B)
OpenPGP digital signature