Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2624507imn; Tue, 2 Aug 2022 09:45:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Qg6A+KahIdsITcwbFtGaxeRZExznTdi0DYJq+Stox+d4/J5cGRY4orkWNXQAIM0wr83hz X-Received: by 2002:a17:902:ebcb:b0:168:e3ba:4b5a with SMTP id p11-20020a170902ebcb00b00168e3ba4b5amr22224077plg.11.1659458737268; Tue, 02 Aug 2022 09:45:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659458737; cv=none; d=google.com; s=arc-20160816; b=klv9WWlw7e7fTunF9jW67dejndL4LoJz/y0cn6aMAJqs5IvRGhspFckdCs7eohrzIi ny35Q+zYeXWA/OOQFU+IfMGVWc94Gam9WAE6gdgombwHnSXxduo2aN4FqdoAh2pmEZ9g ikmN0RzxXTz+kGQNJ8G9aEP1+sAH+72+WmvSE9GuG9zQcIhp6xm1ziRhK/yScPYBUBUN S3ua+TKtPGrgWnXkUGS2gPKv2qfugqJOprF98GbY1evzsH0Woqpvs0BGIvq9O9/sG+Dj Jsa2YgJoM8o/Ui3dzOShgP7m5aQ5krmFxTOoeUbCB0e+SbjOvqQkBanilFNHv7NbYN2T +xOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bFYXar7S62ZSnQAAqj2Q2djJzo6pOCt4P41w02hQEMs=; b=FcASqtTG/ouujRp/qnWnVAohY9+lZtnzFHabIpXLnw/UEMLpYcZUETXULLzXsQHEuO 7XvGyvmjMvm9W3sjmxEIjjWbs2m9qAsRLIxcoIt4mtfr/7Zx3PXLZk8s/8BDWmM5m8By fc1veGpLqGTDS3JZZYj7Wn2L2uZtw2l4A8WwPFbzp6uj4BE50yCVbcJp3kR6qJ/Yw2xD V9sxQSa3A+M2krkmNfqFynA0+MnP7jlShi2mci3CHfmy8U0rjJnFrfIHy/g4lZW2fig5 FBW4zZZ+JCooiehgKZstvgN3N4Nx5pC8gannTu42CgWldbDTpTkgptGN8IG+G1KM7WcM gdBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rhx22xzD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e193-20020a6369ca000000b0040dea78bf74si372428pgc.686.2022.08.02.09.45.22; Tue, 02 Aug 2022 09:45:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rhx22xzD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233660AbiHBQd0 (ORCPT + 99 others); Tue, 2 Aug 2022 12:33:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbiHBQdY (ORCPT ); Tue, 2 Aug 2022 12:33:24 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1BD817E16; Tue, 2 Aug 2022 09:33:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 0D411CE2017; Tue, 2 Aug 2022 16:33:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E63BCC433D6; Tue, 2 Aug 2022 16:33:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659458000; bh=wvCuCNOjRSMOixoJFZ19V50Uqrz6WXVshhwx5kuDuAQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Rhx22xzDRr5SQtI8UcUj+PkAqia5W0S+aT0Muk+9TNLMSlppNcAsqxFQZoF9mtyCu PUOe5GGmGgwl5clH5K+V9dBko2+MbHK9F6tyC/w6rVNSIsqR+cbRMG9HDecruvhX8z gNNPKtvoU7S1hGzSY75g4QaDtio0M0am3W8UZzPqkemR266Y2fHc08GvD/JypyHSc1 6p0sA+X3cKgKCsbs3Rmifv0o/SC+4ZzKHnmtivKWBZKI66uFzh8cWUZb3HS5hNrcyS 4BKb0jUszU167LsvXnuZbFCrY9A3wZz+e8ssZ7IuzwxkIhQx2xdo4QViroRPa/OvVX rwPQgq1ApTuGw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1oIupr-0002Vn-Cf; Tue, 02 Aug 2022 18:33:36 +0200 Date: Tue, 2 Aug 2022 18:33:35 +0200 From: Johan Hovold To: Krishna Kurapati Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Felipe Balbi , Greg Kroah-Hartman , Philipp Zabel , Randy Dunlap , 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 Message-ID: References: <1659337215-20421-1-git-send-email-quic_kriskura@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1659337215-20421-1-git-send-email-quic_kriskura@quicinc.com> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Johan