Skip to content

Commit

Permalink
usb: hub: rename khubd to hub_wq in documentation and comments
Browse files Browse the repository at this point in the history
USB hub has started to use a workqueue instead of kthread. Let's update
the documentation and comments here and there.

This patch mostly just replaces "khubd" with "hub_wq". There are only few
exceptions where the whole sentence was updated. These more complicated
changes can be found in the following files:

	   Documentation/usb/hotplug.txt
	   drivers/net/usb/usbnet.c
	   drivers/usb/core/hcd.c
	   drivers/usb/host/ohci-hcd.c
	   drivers/usb/host/xhci.c

Signed-off-by: Petr Mladek <pmladek@suse.cz>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
pmladek authored and gregkh committed Sep 24, 2014
1 parent 59d48b3 commit 37ebb54
Show file tree
Hide file tree
Showing 29 changed files with 89 additions and 86 deletions.
2 changes: 1 addition & 1 deletion Documentation/DocBook/usb.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ for (;;) {
Each device has one control endpoint (endpoint zero)
which supports a limited RPC style RPC access.
Devices are configured
by khubd (in the kernel) setting a device-wide
by hub_wq (in the kernel) setting a device-wide
<emphasis>configuration</emphasis> that affects things
like power consumption and basic functionality.
The endpoints are part of USB <emphasis>interfaces</emphasis>,
Expand Down
6 changes: 3 additions & 3 deletions Documentation/usb/WUSB-Design-overview.txt
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ HC picks the /DN_Connect/ out (nep module sends to notif.c for delivery
into /devconnect/). This process starts the authentication process for
the device. First we allocate a /fake port/ and assign an
unauthenticated address (128 to 255--what we really do is
0x80 | fake_port_idx). We fiddle with the fake port status and /khubd/
0x80 | fake_port_idx). We fiddle with the fake port status and /hub_wq/
sees a new connection, so he moves on to enable the fake port with a reset.

So now we are in the reset path -- we know we have a non-yet enumerated
Expand All @@ -317,7 +317,7 @@ device with an unauthorized address; we ask user space to authenticate
exchange (FIXME: not yet done) and issue a /set address 0/ to bring the
device to the default state. Device is authenticated.

From here, the USB stack takes control through the usb_hcd ops. khubd
From here, the USB stack takes control through the usb_hcd ops. hub_wq
has seen the port status changes, as we have been toggling them. It will
start enumerating and doing transfers through usb_hcd->urb_enqueue() to
read descriptors and move our data.
Expand All @@ -331,7 +331,7 @@ Keep Alive IE; it responds with a /DN_Alive/ pong during the DNTS (this
arrives to us as a notification through
devconnect.c:wusb_handle_dn_alive(). If a device times out, we
disconnect it from the system (cleaning up internal information and
toggling the bits in the fake hub port, which kicks khubd into removing
toggling the bits in the fake hub port, which kicks hub_wq into removing
the rest of the stuff).

This is done through devconnect:__wusb_check_devs(), which will scan the
Expand Down
2 changes: 1 addition & 1 deletion Documentation/usb/hotplug.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ USB POLICY AGENT

The USB subsystem currently invokes /sbin/hotplug when USB devices
are added or removed from system. The invocation is done by the kernel
hub daemon thread [khubd], or else as part of root hub initialization
hub workqueue [hub_wq], or else as part of root hub initialization
(done by init, modprobe, kapmd, etc). Its single command line parameter
is the string "usb", and it passes these environment variables:

Expand Down
14 changes: 8 additions & 6 deletions drivers/net/usb/usbnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@
// reawaken network queue this soon after stopping; else watchdog barks
#define TX_TIMEOUT_JIFFIES (5*HZ)

// throttle rx/tx briefly after some faults, so khubd might disconnect()
// us (it polls at HZ/4 usually) before we report too many false errors.
/* throttle rx/tx briefly after some faults, so hub_wq might disconnect()
* us (it polls at HZ/4 usually) before we report too many false errors.
*/
#define THROTTLE_JIFFIES (HZ/8)

// between wakeups
Expand Down Expand Up @@ -595,9 +596,9 @@ static void rx_complete (struct urb *urb)
"rx shutdown, code %d\n", urb_status);
goto block;

/* we get controller i/o faults during khubd disconnect() delays.
/* we get controller i/o faults during hub_wq disconnect() delays.
* throttle down resubmits, to avoid log floods; just temporarily,
* so we still recover when the fault isn't a khubd delay.
* so we still recover when the fault isn't a hub_wq delay.
*/
case -EPROTO:
case -ETIME:
Expand Down Expand Up @@ -1185,8 +1186,9 @@ static void tx_complete (struct urb *urb)
case -ESHUTDOWN: // hardware gone
break;

