Message ID | 20220630014425.3643-1-cw9316.lee@samsung.com |
---|---|
State | New |
Headers | show |
Series | Add define SDHCI_POWER_OFF to improve readability | expand |
On 30/06/22 04:44, Chanwoo Lee wrote: > From: ChanWoo Lee <cw9316.lee@samsung.com> > > //sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); > A value of '0' has two meanings. > - Clear the register. //2084 line > - Set power off. //2075 line > > To clarify this and improve readability, > use the 'power_off' value instead of '0'. The distinction does not seem that important and there is not much chance such a convention will always be followed in the future, so I would prefer to leave it as is. > > Signed-off-by: ChanWoo Lee <cw9316.lee@samsung.com> > --- > drivers/mmc/host/sdhci-pci-core.c | 3 ++- > drivers/mmc/host/sdhci.c | 6 +++--- > drivers/mmc/host/sdhci.h | 1 + > 3 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c > index 622b7de96c7f..a732eec69bf8 100644 > --- a/drivers/mmc/host/sdhci-pci-core.c > +++ b/drivers/mmc/host/sdhci-pci-core.c > @@ -584,7 +584,8 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, > if (intel_host->needs_pwr_off) { > intel_host->needs_pwr_off = false; > if (mode != MMC_POWER_OFF) { > - sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); > + sdhci_writeb(host, SDHCI_POWER_OFF, > + SDHCI_POWER_CONTROL); > usleep_range(10000, 12500); > } > } > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index 7689ffec5ad1..602fb3a088e7 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -2029,7 +2029,7 @@ static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode, > if (mode != MMC_POWER_OFF) > sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL); > else > - sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); > + sdhci_writeb(host, SDHCI_POWER_OFF, SDHCI_POWER_CONTROL); > } > > void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode, > @@ -2075,8 +2075,8 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode, > > host->pwr = pwr; > > - if (pwr == 0) { > - sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); > + if (pwr == SDHCI_POWER_OFF) { > + sdhci_writeb(host, SDHCI_POWER_OFF, SDHCI_POWER_CONTROL); > if (host->quirks2 & SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON) > sdhci_runtime_pm_bus_off(host); > } else { > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h > index 95a08f09df30..f35d6d7b8326 100644 > --- a/drivers/mmc/host/sdhci.h > +++ b/drivers/mmc/host/sdhci.h > @@ -95,6 +95,7 @@ > #define SDHCI_CTRL_CDTEST_EN 0x80 > > #define SDHCI_POWER_CONTROL 0x29 > +#define SDHCI_POWER_OFF 0x00 > #define SDHCI_POWER_ON 0x01 > #define SDHCI_POWER_180 0x0A > #define SDHCI_POWER_300 0x0C
diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c index 622b7de96c7f..a732eec69bf8 100644 --- a/drivers/mmc/host/sdhci-pci-core.c +++ b/drivers/mmc/host/sdhci-pci-core.c @@ -584,7 +584,8 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, if (intel_host->needs_pwr_off) { intel_host->needs_pwr_off = false; if (mode != MMC_POWER_OFF) { - sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); + sdhci_writeb(host, SDHCI_POWER_OFF, + SDHCI_POWER_CONTROL); usleep_range(10000, 12500); } } diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 7689ffec5ad1..602fb3a088e7 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2029,7 +2029,7 @@ static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode, if (mode != MMC_POWER_OFF) sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL); else - sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); + sdhci_writeb(host, SDHCI_POWER_OFF, SDHCI_POWER_CONTROL); } void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode, @@ -2075,8 +2075,8 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode, host->pwr = pwr; - if (pwr == 0) { - sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); + if (pwr == SDHCI_POWER_OFF) { + sdhci_writeb(host, SDHCI_POWER_OFF, SDHCI_POWER_CONTROL); if (host->quirks2 & SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON) sdhci_runtime_pm_bus_off(host); } else { diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 95a08f09df30..f35d6d7b8326 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -95,6 +95,7 @@ #define SDHCI_CTRL_CDTEST_EN 0x80 #define SDHCI_POWER_CONTROL 0x29 +#define SDHCI_POWER_OFF 0x00 #define SDHCI_POWER_ON 0x01 #define SDHCI_POWER_180 0x0A #define SDHCI_POWER_300 0x0C