Message ID | 1527475967-15201-15-git-send-email-jun.li@nxp.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, May 28, 2018 at 10:52:46AM +0800, Li Jun wrote: > We need regmap_update_bits to avoid touch any other bits when > enable or disable vconn. > > Reviewed-by: Guenter Roeck <linux@roeck-us.net> > Signed-off-by: Li Jun <jun.li@nxp.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > drivers/staging/typec/tcpci.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c > index 11c2d37..ac6b418 100644 > --- a/drivers/staging/typec/tcpci.c > +++ b/drivers/staging/typec/tcpci.c > @@ -218,12 +218,9 @@ static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable) > return ret; > } > > - ret = regmap_write(tcpci->regmap, TCPC_POWER_CTRL, > - enable ? TCPC_POWER_CTRL_VCONN_ENABLE : 0); > - if (ret < 0) > - return ret; > - > - return 0; > + return regmap_update_bits(tcpci->regmap, TCPC_POWER_CTRL, > + TCPC_POWER_CTRL_VCONN_ENABLE, > + enable ? TCPC_POWER_CTRL_VCONN_ENABLE : 0); > } > > static int tcpci_set_roles(struct tcpc_dev *tcpc, bool attached, Thanks,
diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c index 11c2d37..ac6b418 100644 --- a/drivers/staging/typec/tcpci.c +++ b/drivers/staging/typec/tcpci.c @@ -218,12 +218,9 @@ static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable) return ret; } - ret = regmap_write(tcpci->regmap, TCPC_POWER_CTRL, - enable ? TCPC_POWER_CTRL_VCONN_ENABLE : 0); - if (ret < 0) - return ret; - - return 0; + return regmap_update_bits(tcpci->regmap, TCPC_POWER_CTRL, + TCPC_POWER_CTRL_VCONN_ENABLE, + enable ? TCPC_POWER_CTRL_VCONN_ENABLE : 0); } static int tcpci_set_roles(struct tcpc_dev *tcpc, bool attached,