From: Greg KH <gregkh@linuxfoundation.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Andy Shevchenko" <andriy.shevchenko@intel.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Andy Shevchenko" <andy.shevchenko@gmail.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
sboyd@kernel.org, jic23@kernel.org, nuno.sa@analog.com,
andy@kernel.org, arnd@arndb.de, srini@kernel.org,
vkoul@kernel.org, kishon@kernel.org, sre@kernel.org,
krzysztof.kozlowski@linaro.org, linux-arm-msm@vger.kernel.org,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-phy@lists.infradead.org, linux-pm@vger.kernel.org,
kernel@collabora.com, wenst@chromium.org,
casey.connolly@linaro.org,
"Konrad Dybcio" <konrad.dybcio@oss.qualcomm.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>
Subject: Re: [PATCH v4 2/7] nvmem: qcom-spmi-sdam: Migrate to devm_spmi_subdevice_alloc_and_add()
Date: Fri, 19 Sep 2025 17:37:03 +0200 [thread overview]
Message-ID: <2025091902-dwelled-calculate-c755@gregkh> (raw)
In-Reply-To: <8702fd35-945a-4d20-bc37-410c74c70da6@baylibre.com>
On Fri, Sep 19, 2025 at 10:20:29AM -0500, David Lechner wrote:
> On 9/19/25 10:13 AM, Greg KH wrote:
> > On Fri, Sep 19, 2025 at 10:05:28AM -0500, David Lechner wrote:
> >> On 9/19/25 8:59 AM, Greg KH wrote:
> >>> On Thu, Sep 18, 2025 at 10:00:29PM +0300, Andy Shevchenko wrote:
> >>>> I,o.w. I principally disagree on putting MODULE_IMPORT_NS() into the header
> >>>> file.
> >>>
> >>> Yes, please never do that, it defeats the purpose of module namespaces
> >>> completly. If you don't want to have module namespaces, don't use them
> >>> for your subsytem. Don't use them and then make them moot by putting
> >>> MODULE_IMPORT_NS() in the .h file for the symbols as that's pointless.
> >>>
> >>> thanks,
> >>>
> >>> greg k-h
> >>
> >>
> >> Could someone suggest some additional explanation to add to
> >> Documentation/core-api/symbol-namespaces.rst to explain the
> >> reasoning behind this?
> >>
> >> Right now, the only part of that document that say _why_ we have
> >> module namespces says:
> >>
> >> That is useful for documentation purposes (think of the
> >> SUBSYSTEM_DEBUG namespace) as well as for limiting the
> >> availability of a set of symbols for use in other parts
> >> of the kernel.
> >>
> >> So I don't see the connection between this explanation and and:
> >>
> >> [Putting MODULE_IMPORT_NS() into the header] defeats
> >> the purpose of module namespaces completely.
> >>
> >> I am guilty of putting it in a header, so if I need to fix that
> >> I would like to actually understand why first. Andy has mentioned
> >> something about potential abuses, but without any example, I haven't
> >> been able to understand what this would actually actually look like.
> >> Or maybe there is some other reason that Greg is thinking of that
> >> hasn't been mentioned yet?
> >
> > Let me turn it around, _why_ would you want your exports in a namespace
> > at all if you just are putting a MODULE_IMPORT_NS() in the .h file at
> > the same time? What is this giving you at all compared to just a normal
> > MODULE_EXPORT() marking for your exports?
> >
> > I know what it gives me when I don't put it in a .h file, but I think
> > that might be different from what you are thinking here :)
> >
> > thanks,
> >
> > greg k-h
>
> Up to now, my (naive) understanding was that the point module namespaces
> is to reduce the number of symbols in the global namespace because having
> too many symbols there was starting to cause problems. So moving symbols
> to another namespace was a "good thing".
Yes, it is a "good thing" overall, but by just making all of your
symbols in a namespace, and then including it in the .h file, that does
the same exact thing as before (i.e. anyone that includes that .h file
puts the symbols into the global namespace with that prefix.)
Ideally, the goal was to be able to easily see in a module, what symbol
namespaces they depend on, which requires them to put MODULE_IMPORT_NS()
in the module to get access to those symbols. dmabuf has done this very
well, making it obvious to the maintainers of that subsystem that they
should be paying attention to those users.
For other "tiny" subsystems, it just slots away their symbols so that no
one else should ever be using them, and it makes it blindingly obvious
if they do. For example, the usb-storage symbols, anyone that does:
MODULE_IMPORT_NS("USB_STORAGE");
had better be living in drivers/usb/storage/ otherwise I need to have a
word with those offenders :)
So it's a way of "tidying" up things, and to make things more explicit
than just having to rely on searching a tree and looking for .h include
usage. Right now, you are kind of defeating that by just allowing a .h
to be included and you don't get any benifit of being able to watch out
for who is actually using those symbols overall.
Hope this helps,
greg k-h
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2025-09-19 15:37 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-16 8:44 [PATCH v4 0/7] SPMI: Implement sub-devices and migrate drivers AngeloGioacchino Del Regno
2025-09-16 8:44 ` [PATCH v4 1/7] spmi: Implement spmi_subdevice_alloc_and_add() and devm variant AngeloGioacchino Del Regno
2025-09-16 13:25 ` Uwe Kleine-König
2025-09-17 11:41 ` AngeloGioacchino Del Regno
2025-09-17 14:57 ` Uwe Kleine-König
2025-09-18 10:34 ` AngeloGioacchino Del Regno
2025-09-17 16:24 ` Sebastian Reichel
2025-09-16 8:44 ` [PATCH v4 2/7] nvmem: qcom-spmi-sdam: Migrate to devm_spmi_subdevice_alloc_and_add() AngeloGioacchino Del Regno
2025-09-16 13:24 ` Uwe Kleine-König
2025-09-16 13:35 ` Andy Shevchenko
2025-09-16 15:11 ` Uwe Kleine-König
2025-09-16 16:20 ` Andy Shevchenko
2025-09-17 9:15 ` AngeloGioacchino Del Regno
2025-09-17 12:47 ` Uwe Kleine-König
2025-09-18 19:00 ` Andy Shevchenko
2025-09-19 13:59 ` Greg KH
2025-09-19 15:05 ` David Lechner
2025-09-19 15:13 ` Greg KH
2025-09-19 15:20 ` David Lechner
2025-09-19 15:37 ` Greg KH [this message]
2025-09-20 16:41 ` Uwe Kleine-König
2025-09-24 12:32 ` Greg KH
2025-09-19 16:18 ` Uwe Kleine-König
2025-09-16 8:44 ` [PATCH v4 3/7] power: reset: qcom-pon: " AngeloGioacchino Del Regno
2025-09-16 8:44 ` [PATCH v4 4/7] phy: qualcomm: eusb2-repeater: " AngeloGioacchino Del Regno
2025-09-17 9:30 ` kernel test robot
2025-09-16 8:44 ` [PATCH v4 5/7] misc: qcom-coincell: " AngeloGioacchino Del Regno
2025-09-16 8:44 ` [PATCH v4 6/7] iio: adc: qcom-spmi-iadc: " AngeloGioacchino Del Regno
2025-09-16 8:44 ` [PATCH v4 7/7] iio: adc: qcom-spmi-iadc: Remove regmap R/W wrapper functions AngeloGioacchino Del Regno
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=2025091902-dwelled-calculate-c755@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=andriy.shevchenko@intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=arnd@arndb.de \
--cc=casey.connolly@linaro.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=kernel@collabora.com \
--cc=kishon@kernel.org \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=nuno.sa@analog.com \
--cc=sboyd@kernel.org \
--cc=sre@kernel.org \
--cc=srini@kernel.org \
--cc=u.kleine-koenig@baylibre.com \
--cc=vkoul@kernel.org \
--cc=wenst@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).