[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z6tgNjH6Qq5pe9Gt@smile.fi.intel.com>
Date: Tue, 11 Feb 2025 16:35:34 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Mark Brown <broonie@...nel.org>
Cc: David Lechner <dlechner@...libre.com>,
Jonathan Cameron <jic23@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Nuno Sá <nuno.sa@...log.com>,
Uwe Kleine-König <ukleinek@...nel.org>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Lars-Peter Clausen <lars@...afoo.de>,
David Jander <david@...tonic.nl>,
Martin Sperl <kernel@...tin.sperl.org>, linux-spi@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org,
Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH v8 01/17] spi: add basic support for SPI offloading
On Tue, Feb 11, 2025 at 04:31:45PM +0200, Andy Shevchenko wrote:
> On Tue, Feb 11, 2025 at 04:29:33PM +0200, Andy Shevchenko wrote:
> > On Tue, Feb 11, 2025 at 04:20:50PM +0200, Andy Shevchenko wrote:
> > > On Tue, Feb 11, 2025 at 01:00:08PM +0000, Mark Brown wrote:
> > > > On Mon, Feb 10, 2025 at 10:33:31PM +0200, Andy Shevchenko wrote:
> > > > > On Mon, Feb 10, 2025 at 05:48:00PM +0000, Mark Brown wrote:
> > > > > > On Mon, Feb 10, 2025 at 11:11:23AM -0600, David Lechner wrote:
> > > >
> > > > > > > In this case, we specifically split up the headers so that the only time you
> > > > > > > would ever include this header is if you need to call functions in this
> > > > > > > namespace (i.e. struct definitions are in linux/spi/offload/types.h which
> > > > > > > doesn't import the namespace). So this doesn't actually seem like a problem
> > > > > > > to me.
> > > >
> > > > > > Indeed - I can't see any case where a user would need the header without
> > > > > > needing the namespace.
> > > >
> > > > > You are looking from the other end. What I'm telling is that anyone who adds
> > > > > a header, automatically gets a namespace. What's the point to have namespace
> > > > > if it won't easily prevent from (ab)using it in the code. I consider putting
> > > > > MODULE_IMPORT_NS() in the headers a bit weird.
> > > >
> > > > Sure, but there's no case where anyone should ever be adding the header
> > > > without adding the namespace which does rather sound like the sort of
> > > > thing where you should just move the namespace addition to the header.
> > >
> > > $ git grep -lw MODULE_IMPORT_NS | wc -l
> > > 651
> > >
> > > $ git grep -lw MODULE_IMPORT_NS | grep '\.h$'
> > >
> > > drivers/base/firmware_loader/sysfs.h
> > > drivers/iio/adc/ltc2497.h
> > > drivers/pwm/pwm-dwc.h
> > > ^^^ These ones are probably fine as they are not in include/
> > >
> > > include/kunit/visibility.h
> > > include/linux/module.h
> > > include/linux/pwm.h
> > >
> > > I believe these three are misuses of MODULE_IMPORT_NS(). Because one may add
> >
> > _Two_, of course, module.h provides the macro :-)
>
> And after looking into include/kunit/visibility.h it becomes only a single one.
> So, PWM is abuser of MODULE_IMPORT_NS() and this series added one more.
> > > a header just as a "proxy" one (copy'n'paste, for example) and we know that is
> > > real as we saw a lot of code that has semi-random header inclusion blocks.
And thinking of more realistic example when we want header and do *not* want a
namespace is the simple use of the macro / or data type from it without
actually relying on the APIs.
So, in case of the header structure like
foo_constants.h
foo_types.h
foo_api.h
foo_uplevel_something.h
The MODULE_IMPORT_NS() would make sense only to foo_api.h. And I still would
question that. As I explained that header may simply become a stale one or
being used by a mistake.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists