From: Johan Hovold <johan@kernel.org>
To: Krishna Kurapati <quic_kriskura@quicinc.com>
Cc: Andy Gross <agross@kernel.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Konrad Dybcio <konrad.dybcio@somainline.org>,
Felipe Balbi <balbi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Randy Dunlap <rdunlap@infradead.org>,
linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] usb: dwc3: qcom: Provide stubs for dwc3_qcom_read_usb2_speed function
Date: Thu, 4 Aug 2022 17:20:12 +0200 [thread overview]
Message-ID: <YuvjrAUorQdC7U2k@hovoldconsulting.com> (raw)
In-Reply-To: <YulR31pEq9wjCBg8@hovoldconsulting.com>
On Tue, Aug 02, 2022 at 06:33:36PM +0200, Johan Hovold wrote:
> On Mon, Aug 01, 2022 at 12:30:15PM +0530, Krishna Kurapati wrote:
> > Dwc3 Qcom driver makes use of usb_hub_find_child API in its efforts
> > to get speed of connected devices (HS/LS/FS) and enable interrupts
> > accordingly.
>
> > usb_hub_find_child API is a part of usb core compiled
> > either into the kernel or as a module (CONFIG_USB= Y or M). In some
> > builds (make randconfig for i386) CONFIG_USB is not enabled and the
> > usb core is not compiled resulting in linking errors.
>
> Please replace the above with something more succinct. Whether USB core
> is built as a module or not is completely irrelevant. The problem is
> that the qcom dwc3 driver can be built and used without host support.
>
> > Provide stubs for dwc3_qcom_read_usb2_speed function to use
> > usb_hub_find_child API only if CONFIG_USB is enabled. Else return
> > USB_SPEED_UNKNOWN.
>
> The fact that you need to do this is an indication that something is
> wrong with the current implementation. The glue driver shouldn't be
> touching the host driver internal state directly like this.
>
> As pointed out here:
>
> https://lore.kernel.org/all/20220802151404.1797-4-johan+linaro@kernel.org/
>
> dwc3_qcom_read_usb2_speed() is indeed broken and currently triggers a
> NULL-pointer dereference when the controller is used in peripheral mode.
>
> But for now I guess something like this is needed even if we try to
> avoid stubs in implementation files.
This is how I think this should be fixed instead:
https://lore.kernel.org/all/20220804151001.23612-4-johan+linaro@kernel.org/
and which keeps the ifdeffery minimal. I included the patch in v2 of the
series that addresses the other problems with this code.
Johan
next prev parent reply other threads:[~2022-08-04 15:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-01 7:00 [PATCH v2] usb: dwc3: qcom: Provide stubs for dwc3_qcom_read_usb2_speed function Krishna Kurapati
2022-08-02 16:33 ` Johan Hovold
2022-08-04 15:20 ` Johan Hovold [this message]
2022-08-08 13:00 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YuvjrAUorQdC7U2k@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=agross@kernel.org \
--cc=balbi@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=konrad.dybcio@somainline.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=quic_kriskura@quicinc.com \
--cc=rdunlap@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox