lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 29 Jul 2019 08:40:39 +0000
From:   Anson Huang <anson.huang@....com>
To:     Guido Günther <agx@...xcpu.org>
CC:     "rui.zhang@...el.com" <rui.zhang@...el.com>,
        "edubezval@...il.com" <edubezval@...il.com>,
        "daniel.lezcano@...aro.org" <daniel.lezcano@...aro.org>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "mark.rutland@....com" <mark.rutland@....com>,
        "shawnguo@...nel.org" <shawnguo@...nel.org>,
        "s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
        "kernel@...gutronix.de" <kernel@...gutronix.de>,
        "festevam@...il.com" <festevam@...il.com>,
        "mturquette@...libre.com" <mturquette@...libre.com>,
        "sboyd@...nel.org" <sboyd@...nel.org>,
        "l.stach@...gutronix.de" <l.stach@...gutronix.de>,
        Abel Vesa <abel.vesa@....com>,
        "andrew.smirnov@...il.com" <andrew.smirnov@...il.com>,
        "angus@...ea.ca" <angus@...ea.ca>,
        "ccaione@...libre.com" <ccaione@...libre.com>,
        Leonard Crestez <leonard.crestez@....com>,
        "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
        dl-linux-imx <linux-imx@....com>
Subject: RE: [PATCH 4/6] thermal: qoriq: Add clock operations

Hi, Guido

> On Fri, Jul 05, 2019 at 12:56:10PM +0800, Anson.Huang@....com wrote:
> > From: Anson Huang <Anson.Huang@....com>
> >
> > Some platforms like i.MX8MQ has clock control for this module, need to
> > add clock operations to make sure the driver is working properly.
> >
> > Signed-off-by: Anson Huang <Anson.Huang@....com>
> > ---
> >  drivers/thermal/qoriq_thermal.c | 24 ++++++++++++++++++++++++
> >  1 file changed, 24 insertions(+)
> >
> > diff --git a/drivers/thermal/qoriq_thermal.c
> > b/drivers/thermal/qoriq_thermal.c index 2b2f79b..0813c1b 100644
> > --- a/drivers/thermal/qoriq_thermal.c
> > +++ b/drivers/thermal/qoriq_thermal.c
> > @@ -2,6 +2,7 @@
> >  //
> >  // Copyright 2016 Freescale Semiconductor, Inc.
> >
> > +#include <linux/clk.h>
> >  #include <linux/module.h>
> >  #include <linux/platform_device.h>
> >  #include <linux/err.h>
> > @@ -72,6 +73,7 @@ struct qoriq_sensor {
> >
> >  struct qoriq_tmu_data {
> >  	struct qoriq_tmu_regs __iomem *regs;
> > +	struct clk *clk;
> >  	bool little_endian;
> >  	struct qoriq_sensor	*sensor[SITES_MAX];
> >  };
> > @@ -208,6 +210,19 @@ static int qoriq_tmu_probe(struct platform_device
> *pdev)
> >  		return PTR_ERR(data->regs);
> >  	}
> >
> > +	data->clk = devm_clk_get(&pdev->dev, NULL);
> > +	if (IS_ERR(data->clk)) {
> > +		if (PTR_ERR(data->clk) == -EPROBE_DEFER)
> > +			return -EPROBE_DEFER;
> > +		data->clk = NULL;
> > +	}
> 
> Wouldn't devm_clk_get_optional make more sense?

Yes, looks like it is better, will fix it in V2.

> 
> > +
> > +	ret = clk_prepare_enable(data->clk);
> > +	if (ret) {
> > +		dev_err(&pdev->dev, "Failed to enable clock\n");
> > +		return ret;
> > +	}
> > +
> >  	qoriq_tmu_init_device(data);	/* TMU initialization */
> >
> >  	ret = qoriq_tmu_calibration(pdev);	/* TMU calibration */
> > @@ -235,6 +250,8 @@ static int qoriq_tmu_remove(struct
> platform_device *pdev)
> >  	/* Disable monitoring */
> >  	tmu_write(data, TMR_DISABLE, &data->regs->tmr);
> >
> > +	clk_disable_unprepare(data->clk);
> > +
> >  	platform_set_drvdata(pdev, NULL);
> >
> >  	return 0;
> > @@ -250,14 +267,21 @@ static int __maybe_unused
> qoriq_tmu_suspend(struct device *dev)
> >  	tmr &= ~TMR_ME;
> >  	tmu_write(data, tmr, &data->regs->tmr);
> >
> > +	clk_disable_unprepare(data->clk);
> > +
> >  	return 0;
> >  }
> >
> >  static int __maybe_unused qoriq_tmu_resume(struct device *dev)  {
> >  	u32 tmr;
> > +	int ret;
> >  	struct qoriq_tmu_data *data = dev_get_drvdata(dev);
> >
> > +	ret = clk_prepare_enable(data->clk);
> > +	if (ret)
> > +		return ret;
> > +
> >  	/* Enable monitoring */
> >  	tmr = tmu_read(data, &data->regs->tmr);
> >  	tmr |= TMR_ME;
> 
> Apart from that it looks like what Fabio sent and what i tested so
> 
> Reviewed-by: Guido Günther <agx@...xcpu.org>

Thanks,
Anson

> 
> Cheers,
>  -- Guido
> 
> > --
> > 2.7.4
> >
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@...ts.infradead.org
> > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists
> > .infradead.org%2Fmailman%2Flistinfo%2Flinux-arm-
> kernel&amp;data=02%7C0
> >
> 1%7Canson.huang%40nxp.com%7C9263c240da82482af57908d713fc7d0b%7
> C686ea1d
> >
> 3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636999847472894624&amp;sdat
> a=0YAlK
> > V8ZS37vHFz311nOdBP8qBbqisvjFBtaSS1PV9k%3D&amp;reserved=0
> >

Powered by blists - more mailing lists