Linux USB
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Guan-Yu Lin <guanyulin@google.com>
Cc: mathias.nyman@intel.com, hannelotta@gmail.com,
	zijun.hu@oss.qualcomm.com, xu.yang_2@nxp.com,
	stern@rowland.harvard.edu, andriy.shevchenko@linux.intel.com,
	ben@decadent.org.uk, quic_wcheng@quicinc.com,
	krzysztof.kozlowski@linaro.org, dh10.jung@samsung.com,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v15 3/4] xhci: sideband: add api to trace sideband usage
Date: Sat, 6 Sep 2025 15:11:45 +0200	[thread overview]
Message-ID: <2025090646-goal-unranked-8bf8@gregkh> (raw)
In-Reply-To: <CAOuDEK2=UyjYbPQeSxVSmiLu6A36m4Tt9xADHyamJHM61-vhmQ@mail.gmail.com>

On Tue, Aug 26, 2025 at 12:37:00PM +0800, Guan-Yu Lin wrote:
> On Wed, Aug 13, 2025 at 10:51 PM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Fri, Aug 01, 2025 at 03:39:32AM +0000, Guan-Yu Lin wrote:
> > > +config USB_XHCI_SIDEBAND_SUSPEND
> >
> > Again, why is a new config option needed here?  Why can't we just use
> > the existing one?  Why would you ever want one and not the other?
> >
> USB_XHCI_SIDEBAND focuses on the normal use case where the system is
> active, while USB_XHCI_SIDEBAND_SUSPEND enables the sideband during
> system sleep (Suspend-to-RAM). The design allows the user to determine
> the degree of support for the sideband in the system. We could add the
> "select" keyword to automatically enable USB_XHCI_SIDEBAND once
> USB_XHCI_SIDEBAND_SUSPEND is enabled.

But why would you want only one of these options and not both?  The
whole goal of this feature is for power savings, which means that
suspend is needed by everyone.  Don't increase the config variable
combinations for no good reason.

> > > +EXPORT_SYMBOL_GPL(xhci_sideband_check);
> > > +#endif /* IS_ENABLED(CONFIG_USB_XHCI_SIDEBAND_SUSPEND) */
> >
> > #ifdef in .c files is generally not a good idea, is it really needed
> > here?  Maybe it is, it's hard to unwind...
> >
> > thanks,
> >
> > greg k-h
> 
> Given that CONFIG_USB_XHCI_SIDEBAND_SUSPEND depends on
> CONFIG_USB_XHCI_SIDEBAND and adds only a single function, I think it
> is preferable to place the new code in the same file. This approach
> prevents unnecessary code fragmentation and improves maintainability
> by keeping related functions together.

We put #ifdefs in .h files.  That's a long-time-rule for decades to
ensure that we can maintain this codebase for even more decades to come.
Please do not break that rule just to keep things close if it's not
required.

thanks,

greg k-h

  reply	other threads:[~2025-09-06 13:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-01  3:39 [PATCH v15 0/4] Support system sleep with offloaded usb transfers Guan-Yu Lin
2025-08-01  3:39 ` [PATCH v15 1/4] usb: xhci-plat: separate dev_pm_ops for each pm_event Guan-Yu Lin
2025-08-01  3:39 ` [PATCH v15 2/4] usb: offload: add apis for offload usage tracking Guan-Yu Lin
2025-08-13 14:49   ` Greg KH
2025-08-26  3:59     ` Guan-Yu Lin
2025-09-06 13:13       ` Greg KH
2025-09-11  3:56         ` Guan-Yu Lin
2025-08-01  3:39 ` [PATCH v15 3/4] xhci: sideband: add api to trace sideband usage Guan-Yu Lin
2025-08-13 14:51   ` Greg KH
2025-08-26  4:37     ` Guan-Yu Lin
2025-09-06 13:11       ` Greg KH [this message]
2025-09-11  4:13         ` Guan-Yu Lin
2025-08-01  3:39 ` [PATCH v15 4/4] usb: host: enable USB offload during system sleep Guan-Yu Lin

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=2025090646-goal-unranked-8bf8@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ben@decadent.org.uk \
    --cc=dh10.jung@samsung.com \
    --cc=guanyulin@google.com \
    --cc=hannelotta@gmail.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=quic_wcheng@quicinc.com \
    --cc=stern@rowland.harvard.edu \
    --cc=xu.yang_2@nxp.com \
    --cc=zijun.hu@oss.qualcomm.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