Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1562756iob; Thu, 19 May 2022 09:08:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs6Ik7paMWq0chWesiCjAX5PRVgHvMJXTrXqmQJ3iuyD7YOUCHiwTO1W1zXP2j1C/RoYfG X-Received: by 2002:a17:903:288:b0:15f:4cc6:3195 with SMTP id j8-20020a170903028800b0015f4cc63195mr5400708plr.45.1652976483402; Thu, 19 May 2022 09:08:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652976483; cv=none; d=google.com; s=arc-20160816; b=lGKcrFkcXF4MBNuHB6Da5gY+SdxHwiqbbI6xG5GFzqTOCvo6Nq3/8sGz7pCS39jOkj KZReYwOa7+qhBBEPbPB4u5rg1m9iFnKdSUGG35nXr6QxpCitFeXOxs7qM3vPt99nxwK2 oM5u3JE6hjEgnttv3nn9y/sK28BNrAEAp7IsWCK2D1Pse/1o02MoPLvVpdQxnO5HFf8O LnIXDteDje/NFpB3VvjSLKHg+mjEvAmkUF7ngW77li5neuj0gALqibjOtNufINHVwdAI JTE0VSCsBCzVvMLO4t2ZYUw6EhrCEmKkIaTxZ7Co1O3pV1NoaDKpxVPKtYtc4qnJJRyQ 1x3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=dUIR770NRZIrFyZq6tgYUeOlIDTp4pts5uDK3xBy74k=; b=XKEMMNhV9pwibD6XdN3U+08pdWYnLODlOKgvAygwy4C7enz5/S/ZRjtxiw0CVI1Au8 HEt03/X4iAyWHlf6Q/GPBDjog5EW51jE8HUhGPGOLRJzQ1fTHvepxSF9YLADgETlwxMm 96fYmYeFwimhwXRCN2yBo0Gfp7OF8dKIRrvFfyewh5MOcSxYBBWo06lX8JPJDhe1EWbJ C9j5KbpogL5ieDRlXp5cuClA8ACU/w7OwfSmLiHKjKDUQp4QCC44/KLFECgMuc58JvlH mNKXzQnYAzBmhrU0ugO7Rza8uiZ1MmVoAEDmbWf8nmqOURM6UwLLh1iESvZ9XdqjyEsk R+Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZwzpmSiI; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f8-20020a63f108000000b003f5dc4c72b2si6835791pgi.398.2022.05.19.09.07.51; Thu, 19 May 2022 09:08:03 -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=@intel.com header.s=Intel header.b=ZwzpmSiI; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232520AbiESHq0 (ORCPT + 99 others); Thu, 19 May 2022 03:46:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229720AbiESHqZ (ORCPT ); Thu, 19 May 2022 03:46:25 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C1083BBEC; Thu, 19 May 2022 00:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652946384; x=1684482384; h=message-id:date:mime-version:to:references:from:subject: in-reply-to:content-transfer-encoding; bh=TEii5T9HYqXIjBsmDz1qAOeqM3Szd1Cen5AKiMTQ3mk=; b=ZwzpmSiIeb0gvNe1KdbZBd+s5Rxn+dokYMDMfs1fFB6SgaEC/Co2Pn29 mteH0UVNM361EqG8J8BrDnM4HdQnL63lwirRFZ2zyVn1Y/O6lZYqVNqvC J1ue6/nCXDoIHE45QlCEg/13fok9wdEPkidmunMOOL4XMcklrdA0iSRgy 8EUy5NW4hSOYUjdeEvoUoeM2b6Yx4o3voKXh0eswU1JN4pb/Q21L6Zrep uFmFLO6t5NCnwOa2SxnOaNmG+9863v/qrHDAD94NoOgV6u18d6ovsNeiZ cv1dywtxPiTa3vIz/62toGmxnxwfPToXjh4EHknhTPuiqGwUZjZHGva0g Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10351"; a="335121850" X-IronPort-AV: E=Sophos;i="5.91,237,1647327600"; d="scan'208";a="335121850" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2022 00:46:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,237,1647327600"; d="scan'208";a="598410629" Received: from mattu-haswell.fi.intel.com (HELO [10.237.72.199]) ([10.237.72.199]) by orsmga008.jf.intel.com with ESMTP; 19 May 2022 00:46:06 -0700 Message-ID: <0c40e1ea-a565-2f8d-8460-16576ded3cb3@linux.intel.com> Date: Thu, 19 May 2022 10:47:28 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.8.1 Content-Language: en-US To: Tao Wang , Mathias Nyman , Greg Kroah-Hartman , "open list:USB XHCI DRIVER" , open list References: <1652926622-85047-1-git-send-email-quic_wat@quicinc.com> From: Mathias Nyman Subject: Re: [PATCH] usb: xhci: save hcd_priv memory of shared_hcd In-Reply-To: <1652926622-85047-1-git-send-email-quic_wat@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 19.5.2022 5.17, Tao Wang wrote: > The shared_hcd->hcd_priv is not used in xhci, so not > need to malloc hcd priv memory for shared_hcd. > > Signed-off-by: Tao Wang > --- > drivers/usb/host/xhci-plat.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c > index 01dcfd7..a27dd3a 100644 > --- a/drivers/usb/host/xhci-plat.c > +++ b/drivers/usb/host/xhci-plat.c > @@ -336,6 +336,11 @@ static int xhci_plat_probe(struct platform_device *pdev) > device_set_wakeup_capable(&pdev->dev, true); > > xhci->main_hcd = hcd; > + /* > + * The shared_hcd->hcd_priv is not used in xhci, > + * so not need to malloc hcd priv memory for shared_hcd. > + */ > + driver->hcd_priv_size = 0; A change like this will probably come back and bite us later. We already allocated the additional hcd_priv_size bytes for primary hcd. Future code can no longer rely on driver->hcd_priv_size being valid after this. If saving this amount of memory is important then maybe look into __usb_create_hcd() and avoid allocating the extra bytes if the hcd is not the primary hcd. Thanks -Mathias