All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Cc: Konrad Dybcio <konradybcio@kernel.org>,
	Andreas Noever <andreas.noever@gmail.com>,
	Mika Westerberg <westeri@kernel.org>,
	Yehezkel Bernat <YehezkelShB@gmail.com>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	usb4-upstream@oss.qualcomm.com,
	Raghavendra Thoorpu <rthoorpu@qti.qualcomm.com>
Subject: Re: [PATCH v3 3/4] thunderbolt: Require nhi->ops be valid
Date: Fri, 15 May 2026 12:05:06 +0200	[thread overview]
Message-ID: <20260515100506.GI84797@black.igk.intel.com> (raw)
In-Reply-To: <b08939c6-feb3-4876-bf2b-b0f409989038@oss.qualcomm.com>

On Fri, May 15, 2026 at 11:34:41AM +0200, Konrad Dybcio wrote:
> On 5/15/26 8:30 AM, Mika Westerberg wrote:
> > On Wed, May 13, 2026 at 06:23:34PM +0200, Konrad Dybcio wrote:
> >> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> >>
> >> Because of how fundamental ops->init_interrupts() is, it no longer
> >> makes sense to consider cases where nhi->ops is NULL.
> >>
> >> Drop some boilerplate around it and add a single sanity-check in
> >> nhi_probe() instead.
> >>
> >> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> >> ---
> >>  drivers/thunderbolt/nhi.c    | 32 ++++++++++++++++++--------------
> >>  drivers/thunderbolt/switch.c |  6 +++---
> >>  2 files changed, 21 insertions(+), 17 deletions(-)
> >>
> >> diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
> >> index 740c10ee852b..2a8d1b3716c0 100644
> >> --- a/drivers/thunderbolt/nhi.c
> >> +++ b/drivers/thunderbolt/nhi.c
> >> @@ -559,7 +559,7 @@ static struct tb_ring *tb_ring_alloc(struct tb_nhi *nhi, u32 hop, int size,
> >>  	if (!ring->descriptors)
> >>  		goto err_free_ring;
> >>  
> >> -	if (nhi->ops && nhi->ops->request_ring_irq) {
> >> +	if (nhi->ops->request_ring_irq) {
> > 
> > I wonder if it makes this more readable if we wrap these like:
> > 
> > 	if (nhi_request_ring_irq(nhi)) {
> 
> The UFS subsystem does that, and it results in a ton of boilerplate,
> i.e. for each op you need to define something like a:
> 
> static inline T nhi_foo_bar(struct tb_nhi *nhi, ...)
> {
> 	if (nhi->ops->foo_bar)
> 		return nhi->ops->foo_bar(...);
> 
> 	return 0;
> }
> 
> I can do that, but I don't see real value here

Yeah, I was thinking if that would make the calls more readable but I guess
we can do this later if at all.

  reply	other threads:[~2026-05-15 10:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 16:23 [PATCH v3 0/4] Prepwork for non-PCIe NHI/TBT hosts Konrad Dybcio
2026-05-13 16:23 ` [PATCH v3 1/4] thunderbolt: Move pci_device out of tb_nhi Konrad Dybcio
2026-05-13 16:23 ` [PATCH v3 2/4] thunderbolt: Separate out common NHI bits Konrad Dybcio
2026-05-15  6:28   ` Mika Westerberg
2026-05-13 16:23 ` [PATCH v3 3/4] thunderbolt: Require nhi->ops be valid Konrad Dybcio
2026-05-15  6:30   ` Mika Westerberg
2026-05-15  9:34     ` Konrad Dybcio
2026-05-15 10:05       ` Mika Westerberg [this message]
2026-05-13 16:23 ` [PATCH v3 4/4] thunderbolt: Add some more descriptive probe error messages Konrad Dybcio

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=20260515100506.GI84797@black.igk.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rthoorpu@qti.qualcomm.com \
    --cc=usb4-upstream@oss.qualcomm.com \
    --cc=westeri@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.