[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250721135958.GE3137075@e132581.arm.com>
Date: Mon, 21 Jul 2025 14:59:58 +0100
From: Leo Yan <leo.yan@....com>
To: Suzuki K Poulose <suzuki.poulose@....com>
Cc: Mike Leach <mike.leach@...aro.org>,
James Clark <james.clark@...aro.org>,
Anshuman Khandual <anshuman.khandual@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 04/10] coresight: Appropriately disable programming
clocks
On Mon, Jul 21, 2025 at 12:40:38PM +0100, Suzuki Kuruppassery Poulose wrote:
> On 21/07/2025 11:48, Leo Yan wrote:
> > On Mon, Jul 21, 2025 at 10:15:22AM +0100, Suzuki Kuruppassery Poulose wrote:
> >
> > [...]
> >
> > > > diff --git a/include/linux/coresight.h b/include/linux/coresight.h
> > > > index 4ac65c68bbf44b98db22c3dad2d83a224ce5278e..dd2b4cc7a2b70cf060a3207548fe80e3824c489f 100644
> > > > --- a/include/linux/coresight.h
> > > > +++ b/include/linux/coresight.h
> > > > @@ -480,26 +480,16 @@ static inline bool is_coresight_device(void __iomem *base)
> > > > * Returns:
> > > > *
> > > > * clk - Clock is found and enabled
> > > > - * NULL - clock is not found
> > >
> > > This is still valid, right ?
> >
> > No. Since this patch uses devm_clk_get_enabled() to get a clock, if the
> > pclk is not found, it returns -ENOENT (see of_parse_clkspec()).
> >
> > Only the optional clock APIs (e.g., devm_clk_get_optional_enabled())
> > return a NULL pointer instead of -ENOENT when the clock is not found.
>
> This will break ACPI based systems, as we may not have a "pclk" described
> for them. We should be able to tolerate "no pclk"
Get it. How about change the code like below?
static inline struct clk *coresight_get_enable_apb_pclk(struct device *dev)
{
struct clk *pclk;
pclk = devm_clk_get_enabled(dev, "apb_pclk");
if (IS_ERR(pclk))
pclk = devm_clk_get_enabled(dev, "apb");
/* Tolerate no pclk for ACPI device */
if ((pclk == ERR_PTR(-ENOENT)) && has_acpi_companion(dev))
return NULL;
return pclk;
}
Powered by blists - more mailing lists