// like rx, tx gets controller i/o faults during khubd delays
// and so it uses the same throttling mechanism.
/* like rx, tx gets controller i/o faults during hub_wq
* delays and so it uses the same throttling mechanism.
*/
case -EPROTO:
case -ETIME:
case -EILSEQ:
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/README
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Here is a list of what each subdirectory here is, and what is contained in
them.

core/ - This is for the core USB host code, including the
usbfs files and the hub class driver ("khubd").
usbfs files and the hub class driver ("hub_wq").

host/ - This is for USB host controller drivers. This
includes UHCI, OHCI, EHCI, and others that might
Expand Down
10 changes: 5 additions & 5 deletions drivers/usb/core/hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2301,7 +2301,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub);
* Context: in_interrupt()
*
* Starts enumeration, with an immediate reset followed later by
* khubd identifying and possibly configuring the device.
* hub_wq identifying and possibly configuring the device.
* This is needed by OTG controller drivers, where it helps meet
* HNP protocol timing requirements for starting a port reset.
*
Expand All @@ -2320,7 +2320,7 @@ int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num)
if (port_num && hcd->driver->start_port_reset)
status = hcd->driver->start_port_reset(hcd, port_num);

/* run khubd shortly after (first) root port reset finishes;
/* allocate hub_wq shortly after (first) root port reset finishes;
* it may issue others, until at least 50 msecs have passed.
*/
if (status == 0)
Expand Down Expand Up @@ -2383,7 +2383,7 @@ void usb_hc_died (struct usb_hcd *hcd)
if (hcd->rh_registered) {
clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);

/* make khubd clean up old urbs and devices */
/* make hub_wq clean up old urbs and devices */
usb_set_device_state (hcd->self.root_hub,
USB_STATE_NOTATTACHED);
usb_kick_hub_wq(hcd->self.root_hub);
Expand All @@ -2393,7 +2393,7 @@ void usb_hc_died (struct usb_hcd *hcd)
if (hcd->rh_registered) {
clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);

/* make khubd clean up old urbs and devices */
/* make hub_wq clean up old urbs and devices */
usb_set_device_state(hcd->self.root_hub,
USB_STATE_NOTATTACHED);
usb_kick_hub_wq(hcd->self.root_hub);
Expand Down Expand Up @@ -2655,7 +2655,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);

/* HC is in reset state, but accessible. Now do the one-time init,
* bottom up so that hcds can customize the root hubs before khubd
* bottom up so that hcds can customize the root hubs before hub_wq
* starts talking to them. (Note, bus id is assigned early too.)
*/
if ((retval = hcd_buffer_create(hcd)) != 0) {
Expand Down
44 changes: 22 additions & 22 deletions drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ static void hub_irq(struct urb *urb)
hub->error = status;
/* FALL THROUGH */

/* let khubd handle things */
/* let hub_wq handle things */
case 0: /* we got data: port status changed */
bits = 0;
for (i = 0; i < urb->actual_length; ++i)
Expand All @@ -664,7 +664,7 @@ static void hub_irq(struct urb *urb)

hub->nerrors = 0;

/* Something happened, let khubd figure it out */
/* Something happened, let hub_wq figure it out */
kick_hub_wq(hub);

resubmit:
Expand Down Expand Up @@ -695,7 +695,7 @@ hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt)
}

/*
* enumeration blocks khubd for a long time. we use keventd instead, since
* enumeration blocks hub_wq for a long time. we use keventd instead, since
* long blocking there is the exception, not the rule. accordingly, HCDs
* talking to TTs must queue control transfers (not just bulk and iso), so
* both can talk to the same hub concurrently.
Expand Down Expand Up @@ -961,7 +961,7 @@ static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)

/*
* Disable a port and mark a logical connect-change event, so that some
* time later khubd will disconnect() any existing usb_device on the port
* time later hub_wq will disconnect() any existing usb_device on the port
* and will re-enumerate if there actually is a device attached.
*/
static void hub_port_logical_disconnect(struct usb_hub *hub, int port1)
Expand All @@ -974,7 +974,7 @@ static void hub_port_logical_disconnect(struct usb_hub *hub, int port1)
* - SRP saves power that way
* - ... new call, TBD ...
* That's easy if this hub can switch power per-port, and
* khubd reactivates the port later (timer, SRP, etc).
* hub_wq reactivates the port later (timer, SRP, etc).
* Powerdown must be optional, because of reset/DFU.
*/

