Message ID | 20200616162617.38365cc8@xhacker.debian (mailing list archive) |
---|---|
State | Mainlined |
Commit | 07d9878fa18f5283182f4c13e708e22c11016efe |
Headers | show |
Series | usb: dwc2: use well defined macros for power_down | expand |
Hi, On 6/16/2020 12:26 PM, Jisheng Zhang wrote: > Use the well defined macros such as DWC2_POWER_DOWN_PARAM_NONE, > DWC2_POWER_DOWN_PARAM_PARTIAL and DWC2_POWER_DOWN_PARAM_HIBERNATION > to make code more readable. > > Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Acked-by: Minas Harutyunyan <hminas@synopsys.com> > --- > drivers/usb/dwc2/hcd.c | 4 ++-- > drivers/usb/dwc2/params.c | 12 ++++++------ > 2 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c > index b90f858af960..e9ac215b9663 100644 > --- a/drivers/usb/dwc2/hcd.c > +++ b/drivers/usb/dwc2/hcd.c > @@ -3628,7 +3628,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, > "SetPortFeature - USB_PORT_FEAT_SUSPEND\n"); > if (windex != hsotg->otg_port) > goto error; > - if (hsotg->params.power_down == 2) > + if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_HIBERNATION) > dwc2_enter_hibernation(hsotg, 1); > else > dwc2_port_suspend(hsotg, windex); > @@ -3646,7 +3646,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, > break; > > case USB_PORT_FEAT_RESET: > - if (hsotg->params.power_down == 2 && > + if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_HIBERNATION && > hsotg->hibernated) > dwc2_exit_hibernation(hsotg, 0, 1, 1); > hprt0 = dwc2_read_hprt0(hsotg); > diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c > index ce736d67c7c3..8f9d061c4d5f 100644 > --- a/drivers/usb/dwc2/params.c > +++ b/drivers/usb/dwc2/params.c > @@ -68,14 +68,14 @@ static void dwc2_set_his_params(struct dwc2_hsotg *hsotg) > p->ahbcfg = GAHBCFG_HBSTLEN_INCR16 << > GAHBCFG_HBSTLEN_SHIFT; > p->change_speed_quirk = true; > - p->power_down = false; > + p->power_down = DWC2_POWER_DOWN_PARAM_NONE; > } > > static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg) > { > struct dwc2_core_params *p = &hsotg->params; > > - p->power_down = 0; > + p->power_down = DWC2_POWER_DOWN_PARAM_NONE; > p->phy_utmi_width = 8; > } > > @@ -89,7 +89,7 @@ static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg) > p->host_perio_tx_fifo_size = 256; > p->ahbcfg = GAHBCFG_HBSTLEN_INCR16 << > GAHBCFG_HBSTLEN_SHIFT; > - p->power_down = 0; > + p->power_down = DWC2_POWER_DOWN_PARAM_NONE; > } > > static void dwc2_set_ltq_params(struct dwc2_hsotg *hsotg) > @@ -319,11 +319,11 @@ static void dwc2_set_param_power_down(struct dwc2_hsotg *hsotg) > int val; > > if (hsotg->hw_params.hibernation) > - val = 2; > + val = DWC2_POWER_DOWN_PARAM_HIBERNATION; > else if (hsotg->hw_params.power_optimized) > - val = 1; > + val = DWC2_POWER_DOWN_PARAM_PARTIAL; > else > - val = 0; > + val = DWC2_POWER_DOWN_PARAM_NONE; > > hsotg->params.power_down = val; > } >
On Tue, Jun 16, 2020 at 04:26:17PM +0800, Jisheng Zhang wrote: > Use the well defined macros such as DWC2_POWER_DOWN_PARAM_NONE, > DWC2_POWER_DOWN_PARAM_PARTIAL and DWC2_POWER_DOWN_PARAM_HIBERNATION > to make code more readable. > > Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> > Acked-by: Minas Harutyunyan <hminas@synopsys.com> > --- > drivers/usb/dwc2/hcd.c | 4 ++-- > drivers/usb/dwc2/params.c | 12 ++++++------ > 2 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c > index b90f858af960..e9ac215b9663 100644 > --- a/drivers/usb/dwc2/hcd.c > +++ b/drivers/usb/dwc2/hcd.c > @@ -3628,7 +3628,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, > "SetPortFeature - USB_PORT_FEAT_SUSPEND\n"); > if (windex != hsotg->otg_port) > goto error; > - if (hsotg->params.power_down == 2) > + if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_HIBERNATION) > dwc2_enter_hibernation(hsotg, 1); > else > dwc2_port_suspend(hsotg, windex); > @@ -3646,7 +3646,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, > break; > > case USB_PORT_FEAT_RESET: > - if (hsotg->params.power_down == 2 && > + if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_HIBERNATION && > hsotg->hibernated) > dwc2_exit_hibernation(hsotg, 0, 1, 1); > hprt0 = dwc2_read_hprt0(hsotg); > diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c > index ce736d67c7c3..8f9d061c4d5f 100644 > --- a/drivers/usb/dwc2/params.c > +++ b/drivers/usb/dwc2/params.c > @@ -68,14 +68,14 @@ static void dwc2_set_his_params(struct dwc2_hsotg *hsotg) > p->ahbcfg = GAHBCFG_HBSTLEN_INCR16 << > GAHBCFG_HBSTLEN_SHIFT; > p->change_speed_quirk = true; > - p->power_down = false; > + p->power_down = DWC2_POWER_DOWN_PARAM_NONE; > } > > static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg) > { > struct dwc2_core_params *p = &hsotg->params; > > - p->power_down = 0; > + p->power_down = DWC2_POWER_DOWN_PARAM_NONE; > p->phy_utmi_width = 8; > } > > @@ -89,7 +89,7 @@ static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg) > p->host_perio_tx_fifo_size = 256; > p->ahbcfg = GAHBCFG_HBSTLEN_INCR16 << > GAHBCFG_HBSTLEN_SHIFT; > - p->power_down = 0; > + p->power_down = DWC2_POWER_DOWN_PARAM_NONE; > } > > static void dwc2_set_ltq_params(struct dwc2_hsotg *hsotg) > @@ -319,11 +319,11 @@ static void dwc2_set_param_power_down(struct dwc2_hsotg *hsotg) > int val; > > if (hsotg->hw_params.hibernation) > - val = 2; > + val = DWC2_POWER_DOWN_PARAM_HIBERNATION; > else if (hsotg->hw_params.power_optimized) > - val = 1; > + val = DWC2_POWER_DOWN_PARAM_PARTIAL; > else > - val = 0; > + val = DWC2_POWER_DOWN_PARAM_NONE; > > hsotg->params.power_down = val; > } > -- > 2.27.0 > This does not apply to Linus's tree :(
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index b90f858af960..e9ac215b9663 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -3628,7 +3628,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, "SetPortFeature - USB_PORT_FEAT_SUSPEND\n"); if (windex != hsotg->otg_port) goto error; - if (hsotg->params.power_down == 2) + if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_HIBERNATION) dwc2_enter_hibernation(hsotg, 1); else dwc2_port_suspend(hsotg, windex); @@ -3646,7 +3646,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, break; case USB_PORT_FEAT_RESET: - if (hsotg->params.power_down == 2 && + if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_HIBERNATION && hsotg->hibernated) dwc2_exit_hibernation(hsotg, 0, 1, 1); hprt0 = dwc2_read_hprt0(hsotg); diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c index ce736d67c7c3..8f9d061c4d5f 100644 --- a/drivers/usb/dwc2/params.c +++ b/drivers/usb/dwc2/params.c @@ -68,14 +68,14 @@ static void dwc2_set_his_params(struct dwc2_hsotg *hsotg) p->ahbcfg = GAHBCFG_HBSTLEN_INCR16 << GAHBCFG_HBSTLEN_SHIFT; p->change_speed_quirk = true; - p->power_down = false; + p->power_down = DWC2_POWER_DOWN_PARAM_NONE; } static void dwc2_set_s3c6400_params(struct dwc2_hsotg *hsotg) { struct dwc2_core_params *p = &hsotg->params; - p->power_down = 0; + p->power_down = DWC2_POWER_DOWN_PARAM_NONE; p->phy_utmi_width = 8; } @@ -89,7 +89,7 @@ static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg) p->host_perio_tx_fifo_size = 256; p->ahbcfg = GAHBCFG_HBSTLEN_INCR16 << GAHBCFG_HBSTLEN_SHIFT; - p->power_down = 0; + p->power_down = DWC2_POWER_DOWN_PARAM_NONE; } static void dwc2_set_ltq_params(struct dwc2_hsotg *hsotg) @@ -319,11 +319,11 @@ static void dwc2_set_param_power_down(struct dwc2_hsotg *hsotg) int val; if (hsotg->hw_params.hibernation) - val = 2; + val = DWC2_POWER_DOWN_PARAM_HIBERNATION; else if (hsotg->hw_params.power_optimized) - val = 1; + val = DWC2_POWER_DOWN_PARAM_PARTIAL; else - val = 0; + val = DWC2_POWER_DOWN_PARAM_NONE; hsotg->params.power_down = val; }
Use the well defined macros such as DWC2_POWER_DOWN_PARAM_NONE, DWC2_POWER_DOWN_PARAM_PARTIAL and DWC2_POWER_DOWN_PARAM_HIBERNATION to make code more readable. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> --- drivers/usb/dwc2/hcd.c | 4 ++-- drivers/usb/dwc2/params.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-)