diff mbox series

[v3,3/5] phy: samsung: ufs: constify samsung_ufs_phy_cfg

Message ID 20220603020410.2976-4-chanho61.park@samsung.com (mailing list archive)
State New
Headers show
Series [v3,1/5] dt-bindings: phy: samsung,ufs-phy: make pmu-syscon as phandle-array | expand

Commit Message

Chanho Park June 3, 2022, 2:04 a.m. UTC
Put const qualifier of samsung_ufs_phy_cfg pointer because they will
not be changed from drvdata.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
---
 drivers/phy/samsung/phy-samsung-ufs.c | 4 ++--
 drivers/phy/samsung/phy-samsung-ufs.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Krzysztof Kozlowski June 5, 2022, 4:09 p.m. UTC | #1
On 03/06/2022 04:04, Chanho Park wrote:
> Put const qualifier of samsung_ufs_phy_cfg pointer because they will
> not be changed from drvdata.
> 
> Signed-off-by: Chanho Park <chanho61.park@samsung.com>
> ---
>  drivers/phy/samsung/phy-samsung-ufs.c | 4 ++--
>  drivers/phy/samsung/phy-samsung-ufs.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/phy/samsung/phy-samsung-ufs.c b/drivers/phy/samsung/phy-samsung-ufs.c
> index ed272631e8aa..e1e26da27245 100644
> --- a/drivers/phy/samsung/phy-samsung-ufs.c
> +++ b/drivers/phy/samsung/phy-samsung-ufs.c
> @@ -75,7 +75,7 @@ static int samsung_ufs_phy_wait_for_lock_acq(struct phy *phy)
>  static int samsung_ufs_phy_calibrate(struct phy *phy)
>  {
>  	struct samsung_ufs_phy *ufs_phy = get_samsung_ufs_phy(phy);
> -	struct samsung_ufs_phy_cfg **cfgs = ufs_phy->cfgs;
> +	const struct samsung_ufs_phy_cfg **cfgs = ufs_phy->cfgs;
>  	const struct samsung_ufs_phy_cfg *cfg;
>  	int err = 0;
>  	int i;
> @@ -327,7 +327,7 @@ static int samsung_ufs_phy_probe(struct platform_device *pdev)
>  	drvdata = match->data;
>  	phy->dev = dev;
>  	phy->drvdata = drvdata;
> -	phy->cfgs = (struct samsung_ufs_phy_cfg **)drvdata->cfgs;
> +	phy->cfgs = drvdata->cfgs;
>  	phy->isol = &drvdata->isol;
>  	phy->lane_cnt = PHY_DEF_LANE_CNT;
>  
> diff --git a/drivers/phy/samsung/phy-samsung-ufs.h b/drivers/phy/samsung/phy-samsung-ufs.h
> index 1788b356cf56..101497698f23 100644
> --- a/drivers/phy/samsung/phy-samsung-ufs.h
> +++ b/drivers/phy/samsung/phy-samsung-ufs.h
> @@ -121,7 +121,7 @@ struct samsung_ufs_phy {
>  	struct clk *rx0_symbol_clk;
>  	struct clk *rx1_symbol_clk;
>  	const struct samsung_ufs_phy_drvdata *drvdata;
> -	struct samsung_ufs_phy_cfg **cfgs;
> +	const struct samsung_ufs_phy_cfg **cfgs;

I still think this should be array of const pointers to const data, so:
	const struct samsung_ufs_phy_cfg * const *cfgs;
I proposed this in last email.

Best regards,
Krzysztof
Chanho Park June 7, 2022, 7:12 a.m. UTC | #2
> > -	struct samsung_ufs_phy_cfg **cfgs;
> > +	const struct samsung_ufs_phy_cfg **cfgs;
> 
> I still think this should be array of const pointers to const data, so:
> 	const struct samsung_ufs_phy_cfg * const *cfgs; I proposed this in
> last email.

Make sense. I'll change this as you suggested.

Best Regards,
Chanho Park
diff mbox series

Patch

diff --git a/drivers/phy/samsung/phy-samsung-ufs.c b/drivers/phy/samsung/phy-samsung-ufs.c
index ed272631e8aa..e1e26da27245 100644
--- a/drivers/phy/samsung/phy-samsung-ufs.c
+++ b/drivers/phy/samsung/phy-samsung-ufs.c
@@ -75,7 +75,7 @@  static int samsung_ufs_phy_wait_for_lock_acq(struct phy *phy)
 static int samsung_ufs_phy_calibrate(struct phy *phy)
 {
 	struct samsung_ufs_phy *ufs_phy = get_samsung_ufs_phy(phy);
-	struct samsung_ufs_phy_cfg **cfgs = ufs_phy->cfgs;
+	const struct samsung_ufs_phy_cfg **cfgs = ufs_phy->cfgs;
 	const struct samsung_ufs_phy_cfg *cfg;
 	int err = 0;
 	int i;
@@ -327,7 +327,7 @@  static int samsung_ufs_phy_probe(struct platform_device *pdev)
 	drvdata = match->data;
 	phy->dev = dev;
 	phy->drvdata = drvdata;
-	phy->cfgs = (struct samsung_ufs_phy_cfg **)drvdata->cfgs;
+	phy->cfgs = drvdata->cfgs;
 	phy->isol = &drvdata->isol;
 	phy->lane_cnt = PHY_DEF_LANE_CNT;
 
diff --git a/drivers/phy/samsung/phy-samsung-ufs.h b/drivers/phy/samsung/phy-samsung-ufs.h
index 1788b356cf56..101497698f23 100644
--- a/drivers/phy/samsung/phy-samsung-ufs.h
+++ b/drivers/phy/samsung/phy-samsung-ufs.h
@@ -121,7 +121,7 @@  struct samsung_ufs_phy {
 	struct clk *rx0_symbol_clk;
 	struct clk *rx1_symbol_clk;
 	const struct samsung_ufs_phy_drvdata *drvdata;
-	struct samsung_ufs_phy_cfg **cfgs;
+	const struct samsung_ufs_phy_cfg **cfgs;
 	const struct pmu_isol *isol;
 	u8 lane_cnt;
 	int ufs_phy_state;