Expand All @@ -987,7 +987,7 @@ static void hub_port_logical_disconnect(struct usb_hub *hub, int port1)
* @udev: device to be disabled and removed
* Context: @udev locked, must be able to sleep.
*
* After @udev's port has been disabled, khubd is notified and it will
* After @udev's port has been disabled, hub_wq is notified and it will
* see that the device has been disconnected. When the device is
* physically unplugged and something is plugged in, the events will
* be received and processed normally.
Expand Down Expand Up @@ -1107,7 +1107,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
init2:

/*
* Check each port and set hub->change_bits to let khubd know
* Check each port and set hub->change_bits to let hub_wq know
* which ports need attention.
*/
for (port1 = 1; port1 <= hdev->maxchild; ++port1) {
Expand Down Expand Up @@ -1174,7 +1174,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
clear_bit(port1, hub->removed_bits);

if (!udev || udev->state == USB_STATE_NOTATTACHED) {
/* Tell khubd to disconnect the device or
/* Tell hub_wq to disconnect the device or
* check for a new connection
*/
if (udev || (portstatus & USB_PORT_STAT_CONNECTION) ||
Expand All @@ -1187,7 +1187,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
USB_SS_PORT_LS_U0;
/* The power session apparently survived the resume.
* If there was an overcurrent or suspend change
* (i.e., remote wakeup request), have khubd
* (i.e., remote wakeup request), have hub_wq
* take care of it. Look at the port link state
* for USB 3.0 hubs, since they don't have a suspend
* change bit, and they don't set the port link change
Expand All @@ -1208,18 +1208,18 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
set_bit(port1, hub->change_bits);

} else {
/* The power session is gone; tell khubd */
/* The power session is gone; tell hub_wq */
usb_set_device_state(udev, USB_STATE_NOTATTACHED);
set_bit(port1, hub->change_bits);
}
}

/* If no port-status-change flags were set, we don't need any
* debouncing. If flags were set we can try to debounce the
* ports all at once right now, instead of letting khubd do them
* ports all at once right now, instead of letting hub_wq do them
* one at a time later on.
*
* If any port-status changes do occur during this delay, khubd
* If any port-status changes do occur during this delay, hub_wq
* will see them later and handle them normally.
*/
if (need_debounce_delay) {
Expand Down Expand Up @@ -1280,7 +1280,7 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type)

cancel_delayed_work_sync(&hub->init_work);

/* khubd and related activity won't re-trigger */
/* hub_wq and related activity won't re-trigger */
hub->quiescing = 1;

if (type != HUB_SUSPEND) {
Expand All @@ -1291,7 +1291,7 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type)
}
}

