All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Mark Brown <broonie@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-spi <linux-spi@vger.kernel.org>
Subject: Re: [PATCH v2 -next] spi: fix spi-sprd-adi build errors when SPI_SPRD_ADI=y and HWSPINLOCK=m
Date: Mon, 25 Sep 2017 21:20:31 +0200	[thread overview]
Message-ID: <CAMuHMdXwv7s-uBM2J1Rf5fw+2=N_VcPxCYHartgUxb56yrR23A@mail.gmail.com> (raw)
In-Reply-To: <449abd0e-8d8b-86e9-2b7a-65c27ab3171b@infradead.org>

Hi Randy,

On Mon, Sep 25, 2017 at 7:19 PM, Randy Dunlap <rdunlap@infradead.org> wrote:
> On 09/25/17 09:12, Mark Brown wrote:
>> On Fri, Sep 22, 2017 at 06:46:46PM -0700, Randy Dunlap wrote:
>>> On 09/22/17 02:26, Mark Brown wrote:
>>
>>>> right thing - if we can use hwspinlocks in a module when they're enabled
>>>> I'd expect to be able to build the stubs that way too.
>>
>>> Sorry, I'm not understanding what you are trying to say on that one.
>>
>>> HWSPINLOCK   SPI_SPRD_ADI
>>
>>> but this combo is not allowed (with the patch) or causes build errors
>>> (without the patch):
>>>      m               y
>>
>> Why is that not just an || COMPILE_TEST dependency then?  The dependency
>> you're trying to introduce is weird and confusing, we shouldn't be
>> having to do things like that.
>
> It already uses COMPILE_TEST:
>
> config SPI_SPRD_ADI
>         tristate "Spreadtrum ADI controller"
>         depends on ARCH_SPRD || COMPILE_TEST
>         help
>           ADI driver based on SPI for Spreadtrum SoCs.
>
> but that allows build errors when SPI_SPRD_ADI=y and HWSPINLOCK=y.

You mean "when SPI_SPRD_ADI=y and HWSPINLOCK=m"?

> As for the dependency that I am adding:
> +       depends on HWSPINLOCK || HWSPINLOCK=n
>
> that idiom is used over and over again in Kconfig files to prevent this kind of
> build problem in loadable modules.

Indeed, it's confusing, but used all over the place.

The issue is builtin drivers that depend on a modular API.  The clean way
is to separate API and implementation, so the API can be builtin, and the
implementation can be modular.
Hence the API should provide stubs that call into function pointers, to be
registered by the module providing the implementation.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
To: Randy Dunlap <rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Cc: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-spi <linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v2 -next] spi: fix spi-sprd-adi build errors when SPI_SPRD_ADI=y and HWSPINLOCK=m
Date: Mon, 25 Sep 2017 21:20:31 +0200	[thread overview]
Message-ID: <CAMuHMdXwv7s-uBM2J1Rf5fw+2=N_VcPxCYHartgUxb56yrR23A@mail.gmail.com> (raw)
In-Reply-To: <449abd0e-8d8b-86e9-2b7a-65c27ab3171b-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>

Hi Randy,

On Mon, Sep 25, 2017 at 7:19 PM, Randy Dunlap <rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> wrote:
> On 09/25/17 09:12, Mark Brown wrote:
>> On Fri, Sep 22, 2017 at 06:46:46PM -0700, Randy Dunlap wrote:
>>> On 09/22/17 02:26, Mark Brown wrote:
>>
>>>> right thing - if we can use hwspinlocks in a module when they're enabled
>>>> I'd expect to be able to build the stubs that way too.
>>
>>> Sorry, I'm not understanding what you are trying to say on that one.
>>
>>> HWSPINLOCK   SPI_SPRD_ADI
>>
>>> but this combo is not allowed (with the patch) or causes build errors
>>> (without the patch):
>>>      m               y
>>
>> Why is that not just an || COMPILE_TEST dependency then?  The dependency
>> you're trying to introduce is weird and confusing, we shouldn't be
>> having to do things like that.
>
> It already uses COMPILE_TEST:
>
> config SPI_SPRD_ADI
>         tristate "Spreadtrum ADI controller"
>         depends on ARCH_SPRD || COMPILE_TEST
>         help
>           ADI driver based on SPI for Spreadtrum SoCs.
>
> but that allows build errors when SPI_SPRD_ADI=y and HWSPINLOCK=y.

You mean "when SPI_SPRD_ADI=y and HWSPINLOCK=m"?

> As for the dependency that I am adding:
> +       depends on HWSPINLOCK || HWSPINLOCK=n
>
> that idiom is used over and over again in Kconfig files to prevent this kind of
> build problem in loadable modules.

Indeed, it's confusing, but used all over the place.

The issue is builtin drivers that depend on a modular API.  The clean way
is to separate API and implementation, so the API can be builtin, and the
implementation can be modular.
Hence the API should provide stubs that call into function pointers, to be
registered by the module providing the implementation.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-09-25 19:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-21 18:02 [PATCH v2 -next] spi: fix spi-sprd-adi build errors when SPI_SPRD_ADI=y and HWSPINLOCK=m Randy Dunlap
2017-09-22  9:26 ` Mark Brown
2017-09-22  9:26   ` Mark Brown
2017-09-23  1:46   ` Randy Dunlap
2017-09-23  1:46     ` Randy Dunlap
2017-09-25 16:12     ` Mark Brown
2017-09-25 16:12       ` Mark Brown
2017-09-25 17:19       ` Randy Dunlap
2017-09-25 17:36         ` Mark Brown
2017-09-25 17:36           ` Mark Brown
2017-09-25 19:20         ` Geert Uytterhoeven [this message]
2017-09-25 19:20           ` Geert Uytterhoeven
2017-09-25 19:22           ` Mark Brown
2017-09-25 19:31             ` Randy Dunlap
2017-09-25 19:44               ` Mark Brown
2017-09-25 19:44                 ` Mark Brown
2017-09-25 19:53                 ` Randy Dunlap
2017-09-25 19:53                   ` Randy Dunlap
2017-09-25 21:11                   ` Mark Brown
2017-09-25 21:11                     ` Mark Brown
2017-09-25 22:32                     ` Randy Dunlap
2017-09-25 22:32                       ` Randy Dunlap

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='CAMuHMdXwv7s-uBM2J1Rf5fw+2=N_VcPxCYHartgUxb56yrR23A@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=rdunlap@infradead.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.