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: Mon, 15 Apr 2024 09:03:05 +0000
From: Peter Wang (王信友) <peter.wang@...iatek.com>
To: "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
	"angelogioacchino.delregno@...labora.com"
	<angelogioacchino.delregno@...labora.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
	"jejb@...ux.ibm.com" <jejb@...ux.ibm.com>, "devicetree@...r.kernel.org"
	<devicetree@...r.kernel.org>, "avri.altman@....com" <avri.altman@....com>,
	"bvanassche@....org" <bvanassche@....org>, "martin.petersen@...cle.com"
	<martin.petersen@...cle.com>, "broonie@...nel.org" <broonie@...nel.org>,
	"alim.akhtar@...sung.com" <alim.akhtar@...sung.com>, "chu.stanley@...il.com"
	<chu.stanley@...il.com>, "conor+dt@...nel.org" <conor+dt@...nel.org>,
	"robh@...nel.org" <robh@...nel.org>, "lgirdwood@...il.com"
	<lgirdwood@...il.com>, "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "krzysztof.kozlowski+dt@...aro.org"
	<krzysztof.kozlowski+dt@...aro.org>,
	Stanley Chu (朱原陞) <stanley.chu@...iatek.com>,
	"matthias.bgg@...il.com" <matthias.bgg@...il.com>
Subject: Re: [PATCH v3 1/8] scsi: ufs: ufs-mediatek: Remove useless
 mediatek,ufs-support-va09 property

On Mon, 2024-04-15 at 09:53 +0200, AngeloGioacchino Del Regno wrote:
> Remove checking the mediatek,ufs-support-va09 property to decide
> whether to try to support the VA09 regulator handling and change
> the ufs_mtk_init_va09_pwr_ctrl() function to make it call
> devm_regulator_get_optional(): if the regulator is present, then
> we set the UFS_MTK_CAP_VA09_PWR_CTRL, effectively enabling the
> handling of the VA09 regulator based on that.
> 
> Also, make sure to pass the return value of the call to
> devm_regulator_get_optional() to the probe function, so that
> if it returns a probe deferral, the appropriate action will be
> taken.
> 
> While at it, remove the error print (disguised as info...) when
> the va09 regulator was not found.
> 
> Fixes: ac8c2459091c ("scsi: ufs-mediatek: Decouple features from
> platform bindings")
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@...labora.com>
> ---
>  drivers/ufs/host/ufs-mediatek.c | 34 +++++++++++++++++++++++------
> ----
>  1 file changed, 24 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-
> mediatek.c
> index 0b0c923b1d7b..e4643ac49033 100644
> --- a/drivers/ufs/host/ufs-mediatek.c
> +++ b/drivers/ufs/host/ufs-mediatek.c
> @@ -622,27 +622,38 @@ static void ufs_mtk_init_boost_crypt(struct
> ufs_hba *hba)
>  	return;
>  }
>  
> -static void ufs_mtk_init_va09_pwr_ctrl(struct ufs_hba *hba)
> +static int ufs_mtk_init_va09_pwr_ctrl(struct ufs_hba *hba)
>  {
>  	struct ufs_mtk_host *host = ufshcd_get_variant(hba);
> +	int ret;
>  
> -	host->reg_va09 = regulator_get(hba->dev, "va09");
> -	if (IS_ERR(host->reg_va09))
> -		dev_info(hba->dev, "failed to get va09");
> -	else
> -		host->caps |= UFS_MTK_CAP_VA09_PWR_CTRL;
> +	host->reg_va09 = devm_regulator_get_optional(hba->dev, "va09");
> 

Hi Angelo,

Mediatek may have pmic va09 but is not used by ufs.
The real va09 use module will have abnormal behavior if ufs control his
power.

Thanks.
Peter



> +	if (IS_ERR(host->reg_va09)) {
> +		ret = PTR_ERR(host->reg_va09);
> +
> +		/* Return an error only if this is a deferral */
> +		if (ret == -EPROBE_DEFER)
> +			return ret;
> +
> +		return 0;
> +	}
> +
> +	host->caps |= UFS_MTK_CAP_VA09_PWR_CTRL;
> +	return 0;
>  }
>  
> -static void ufs_mtk_init_host_caps(struct ufs_hba *hba)
> +static int ufs_mtk_init_host_caps(struct ufs_hba *hba)
>  {
>  	struct ufs_mtk_host *host = ufshcd_get_variant(hba);
>  	struct device_node *np = hba->dev->of_node;
> +	int ret;
>  
>  	if (of_property_read_bool(np, "mediatek,ufs-boost-crypt"))
>  		ufs_mtk_init_boost_crypt(hba);
>  
> -	if (of_property_read_bool(np, "mediatek,ufs-support-va09"))
> -		ufs_mtk_init_va09_pwr_ctrl(hba);
> +	ret = ufs_mtk_init_va09_pwr_ctrl(hba);
> +	if (ret)
> +		return ret;
>  
>  	if (of_property_read_bool(np, "mediatek,ufs-disable-ah8"))
>  		host->caps |= UFS_MTK_CAP_DISABLE_AH8;
> @@ -663,6 +674,7 @@ static void ufs_mtk_init_host_caps(struct ufs_hba
> *hba)
>  		host->caps |= UFS_MTK_CAP_RTFF_MTCMOS;
>  
>  	dev_info(hba->dev, "caps: 0x%x", host->caps);
> +	return 0;
>  }
>  
>  static void ufs_mtk_scale_perf(struct ufs_hba *hba, bool scale_up)
> @@ -985,7 +997,9 @@ static int ufs_mtk_init(struct ufs_hba *hba)
>  	}
>  
>  	/* Initialize host capability */
> -	ufs_mtk_init_host_caps(hba);
> +	err = ufs_mtk_init_host_caps(hba);
> +	if (err)
> +		goto out;
>  
>  	ufs_mtk_init_mcq_irq(hba);
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