/* Stop khubd and related activity */
/* Stop hub_wq and related activity */
usb_kill_urb(hub->urb);
if (hub->has_indicators)
cancel_delayed_work_sync(&hub->leds);
Expand Down Expand Up @@ -1613,7 +1613,7 @@ static int hub_configure(struct usb_hub *hub,
if (ret < 0)
goto fail;

/* Update the HCD's internal representation of this hub before khubd
/* Update the HCD's internal representation of this hub before hub_wq
* starts getting port status changes for devices under the hub.
*/
if (hcd->driver->update_hub_device) {
Expand Down Expand Up @@ -2045,7 +2045,7 @@ static void choose_devnum(struct usb_device *udev)
int devnum;
struct usb_bus *bus = udev->bus;

/* If khubd ever becomes multithreaded, this will need a lock */
/* If hub_wq ever becomes multithreaded, this will need a lock */
if (udev->wusb) {
devnum = udev->portnum + 1;
BUG_ON(test_bit(devnum, bus->devmap.devicemap));
Expand Down Expand Up @@ -3074,7 +3074,7 @@ static unsigned wakeup_enabled_descendants(struct usb_device *udev)
* Once VBUS drop breaks the circuit, the port it's using has to go through
* normal re-enumeration procedures, starting with enabling VBUS power.
* Other than re-initializing the hub (plug/unplug, except for root hubs),
* Linux (2.6) currently has NO mechanisms to initiate that: no khubd
* Linux (2.6) currently has NO mechanisms to initiate that: no hub_wq
* timer, no SRP, no requests through sysfs.
*
* If Runtime PM isn't enabled or used, non-SuperSpeed devices may not get
Expand Down Expand Up @@ -3216,7 +3216,7 @@ static int finish_port_resume(struct usb_device *udev)
/* usb ch9 identifies four variants of SUSPENDED, based on what
* state the device resumes to. Linux currently won't see the
* first two on the host side; they'd be inside hub_port_init()
* during many timeouts, but khubd can't suspend until later.
* during many timeouts, but hub_wq can't suspend until later.
*/
usb_set_device_state(udev, udev->actconfig
? USB_STATE_CONFIGURED
Expand Down Expand Up @@ -3581,7 +3581,7 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)

dev_dbg(&intf->dev, "%s\n", __func__);

/* stop khubd and related activity */
/* stop hub_wq and related activity */
hub_quiesce(hub, HUB_SUSPEND);
return 0;
}
Expand Down Expand Up @@ -4977,10 +4977,10 @@ static void port_event(struct usb_hub *hub, int port1)
* On disconnect USB3 protocol ports transit from U0 to
* SS.Inactive to Rx.Detect. If this happens a warm-
* reset is not needed, but a (re)connect may happen
* before khubd runs and sees the disconnect, and the
* before hub_wq runs and sees the disconnect, and the
* device may be an unknown state.
*
* If the port went through SS.Inactive without khubd
* If the port went through SS.Inactive without hub_wq
* seeing it the C_LINK_STATE change flag will be set,
* and we reset the dev to put it in a known state.
*/
Expand Down Expand Up @@ -5290,7 +5290,7 @@ static int descriptors_changed(struct usb_device *udev,
* former operating configuration. If the reset fails, or the device's
* descriptors change from their values before the reset, or the original
* configuration and altsettings cannot be restored, a flag will be set
* telling khubd to pretend the device has been disconnected and then
* telling hub_wq to pretend the device has been disconnected and then
* re-connected. All drivers will be unbound, and the device will be
* re-enumerated and probed all over again.
*
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/ehci-fsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ static int ehci_start_port_reset(struct usb_hcd *hcd, unsigned port)
if (!(status & PORT_CONNECT))
return -ENODEV;

/* khubd will finish the reset later */
/* hub_wq will finish the reset later */
if (ehci_is_TDI(ehci)) {
writel(PORT_RESET |
(status & ~(PORT_CSC | PORT_PEC | PORT_OCC)),
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/host/ehci-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
continue;

/* start 20 msec resume signaling from this port,
* and make khubd collect PORT_STAT_C_SUSPEND to
* and make hub_wq collect PORT_STAT_C_SUSPEND to
* stop that signaling. Use 5 ms extra for safety,
* like usb_port_resume() does.
*/
Expand Down
8 changes: 4 additions & 4 deletions drivers/usb/host/ehci-hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf)

/*
* Return status information even for ports with OWNER set.
* Otherwise khubd wouldn't see the disconnect event when a
* Otherwise hub_wq wouldn't see the disconnect event when a
* high-speed device is switched over to the companion
* controller by the user.
*/
Expand Down Expand Up @@ -902,7 +902,7 @@ int ehci_hub_control(

/*
* Even if OWNER is set, so the port is owned by the
* companion controller, khubd needs to be able to clear
* companion controller, hub_wq needs to be able to clear
* the port-change status bits (especially
* USB_PORT_STAT_C_CONNECTION).
*/
Expand Down Expand Up @@ -1000,7 +1000,7 @@ int ehci_hub_control(
* However, not all EHCI implementations do this
* automatically, even if they _do_ support per-port
* power switching; they're allowed to just limit the
* current. khubd will turn the power back on.
* current. hub_wq will turn the power back on.
*/
if (((temp & PORT_OC) || (ehci->need_oc_pp_cycle))
&& HCS_PPC(ehci->hcs_params)) {
Expand Down Expand Up @@ -1085,7 +1085,7 @@ int ehci_hub_control(
}

/*
* Even if OWNER is set, there's no harm letting khubd
* Even if OWNER is set, there's no harm letting hub_wq
* see the wPortStatus values (they should all be 0 except
* for PORT_POWER anyway).
*/
Expand Down
6 changes: 3 additions & 3 deletions drivers/usb/host/fhci-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,12 @@ static int fhci_start(struct usb_hcd *hcd)
hcd->state = HC_STATE_RUNNING;

/*
* From here on, khubd concurrently accesses the root
* From here on, hub_wq concurrently accesses the root
* hub; drivers will be talking to enumerated devices.
* (On restart paths, khubd already knows about the root
* (On restart paths, hub_wq already knows about the root
* hub and could find work as soon as we wrote FLAG_CF.)
*
* Before this point the HC was idle/ready. After, khubd
* Before this point the HC was idle/ready. After, hub_wq
* and device drivers may start it running.
*/
fhci_usb_enable(fhci);
Expand Down
Loading

0 comments on commit 37ebb54

Please sign in to comment.