From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Tao Wang <quic_wat@quicinc.com>,
Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"open list:USB XHCI DRIVER" <linux-usb@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: xhci: save hcd_priv memory of shared_hcd
Date: Thu, 19 May 2022 10:47:28 +0300 [thread overview]
Message-ID: <0c40e1ea-a565-2f8d-8460-16576ded3cb3@linux.intel.com> (raw)
In-Reply-To: <1652926622-85047-1-git-send-email-quic_wat@quicinc.com>
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 <quic_wat@quicinc.com>
> ---
> 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
next prev parent reply other threads:[~2022-05-19 7:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-19 2:17 [PATCH] usb: xhci: save hcd_priv memory of shared_hcd Tao Wang
2022-05-19 3:43 ` kernel test robot
2022-05-19 7:47 ` Mathias Nyman [this message]
2022-05-19 16:53 ` kernel test robot
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=0c40e1ea-a565-2f8d-8460-16576ded3cb3@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=quic_wat@quicinc.com \
/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