From: Niklas Cassel <cassel@kernel.org>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: Rosen Penev <rosenp@gmail.com>,
linux-ide@vger.kernel.org,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ata: sata_dwc_460ex: use platform_get_irq()
Date: Tue, 30 Jun 2026 11:55:56 +0200 [thread overview]
Message-ID: <akOSrMbpFIO_VLul@ryzen> (raw)
In-Reply-To: <2865750f-9bab-47d8-b4c9-9cf1cbef7834@kernel.org>
On Tue, Jun 30, 2026 at 06:22:52PM +0900, Damien Le Moal wrote:
> On 6/30/26 18:06, Niklas Cassel wrote:
> > On Tue, Jun 30, 2026 at 06:00:46PM +0900, Damien Le Moal wrote:
> >> On 6/30/26 17:52, Rosen Penev wrote:
> >>>>> Inside ifdef, that is probably why Sashiko did not catch this new warning.
> >>>>>
> >>>>> Rosen, I suggest that you use dev->of_node directly within the ifdef, and drop the local np variable.
> >>>> device_property_present is probably better. But yeah. I'll whip up a v2.
> >>> thinking about this some more. Should use IS_ENABLED to prevent hiding
> >>> this code from the compiler.
> >>
> >> What code are you talking about ?
> >> What is in the #ifdef CONFIG_SATA_DWC_OLD_DMA ?
> >> CONFIG_SATA_DWC_OLD_DMA is determined automatically by Kconfig. So this is not
> >> hidding anything and why I did not see the warning in my compile tests
> >> (CONFIG_SATA_DWC_OLD_DMA was enabled for me). The report was for Sparc, and
> >> CONFIG_SATA_DWC_OLD_DMA was disabled so the unused variable warning showed up.
> >
> > I think he means: keep the local np variable,
> > and replace the #ifdef with
> > if (IS_ENABLED(CONFIG_SATA_DWC_OLD_DMA) && !of_property_present(np, "dmas")) {
> >
> >
> > I think it will work for both CONFIG_SATA_DWC_OLD_DMA=y and
> > CONFIG_SATA_DWC_OLD_DMA=n without giving any warnings.
>
> I do not think it will. The if() will be compiled out if IS_ENABLED() is false,
> but the variable declaration will remain and so will the warning. Unless that
> declaration also goes away, IS_ENABLED() will not solve the issue. But if the
> variable is removed, I gree is is a lot cleaner !
The point of using IS_ENABLED, is that the compiler will see the code
(that is what Rosen meant), and the code that is not used will be
eliminated using dead code elimination from the compiler.
The statement:
if (0 && !of_property_present(np, "dmas")) {
Will not make the compiler consider np as unused.
I even verified it using:
if (IS_ENABLED(CONFIG_SATA_DWC_OLD_DMA) && !of_property_present(np, "dmas")) {
and if did not give my any warning when CONFIG_SATA_DWC_OLD_DMA=n.
However, I had to comment out the call to sata_dwc_dma_init_old()
since sata_dwc_dma_init_old() is only defined inside #ifdef...
Sure, we could create a dummy / stub for that function, but to be honest,
I think my earlier suggestion of just using dev->of_node directly within
the ifdef, and drop the local np variable would be the smallest change.
Kind regards,
Niklas
next prev parent reply other threads:[~2026-06-30 9:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-28 23:03 [PATCH] ata: sata_dwc_460ex: use platform_get_irq() Rosen Penev
2026-06-29 8:21 ` Niklas Cassel
2026-06-29 23:58 ` Damien Le Moal
2026-06-30 7:41 ` Niklas Cassel
2026-06-30 8:21 ` Damien Le Moal
2026-06-30 8:30 ` Niklas Cassel
2026-06-30 8:33 ` Rosen Penev
2026-06-30 8:52 ` Rosen Penev
2026-06-30 9:00 ` Damien Le Moal
2026-06-30 9:06 ` Niklas Cassel
2026-06-30 9:22 ` Damien Le Moal
2026-06-30 9:55 ` Niklas Cassel [this message]
2026-06-30 10:06 ` Damien Le Moal
2026-06-30 11:16 ` Niklas Cassel
2026-06-30 20:11 ` Rosen Penev
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=akOSrMbpFIO_VLul@ryzen \
--to=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rosenp@gmail.com \
/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