diff mbox series

[11/29] scsi: ufs: Remove unused constants and code

Message ID 20220331223424.1054715-12-bvanassche@acm.org
State Superseded
Headers show
Series UFS patches for kernel v5.19 | expand

Commit Message

Bart Van Assche March 31, 2022, 10:34 p.m. UTC
Commit 5b44a07b6bb2 ("scsi: ufs: Remove pre-defined initial voltage values
of device power") removed the code that uses the UFS_VREG_VCC* constants
and also the code that sets the min_uV and max_uV member variables. Hence
also remove these constants and that member variable.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/ufs/ufs.h    | 11 -----------
 drivers/scsi/ufs/ufshcd.c | 29 +++--------------------------
 2 files changed, 3 insertions(+), 37 deletions(-)

Comments

Stanley Chu April 7, 2022, 2:33 a.m. UTC | #1
Hi Bart, Avri,

On Tue, 2022-04-05 at 06:55 +0000, Avri Altman wrote:
> > 
> > On 4/1/22 23:59, Avri Altman wrote:
> > > > 
> > > > Commit 5b44a07b6bb2 ("scsi: ufs: Remove pre-defined initial
> > > > voltage
> > > > values of device power") removed the code that uses the
> > 
> > UFS_VREG_VCC*
> > > > constants and also the code that sets the min_uV and max_uV
> > > > member
> > > > variables. Hence also remove these constants and that member
> > > > variable.
> > > > 
> > > > Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> > > 
> > > Looks fine to me, but better get an ack from Stanley, because he
> > > specifically wrote in his commit log:
> > > "...
> > > Note that we keep struct ufs_vreg unchanged. This allows vendors
> > > to
> > >      configure proper min_uV and max_uV of any regulators to make
> > >      regulator_set_voltage() works during regulator toggling flow
> > > in the
> > >      future. Without specific vendor configurations, min_uV and
> > > max_uV will
> > 
> > be
> > >      NULL by default and UFS core driver will enable or disable
> > > the regulator
> > >      only without adjusting its voltage.
> > > ..."
> > 
> > (+Stanley)
> > 
> > Hi Stanley,
> > 
> > Can you take a look at this patch?
> 
> If Stanley won't comment by your v2 - please add my RB.
> 
> Thanks,
> Avri
> 

Fine to me: )

Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
index 4a00c24a3209..225b5b4a2a7e 100644
--- a/drivers/scsi/ufs/ufs.h
+++ b/drivers/scsi/ufs/ufs.h
@@ -562,15 +562,6 @@  struct ufs_query_res {
 	struct utp_upiu_query upiu_res;
 };
 
-#define UFS_VREG_VCC_MIN_UV	   2700000 /* uV */
-#define UFS_VREG_VCC_MAX_UV	   3600000 /* uV */
-#define UFS_VREG_VCC_1P8_MIN_UV    1700000 /* uV */
-#define UFS_VREG_VCC_1P8_MAX_UV    1950000 /* uV */
-#define UFS_VREG_VCCQ_MIN_UV	   1140000 /* uV */
-#define UFS_VREG_VCCQ_MAX_UV	   1260000 /* uV */
-#define UFS_VREG_VCCQ2_MIN_UV	   1700000 /* uV */
-#define UFS_VREG_VCCQ2_MAX_UV	   1950000 /* uV */
-
 /*
  * VCCQ & VCCQ2 current requirement when UFS device is in sleep state
  * and link is in Hibern8 state.
@@ -582,8 +573,6 @@  struct ufs_vreg {
 	const char *name;
 	bool always_on;
 	bool enabled;
-	int min_uV;
-	int max_uV;
 	int max_uA;
 };
 
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 1ed54f6aef82..a48362165672 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -8309,33 +8309,10 @@  static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba,
 static int ufshcd_config_vreg(struct device *dev,
 		struct ufs_vreg *vreg, bool on)
 {
-	int ret = 0;
-	struct regulator *reg;
-	const char *name;
-	int min_uV, uA_load;
-
-	BUG_ON(!vreg);
-
-	reg = vreg->reg;
-	name = vreg->name;
-
-	if (regulator_count_voltages(reg) > 0) {
-		uA_load = on ? vreg->max_uA : 0;
-		ret = ufshcd_config_vreg_load(dev, vreg, uA_load);
-		if (ret)
-			goto out;
+	if (regulator_count_voltages(vreg->reg) <= 0)
+		return 0;
 
-		if (vreg->min_uV && vreg->max_uV) {
-			min_uV = on ? vreg->min_uV : 0;
-			ret = regulator_set_voltage(reg, min_uV, vreg->max_uV);
-			if (ret)
-				dev_err(dev,
-					"%s: %s set voltage failed, err=%d\n",
-					__func__, name, ret);
-		}
-	}
-out:
-	return ret;
+	return ufshcd_config_vreg_load(dev, vreg, on ? vreg->max_uA : 0);
 }
 
 static int ufshcd_enable_vreg(struct device *dev, struct ufs_vreg *vreg)