mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Prashanth K <prashanth.k@oss.qualcomm.com>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc3: Log dwc3 instance name in traces
Date: Fri, 19 Sep 2025 16:29:40 +0530	[thread overview]
Message-ID: <4d6a555d-aa27-41ba-a194-06c51d86d1dc@oss.qualcomm.com> (raw)
In-Reply-To: <20250912215444.egh5vdgvwbvqs3my@synopsys.com>



On 9/13/2025 3:24 AM, Thinh Nguyen wrote:
>>> You're right. I forgot that we can't do virt_to_phys() for ioremapped
>>> resource...
>>>
>>> In that case, can we pass the dwc3 structure in the dwc3_readl/writel? I
>>> know there are many places that this change may touch, but I feel that
>>> it's easier to read than creating the new macro dwc3_readl/writel.
>>>
>>> Thanks,
>>> Thinh
>>
>> 1) Passing dwc3 structure to dwc3_readl/writel will need changes in
>> around 250 places, we can do that using 'find and replace'.
> 
> Yikes..
> 
>>
>> 2) OR we can use container_of(base, struct dwc3, regs)) to get dwc pointer,
>> this will not work in few places where we use dep->regs (~6 places). we
>> can just create a separate function dwc3_dep_readl/writel for dep->regs,
> 
> We can just update the endpoint macros to something like this:
> #define DWC3_DEPCMD(n)		(DWC3_DEP_BASE(n) + 0x0c)
> 
> so we can do this:
> 	dwc3_readl(dwc->regs, DWC3_DEPCMD(dep->number));
> 
> We will get the proper endpoint offset, and we can also remove the dep->regs.
> 
>> and get dwc3 from dep. This will have lesser number of changes, and less
>> impact on git history.
>>
>> I'm more inclined towards approach2, but fine with both approaches, let
>> me know which one suits here.
>>
>> We can use snprintf on res->start to get the HW addr and store that
>> string into dwc3. Is that fine?
>>
> 
> Option 2 sounds good.
> 
> Thanks!
> Thinh

I think we need to go ahead with approach 1 (Passing dwc3 structure to
dwc3_readl/writel), because we were wrong about the usage of
container_of(), it wouldn't work since it's a __iomem pointer.

I'm planning to break this into a 3 patch series
1. Removal of dep->regs and use dwc->regs everywhere
2. Use dwc pointer in all dwc3_readl/writel()
3. Adding the base addr in traces.

Regards,
Prashanth K

  parent reply	other threads:[~2025-09-19 10:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25 11:44 Prashanth K
2025-08-28 22:48 ` Thinh Nguyen
2025-09-01  9:56   ` Prashanth K
2025-09-02 23:44     ` Thinh Nguyen
2025-09-03  6:52       ` Prashanth K
2025-09-04  0:00         ` Thinh Nguyen
2025-09-04  9:09           ` Prashanth K
2025-09-04 23:44             ` Thinh Nguyen
2025-09-09  5:00               ` Prashanth K
2025-09-11  1:36                 ` Thinh Nguyen
2025-09-11  4:46                   ` Prashanth K
2025-09-12 21:54                     ` Thinh Nguyen
2025-09-12 23:11                       ` Thinh Nguyen
2025-09-19 10:59                       ` Prashanth K [this message]
2025-09-19 21:01                         ` Thinh Nguyen

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=4d6a555d-aa27-41ba-a194-06c51d86d1dc@oss.qualcomm.com \
    --to=prashanth.k@oss.qualcomm.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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

all inboxes | Powered by JetHome®