From: Niklas Neronin <niklas.neronin@linux.intel.com>
To: mathias.nyman@linux.intel.com
Cc: linux-usb@vger.kernel.org,
Niklas Neronin <niklas.neronin@linux.intel.com>
Subject: [PATCH 22/22] usb: xhci: rename 'temp' PORTSC variables to 'portcs'
Date: Mon, 13 Jul 2026 12:47:36 +0200 [thread overview]
Message-ID: <20260713104738.629612-23-niklas.neronin@linux.intel.com> (raw)
In-Reply-To: <20260713104738.629612-1-niklas.neronin@linux.intel.com>
Rename local 'temp' variable which are used to store PORTSC values to
'portcs'. This makes the code easier to follow.
Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
---
drivers/usb/host/xhci-hub.c | 62 ++++++++++++++++++-------------------
drivers/usb/host/xhci.c | 6 ++--
2 files changed, 33 insertions(+), 35 deletions(-)
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index dbf1183a6813..ca48a49d6716 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -603,29 +603,27 @@ static void xhci_set_port_power(struct xhci_hcd *xhci, struct xhci_port *port,
__must_hold(&xhci->lock)
{
struct usb_hcd *hcd;
- u32 temp;
+ u32 portsc;
hcd = port->rhub->hcd;
- temp = xhci_portsc_readl(port);
+ portsc = xhci_portsc_readl(port);
xhci_dbg(xhci, "set port power %d-%d %s, portsc: 0x%x\n",
- hcd->self.busnum, port->hcd_portnum + 1, on ? "ON" : "OFF", temp);
+ hcd->self.busnum, port->hcd_portnum + 1, on ? "ON" : "OFF", portsc);
- temp = xhci_port_state_to_neutral(temp);
+ portsc = xhci_port_state_to_neutral(portsc);
if (on) {
/* Power on */
- xhci_portsc_writel(port, temp | PORT_PP);
+ xhci_portsc_writel(port, portsc | PORT_PP);
xhci_portsc_readl(port);
} else {
/* Power off */
- xhci_portsc_writel(port, temp & ~PORT_PP);
+ xhci_portsc_writel(port, portsc & ~PORT_PP);
}
spin_unlock_irqrestore(&xhci->lock, *flags);
- temp = usb_acpi_power_manageable(hcd->self.root_hub,
- port->hcd_portnum);
- if (temp)
+ if (usb_acpi_power_manageable(hcd->self.root_hub, port->hcd_portnum))
usb_acpi_set_power_state(hcd->self.root_hub,
port->hcd_portnum, on);
spin_lock_irqsave(&xhci->lock, *flags);
@@ -768,40 +766,40 @@ void xhci_set_link_state(struct xhci_hcd *xhci, struct xhci_port *port,
static void xhci_set_remote_wake_mask(struct xhci_hcd *xhci,
struct xhci_port *port, u16 wake_mask)
{
- u32 temp;
+ u32 portsc;
- temp = xhci_portsc_readl(port);
- temp = xhci_port_state_to_neutral(temp);
+ portsc = xhci_portsc_readl(port);
+ portsc = xhci_port_state_to_neutral(portsc);
if (wake_mask & USB_PORT_FEAT_REMOTE_WAKE_CONNECT)
- temp |= PORT_WCE;
+ portsc |= PORT_WCE;
else
- temp &= ~PORT_WCE;
+ portsc &= ~PORT_WCE;
if (wake_mask & USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT)
- temp |= PORT_WDE;
+ portsc |= PORT_WDE;
else
- temp &= ~PORT_WDE;
+ portsc &= ~PORT_WDE;
if (wake_mask & USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT)
- temp |= PORT_WOE;
+ portsc |= PORT_WOE;
else
- temp &= ~PORT_WOE;
+ portsc &= ~PORT_WOE;
- xhci_portsc_writel(port, temp);
+ xhci_portsc_writel(port, portsc);
}
/* Test and clear port RWC bit */
void xhci_test_and_clear_bit(struct xhci_hcd *xhci, struct xhci_port *port,
u32 port_bit)
{
- u32 temp;
+ u32 portsc;
- temp = xhci_portsc_readl(port);
- if (temp & port_bit) {
- temp = xhci_port_state_to_neutral(temp);
- temp |= port_bit;
- xhci_portsc_writel(port, temp);
+ portsc = xhci_portsc_readl(port);
+ if (portsc & port_bit) {
+ portsc = xhci_port_state_to_neutral(portsc);
+ portsc |= port_bit;
+ xhci_portsc_writel(port, portsc);
}
}
@@ -1559,7 +1557,7 @@ EXPORT_SYMBOL_GPL(xhci_hub_control);
int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
{
unsigned long flags;
- u32 temp, status;
+ u32 portsc, status;
u32 mask;
int i, retval;
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
@@ -1601,24 +1599,24 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
/* For each port, did anything change? If so, set that bit in buf. */
for (i = 0; i < max_ports; i++) {
- temp = xhci_portsc_readl(ports[i]);
- if (temp == ~(u32)0) {
+ portsc = xhci_portsc_readl(ports[i]);
+ if (portsc == ~(u32)0) {
xhci_hc_died(xhci);
retval = -ENODEV;
break;
}
- trace_xhci_hub_status_data(ports[i], temp);
+ trace_xhci_hub_status_data(ports[i], portsc);
- if ((temp & mask) != 0 ||
+ if ((portsc & mask) != 0 ||
(bus_state->port_c_suspend & 1 << i) ||
(ports[i]->resume_timestamp && time_after_eq(
jiffies, ports[i]->resume_timestamp))) {
buf[(i + 1) / 8] |= 1 << (i + 1) % 8;
status = 1;
}
- if ((temp & PORT_PRC))
+ if ((portsc & PORT_PRC))
reset_change = true;
- if (temp & PORT_OCA)
+ if (portsc & PORT_OCA)
status = 1;
}
if (!status && !reset_change) {
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 9e4e5c3cd7c2..ba6c4124ff65 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -363,7 +363,7 @@ static void compliance_mode_recovery(struct timer_list *t)
struct xhci_hcd *xhci;
struct usb_hcd *hcd;
struct xhci_hub *rhub;
- u32 temp;
+ u32 portsc;
int i;
xhci = timer_container_of(xhci, t, comp_mode_recovery_timer);
@@ -374,8 +374,8 @@ static void compliance_mode_recovery(struct timer_list *t)
return;
for (i = 0; i < rhub->num_ports; i++) {
- temp = xhci_portsc_readl(rhub->ports[i]);
- if (FIELD_GET(PORT_PLS_MASK, temp) == PLS_COMP_MODE) {
+ portsc = xhci_portsc_readl(rhub->ports[i]);
+ if (FIELD_GET(PORT_PLS_MASK, portsc) == PLS_COMP_MODE) {
/*
* Compliance Mode Detected. Letting USB Core
* handle the Warm Reset
--
2.50.1
prev parent reply other threads:[~2026-07-13 10:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 10:47 [PATCH 00/22] usb: xhci: rework xHCI Port macros Niklas Neronin
2026-07-13 10:47 ` [PATCH 01/22] usb: xhci: replace bit shifts with the BIT() macro in xhci-port.h Niklas Neronin
2026-07-13 10:47 ` [PATCH 02/22] usb: xhci: rework Port Speed macros Niklas Neronin
2026-07-13 10:47 ` [PATCH 03/22] usb: xhci: rework Port Link State macros Niklas Neronin
2026-07-13 10:47 ` [PATCH 04/22] usb: xhci: rework Port Indicator Control macro Niklas Neronin
2026-07-13 10:47 ` [PATCH 05/22] usb: xhci: rework USB3 PORTPMSC macros Niklas Neronin
2026-07-13 10:47 ` [PATCH 06/22] usb: xhci: rework USB2 " Niklas Neronin
2026-07-13 10:47 ` [PATCH 07/22] usb: xhci: rework USB3 PORTLI macros Niklas Neronin
2026-07-13 10:47 ` [PATCH 08/22] usb: xhci: rework USB2 " Niklas Neronin
2026-07-13 10:47 ` [PATCH 09/22] usb: xhci: rework USB3 PORTHLPMC macros Niklas Neronin
2026-07-13 10:47 ` [PATCH 10/22] usb: xhci: rework USB2 " Niklas Neronin
2026-07-13 10:47 ` [PATCH 11/22] usb: xhci: update port register bitfield comments for consistency Niklas Neronin
2026-07-13 10:47 ` [PATCH 12/22] usb: xhci: rename port register macros to xHCI spec abbreviations Niklas Neronin
2026-07-13 10:47 ` [PATCH 13/22] usb: xhci: replace magic numbers with Port macros Niklas Neronin
2026-07-13 10:47 ` [PATCH 14/22] usb: xhci: update PORTSC aggregate macros Niklas Neronin
2026-07-13 10:47 ` [PATCH 15/22] usb: xhci: consolidate PORTSC RW1CS bit macros Niklas Neronin
2026-07-13 10:47 ` [PATCH 16/22] usb: xhci: relocate all port register macros to xhci-port.h Niklas Neronin
2026-07-13 10:47 ` [PATCH 17/22] usb: xhci: preserve RW bits in xhci_port_state_to_neutral() Niklas Neronin
2026-07-13 10:47 ` [PATCH 18/22] usb: xhci: improve xhci_port_missing_cas_quirk() Niklas Neronin
2026-07-13 10:47 ` [PATCH 19/22] usb: xhci: use neutral helper when resuming ports Niklas Neronin
2026-07-13 10:47 ` [PATCH 20/22] usb: xhci: remove redundant PORTSC ops in xhci_hub_control() Niklas Neronin
2026-07-13 10:47 ` [PATCH 21/22] usb: xhci: move struct 'xhci_port' specific macro Niklas Neronin
2026-07-13 10:47 ` Niklas Neronin [this message]
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=20260713104738.629612-23-niklas.neronin@linux.intel.com \
--to=niklas.neronin@linux.intel.com \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.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