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]
Message-ID: <18146544c3563868e84621708d53825f31849079.camel@mediatek.com>
Date: Wed, 19 Mar 2025 03:06:50 +0000
From: Friday Yang (杨阳) <Friday.Yang@...iatek.com>
To: "robh@...nel.org" <robh@...nel.org>, "matthias.bgg@...il.com"
	<matthias.bgg@...il.com>, Yong Wu (吴勇)
	<Yong.Wu@...iatek.com>, "p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
	"conor+dt@...nel.org" <conor+dt@...nel.org>, "krzk@...nel.org"
	<krzk@...nel.org>, AngeloGioacchino Del Regno
	<angelogioacchino.delregno@...labora.com>
CC: "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "linux-mediatek@...ts.infradead.org"
	<linux-mediatek@...ts.infradead.org>, "devicetree@...r.kernel.org"
	<devicetree@...r.kernel.org>, Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@...iatek.com>
Subject: Re: [PATCH v5 2/2] memory: mtk-smi: mt8188: Add SMI reset and clamp
 for MT8188

On Wed, 2025-03-12 at 13:02 +0100, Krzysztof Kozlowski wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> On 11/03/2025 13:23, Friday Yang wrote:
> >  static int mtk_smi_device_link_common(struct device *dev, struct
> > device **com_dev)
> >  {
> >       struct platform_device *smi_com_pdev;
> > @@ -528,6 +598,53 @@ static int mtk_smi_dts_clk_init(struct device
> > *dev, struct mtk_smi *smi,
> >       return ret;
> >  }
> > 
> > +static int mtk_smi_larb_parse_clamp_optional(struct mtk_smi_larb
> > *larb)
> > +{
> > +     struct device *dev = larb->dev;
> > +     const struct mtk_smi_larb_gen *larb_gen = larb->larb_gen;
> > +     u32 larb_id;
> > +     int ret;
> > +
> > +     /**
> 
> Not a kerneldoc
> 

OK, I will fix it like this:
/*
 * Only SMI LARBs ...
 */

> > +      * Only SMI LARBs in camera, image and IPE subsys need to
> > +      * apply clamp and reset operations, others can be skipped.
> > +      */
> > +     ret = of_property_read_u32(dev->of_node, "mediatek,larb-id",
> > &larb_id);
> 
> 
> ...
> 
> 
> >  static const struct mtk_smi_common_plat mtk_smi_common_mt8192 = {
> >       .type     = MTK_SMI_GEN2,
> >       .has_gals = true,
> > @@ -729,6 +862,7 @@ static const struct of_device_id
> > mtk_smi_common_of_ids[] = {
> >       {.compatible = "mediatek,mt8186-smi-common", .data =
> > &mtk_smi_common_mt8186},
> >       {.compatible = "mediatek,mt8188-smi-common-vdo", .data =
> > &mtk_smi_common_mt8188_vdo},
> >       {.compatible = "mediatek,mt8188-smi-common-vpp", .data =
> > &mtk_smi_common_mt8188_vpp},
> > +     {.compatible = "mediatek,mt8188-smi-sub-common", .data =
> > &mtk_smi_sub_common_mt8188},
> >       {.compatible = "mediatek,mt8192-smi-common", .data =
> > &mtk_smi_common_mt8192},
> >       {.compatible = "mediatek,mt8195-smi-common-vdo", .data =
> > &mtk_smi_common_mt8195_vdo},
> >       {.compatible = "mediatek,mt8195-smi-common-vpp", .data =
> > &mtk_smi_common_mt8195_vpp},
> > @@ -787,7 +921,10 @@ static int mtk_smi_common_probe(struct
> > platform_device *pdev)
> >                       return ret;
> >       }
> > 
> > -     pm_runtime_enable(dev);
> > +     ret = devm_pm_runtime_enable(dev);
> > +     if (ret)
> > +             return ret;
> > +
> >       platform_set_drvdata(pdev, common);
> >       return 0;
> >  }
> > @@ -798,7 +935,6 @@ static void mtk_smi_common_remove(struct
> > platform_device *pdev)
> > 
> >       if (common->plat->type == MTK_SMI_GEN2_SUB_COMM)
> >               device_link_remove(&pdev->dev, common-
> > >smi_common_dev);
> > -     pm_runtime_disable(&pdev->dev);
> 
> Does not look related to this patch. Is it some sort of cleanup to
> devm?

This 'devm' modification aims to remove 'pm_runtime_disable' and
'err_pm_disable', which would make the code more efficient. 
If I insist on using 'pm_runtime_enable', I would need to add another
'goto err_pm_disable', which is not an ideal solution. Just as below,

	ret = mtk_smi_larb_parse_clamp_optional(larb);
	if (ret)
		goto err_link_remove;

	ret = mtk_smi_larb_parse_reset_optional(larb);
	if (ret)
		goto err_link_remove;

	pm_runtime_enable(dev);
	platform_set_drvdata(pdev, larb);
	ret = component_add(dev, &mtk_smi_larb_component_ops);
	if (ret)
		goto err_pm_disable;

	return 0;

err_pm_disable:
	pm_runtime_disable(dev);
err_link_remove:
	device_link_remove(dev, larb->smi_common_dev);
	return ret;

Therefore, I prefer to use 'devm_pm_runtime_enable' here. Please let me
know if you have any concerns, thanks!

> 
> Best regards,
> Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