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] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 11 Aug 2015 16:56:33 +0200
From:	Joerg Roedel <joro@...tes.org>
To:	Yong Wu <yong.wu@...iatek.com>
Cc:	Thierry Reding <treding@...dia.com>,
	Mark Rutland <mark.rutland@....com>,
	Matthias Brugger <matthias.bgg@...il.com>,
	Robin Murphy <robin.murphy@....com>,
	Will Deacon <will.deacon@....com>,
	Daniel Kurtz <djkurtz@...gle.com>,
	Tomasz Figa <tfiga@...gle.com>,
	Lucas Stach <l.stach@...gutronix.de>,
	Rob Herring <robh+dt@...nel.org>,
	Catalin Marinas <catalin.marinas@....com>,
	linux-mediatek@...ts.infradead.org,
	Sasha Hauer <kernel@...gutronix.de>,
	srv_heupstream@...iatek.com, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	iommu@...ts.linux-foundation.org, pebolle@...cali.nl,
	arnd@...db.de, mitchelh@...eaurora.org, youhua.li@...iatek.com,
	k.zhang@...iatek.com, frederic.chen@...iatek.com
Subject: Re: [PATCH v4 4/6] memory: mediatek: Add SMI driver

On Mon, Aug 03, 2015 at 06:21:17PM +0800, Yong Wu wrote:
> +static int mtk_smi_common_get(struct device *smidev)
> +{
> +	struct mtk_smi_common *smipriv = dev_get_drvdata(smidev);
> +	int ret;
> +
> +	ret = pm_runtime_get_sync(smidev);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = clk_prepare_enable(smipriv->clk_apb);
> +	if (ret) {
> +		dev_err(smidev, "Failed to enable the apb clock\n");
> +		goto err_put_pm;
> +	}
> +	ret = clk_prepare_enable(smipriv->clk_smi);
> +	if (ret) {
> +		dev_err(smidev, "Failed to enable the smi clock\n");
> +		goto err_disable_apb;
> +	}
> +	return ret;
> +
> +err_disable_apb:
> +	clk_disable_unprepare(smipriv->clk_apb);
> +err_put_pm:
> +	pm_runtime_put(smidev);
> +	return ret;
> +}

[...]

> +int mtk_smi_larb_get(struct device *larbdev)
> +{
> +	struct mtk_smi_larb *larbpriv = dev_get_drvdata(larbdev);
> +	struct mtk_larb_mmu *mmucfg = larbdev->archdata.iommu;
> +	int ret;
> +
> +	ret = mtk_smi_common_get(larbpriv->smi);
> +	if (ret)
> +		return ret;
> +
> +	ret = pm_runtime_get_sync(larbdev);
> +	if (ret < 0)
> +		goto err_put_smicommon;
> +
> +	ret = clk_prepare_enable(larbpriv->clk_apb);
> +	if (ret) {
> +		dev_err(larbdev, "Failed to enable the apb clock\n");
> +		goto err_put_pm;
> +	}
> +
> +	ret = clk_prepare_enable(larbpriv->clk_smi);
> +	if (ret) {
> +		dev_err(larbdev, "Failed to enable the smi clock\n");
> +		goto err_disable_apb;
> +	}

The clock enablement looks similar to the function above, maybe move it
to a helper function?


	Joerg

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