Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp148933pxb; Thu, 7 Apr 2022 01:31:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy43ViMgjfVZ3138KpMZ9NF3qWwwr2epMHZA/MWk7z8pVA3ige2fpBSLdp8/ZMWTXUFzs4w X-Received: by 2002:a05:6a00:2887:b0:4fa:e10c:7ca with SMTP id ch7-20020a056a00288700b004fae10c07camr13187637pfb.9.1649320265698; Thu, 07 Apr 2022 01:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649320265; cv=none; d=google.com; s=arc-20160816; b=ryDJ/+aoxZ7vPFXSfxycsVOFwsOmg5aa6UNJjbu4qGuivhSzHuu6UUYI51Pf9jAgQs 89B7NyCtQrIE3kgRAEjpLviW0uFxuG3CTb3c3aVa8K5lYXZGW9QfJlGutF1uZb46g/bT JCKwbm4CdESZSJlDqf7vFzbGkinlT/0DWOlJm+JLIietDZVvRd9v32BxJWnRPD5OdJzP wm49WS3jlFqrAcWmEug4tw2CVU64nznQZyCpZ0GwOtYpkdRouORD9hdPpW/gyZgntgFF n4VS2zzyiK17T8NHFYL6hGHtsxVezf90EtEIpQV9sc1e651555kjTpmyHWa0zdr3hUdT jdbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=ffCfV/u5aK2/Nt9IZ+hCLvnY6QW2nh2wJ6EbOYyE8mo=; b=NKsEd+32vrCgvlR40TYIyhhjxwFnZk9yAmwcoJbEqkFG/kNjsW9J0r0kzJGam7bmSE hXGE41dAkP0Y+lgfhM6FQ2DsKSlUcZKvJvYYjugGvqZhYm8zadrTfe2KzSF4z+wdJygv AsqqekDIWSIfHR8TTzbyTQhuRS5ourHZ7LlfG1+d0tHs5SLKrFMFXDJpNr1K/EVMyqKp nZhVkgPmvHLsFxVFiHGRvXsNU94QMD6YZqHZKWIw98axK/GDeUbLlEgoAvbtAp9OGJ1W pCXhtPrSOMRBnPz1FMEjqI46rIATAGMhziptmNlC0Diiz/BkI5NBIEy4BNRaiLzSrZl4 ysqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=f3p+BQuW; 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=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a17090a4d0500b001bef41cdf55si1068015pjg.47.2022.04.07.01.30.52; Thu, 07 Apr 2022 01:31:05 -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=@quicinc.com header.s=qcdkim header.b=f3p+BQuW; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239498AbiDGCrd (ORCPT + 99 others); Wed, 6 Apr 2022 22:47:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238895AbiDGCrY (ORCPT ); Wed, 6 Apr 2022 22:47:24 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4DF020DB38; Wed, 6 Apr 2022 19:45:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1649299525; x=1680835525; h=from:to:cc:subject:date:message-id:mime-version; bh=ffCfV/u5aK2/Nt9IZ+hCLvnY6QW2nh2wJ6EbOYyE8mo=; b=f3p+BQuWvPiWC30fKmMI9ul665hIdn0/HTKUzNcS/DomzHeyWCkivtLC NqabtVolVGvqVECtkryudPATR/rGjj/11tUJl8aB5qj46ptUbOOLsQ3EQ DV/0oaF1mqQ6B9S7W/MTirTfuMEaHvnayznelH4ti2yWfjZL+S4c2ITiI s=; Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-01.qualcomm.com with ESMTP; 06 Apr 2022 19:45:24 -0700 X-QCInternal: smtphost Received: from nasanex01b.na.qualcomm.com ([10.46.141.250]) by ironmsg05-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 19:45:25 -0700 Received: from cbsp-sh-gv.qualcomm.com (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 6 Apr 2022 19:45:22 -0700 From: Tao Wang To: Greg Kroah-Hartman , Mathias Nyman , "open list:USB SUBSYSTEM" , open list CC: , Subject: [PATCH] usb: hcd: add a flag for whether using shared_hcd priv Date: Thu, 7 Apr 2022 10:45:14 +0800 Message-ID: <1649299514-64014-1-git-send-email-quic_wat@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01b.na.qualcomm.com (10.46.141.250) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 The shared_hcd->hcd_priv is not used in xhci, so not need to malloc hcd priv memory for shared_hcd. This change add a shared_hcd_no_priv flag to indicate if shared_hcd use priv, and set the flag of xhci to 1. Signed-off-by: Tao Wang --- drivers/usb/core/hcd.c | 6 +++++- drivers/usb/host/xhci-plat.c | 1 + include/linux/usb/hcd.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 99908d8..f339c3e 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2419,7 +2419,11 @@ struct usb_hcd *__usb_create_hcd(const struct hc_driver *driver, { struct usb_hcd *hcd; - hcd = kzalloc(sizeof(*hcd) + driver->hcd_priv_size, GFP_KERNEL); + if (primary_hcd && driver->shared_hcd_no_priv) + hcd = kzalloc(sizeof(*hcd), GFP_KERNEL); + else + hcd = kzalloc(sizeof(*hcd) + driver->hcd_priv_size, GFP_KERNEL); + if (!hcd) return NULL; if (primary_hcd == NULL) { diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 21280a6..223e508 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -236,6 +236,7 @@ static int xhci_plat_probe(struct platform_device *pdev) return -ENODEV; driver = &xhci_plat_hc_driver; + driver->shared_hcd_no_priv = 1; irq = platform_get_irq(pdev, 0); if (irq < 0) diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 2ffafbd..03ac312 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -256,6 +256,7 @@ struct hc_driver { const char *description; /* "ehci-hcd" etc */ const char *product_desc; /* product/vendor string */ size_t hcd_priv_size; /* size of private data */ + bool shared_hcd_no_priv; /* 0 use priv, 1 not use priv*/ /* irq handler */ irqreturn_t (*irq) (struct usb_hcd *hcd); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project