[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Youx4uztX0RNRVkd@xps13>
Date: Mon, 23 May 2022 12:10:10 -0400
From: Brian Masney <bmasney@...hat.com>
To: Harsh Agarwal <quic_harshq@...cinc.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Felipe Balbi <balbi@...nel.org>, linux-usb@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
quic_pkondeti@...cinc.com, quic_ppratap@...cinc.com
Subject: Re: [RFC 2/2] usb: dwc3: Refactor PHY logic to support Multiport
Controller
On Thu, May 19, 2022 at 06:04:55PM +0530, Harsh Agarwal wrote:
> - dwc->usb3_generic_phy = devm_phy_get(dev, "usb3-phy");
> - if (IS_ERR(dwc->usb3_generic_phy)) {
> - ret = PTR_ERR(dwc->usb3_generic_phy);
> - if (ret == -ENOSYS || ret == -ENODEV)
> - dwc->usb3_generic_phy = NULL;
> - else
> - return dev_err_probe(dev, ret, "no usb3 phy configured\n");
> + if (IS_ERR(dwc->usb2_phy[0])) {
> + ret = PTR_ERR(dwc->usb2_phy[0]);
> + if (ret == -ENXIO || ret == -ENODEV)
> + dwc->usb2_phy[0] = NULL;
> + else
> + return dev_err_probe(dev, ret, "no usb2 phy configured\n");
> + }
> +
> + if (IS_ERR(dwc->usb3_phy[0])) {
> + ret = PTR_ERR(dwc->usb3_phy[0]);
> + if (ret == -ENXIO || ret == -ENODEV)
> + dwc->usb3_phy[0] = NULL;
> + else
> + return dev_err_probe(dev, ret, "no usb3 phy configured\n");
> + }
> +
> + dwc->usb2_generic_phy = devm_phy_get(dev, "usb2-phy");
> + if (IS_ERR(dwc->usb2_generic_phy)) {
> + ret = PTR_ERR(dwc->usb2_generic_phy);
> + if (ret == -ENOSYS || ret == -ENODEV)
> + dwc->usb2_generic_phy = NULL;
> + else
> + return dev_err_probe(dev, ret, "no usb2 phy configured\n");
> + }
I know that this block is a copy and paste move from above, but is the
ENOSYS check really needed? It looks like the phy_get() only returns
-ENODEV.
> @@ -1147,8 +1149,10 @@ struct dwc3 {
>
> struct reset_control *reset;
>
> - struct usb_phy *usb2_phy;
> - struct usb_phy *usb3_phy;
> + struct usb_phy **usb2_phy;
> + struct usb_phy **usb3_phy;
> + u32 num_hsphy;
> + u32 num_ssphy;
Rename num_hsphy / num_ssphy to num_usb2_phy and num_usb3_phy so this is
easier to audit.
Brian
Powered by blists - more mailing lists