| From ccd1c25032c5707877cc11c2925debaa0c58adee Mon Sep 17 00:00:00 2001 | 
 | From: Lu Baolu <baolu.lu@linux.intel.com> | 
 | Date: Fri, 7 Apr 2017 17:57:04 +0300 | 
 | Subject: [PATCH 190/286] usb: xhci: make several functions static | 
 |  | 
 | Several functions have a single user in the same file where it | 
 | is defined. There's no need to expose it anywhere else. | 
 |  | 
 | Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> | 
 | Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> | 
 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 
 | (cherry picked from commit 3969384cf88aa2726afb05ad5d1c6ec27e670f07) | 
 | Signed-off-by: Simon Horman <horms+renesas@verge.net.au> | 
 | --- | 
 |  drivers/usb/host/xhci.c |   59 ++++++++++++++++++++++++------------------------ | 
 |  drivers/usb/host/xhci.h |   41 --------------------------------- | 
 |  2 files changed, 30 insertions(+), 70 deletions(-) | 
 |  | 
 | --- a/drivers/usb/host/xhci.c | 
 | +++ b/drivers/usb/host/xhci.c | 
 | @@ -542,7 +542,7 @@ static int xhci_all_ports_seen_u0(struct | 
 |   * device contexts (?), set up a command ring segment (or two?), create event | 
 |   * ring (one for now). | 
 |   */ | 
 | -int xhci_init(struct usb_hcd *hcd) | 
 | +static int xhci_init(struct usb_hcd *hcd) | 
 |  { | 
 |  	struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 
 |  	int retval = 0; | 
 | @@ -685,7 +685,7 @@ EXPORT_SYMBOL_GPL(xhci_run); | 
 |   * Disable device contexts, disable IRQs, and quiesce the HC. | 
 |   * Reset the HC, finish any completed transactions, and cleanup memory. | 
 |   */ | 
 | -void xhci_stop(struct usb_hcd *hcd) | 
 | +static void xhci_stop(struct usb_hcd *hcd) | 
 |  { | 
 |  	u32 temp; | 
 |  	struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 
 | @@ -746,7 +746,7 @@ void xhci_stop(struct usb_hcd *hcd) | 
 |   * | 
 |   * This will only ever be called with the main usb_hcd (the USB3 roothub). | 
 |   */ | 
 | -void xhci_shutdown(struct usb_hcd *hcd) | 
 | +static void xhci_shutdown(struct usb_hcd *hcd) | 
 |  { | 
 |  	struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 
 |   | 
 | @@ -1182,7 +1182,7 @@ unsigned int xhci_get_endpoint_address(u | 
 |   * endpoint index to create a bitmask.  The slot context is bit 0, endpoint 0 is | 
 |   * bit 1, etc. | 
 |   */ | 
 | -unsigned int xhci_get_endpoint_flag(struct usb_endpoint_descriptor *desc) | 
 | +static unsigned int xhci_get_endpoint_flag(struct usb_endpoint_descriptor *desc) | 
 |  { | 
 |  	return 1 << (xhci_get_endpoint_index(desc) + 1); | 
 |  } | 
 | @@ -1191,7 +1191,7 @@ unsigned int xhci_get_endpoint_flag(stru | 
 |   * endpoint index to create a bitmask.  The slot context is bit 0, endpoint 0 is | 
 |   * bit 1, etc. | 
 |   */ | 
 | -unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index) | 
 | +static unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index) | 
 |  { | 
 |  	return 1 << (ep_index + 1); | 
 |  } | 
 | @@ -1335,7 +1335,7 @@ command_cleanup: | 
 |   * non-error returns are a promise to giveback() the urb later | 
 |   * we drop ownership so next owner (or urb unlink) can get it | 
 |   */ | 
 | -int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) | 
 | +static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) | 
 |  { | 
 |  	struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 
 |  	unsigned long flags; | 
 | @@ -1471,7 +1471,7 @@ free_priv: | 
 |   * Note that this function can be called in any context, or so says | 
 |   * usb_hcd_unlink_urb() | 
 |   */ | 
 | -int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | 
 | +static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | 
 |  { | 
 |  	unsigned long flags; | 
 |  	int ret, i; | 
 | @@ -1588,7 +1588,7 @@ err_giveback: | 
 |   * disabled, so there's no need for mutual exclusion to protect | 
 |   * the xhci->devs[slot_id] structure. | 
 |   */ | 
 | -int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | 
 | +static int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | 
 |  		struct usb_host_endpoint *ep) | 
 |  { | 
 |  	struct xhci_hcd *xhci; | 
 | @@ -1671,7 +1671,7 @@ int xhci_drop_endpoint(struct usb_hcd *h | 
 |   * configuration or alt setting is installed in the device, so there's no need | 
 |   * for mutual exclusion to protect the xhci->devs[slot_id] structure. | 
 |   */ | 
 | -int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | 
 | +static int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | 
 |  		struct usb_host_endpoint *ep) | 
 |  { | 
 |  	struct xhci_hcd *xhci; | 
 | @@ -2342,7 +2342,7 @@ static unsigned int xhci_get_ss_bw_consu | 
 |   | 
 |  } | 
 |   | 
 | -void xhci_drop_ep_from_interval_table(struct xhci_hcd *xhci, | 
 | +static void xhci_drop_ep_from_interval_table(struct xhci_hcd *xhci, | 
 |  		struct xhci_bw_info *ep_bw, | 
 |  		struct xhci_interval_bw_table *bw_table, | 
 |  		struct usb_device *udev, | 
 | @@ -2707,7 +2707,7 @@ static void xhci_check_bw_drop_ep_stream | 
 |   * else should be touching the xhci->devs[slot_id] structure, so we | 
 |   * don't need to take the xhci->lock for manipulating that. | 
 |   */ | 
 | -int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) | 
 | +static int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) | 
 |  { | 
 |  	int i; | 
 |  	int ret = 0; | 
 | @@ -2811,7 +2811,7 @@ command_cleanup: | 
 |  	return ret; | 
 |  } | 
 |   | 
 | -void xhci_reset_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) | 
 | +static void xhci_reset_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) | 
 |  { | 
 |  	struct xhci_hcd *xhci; | 
 |  	struct xhci_virt_device	*virt_dev; | 
 | @@ -2937,7 +2937,7 @@ void xhci_cleanup_stalled_ring(struct xh | 
 |   * Context: in_interrupt | 
 |   */ | 
 |   | 
 | -void xhci_endpoint_reset(struct usb_hcd *hcd, | 
 | +static void xhci_endpoint_reset(struct usb_hcd *hcd, | 
 |  		struct usb_host_endpoint *ep) | 
 |  { | 
 |  	struct xhci_hcd *xhci; | 
 | @@ -3113,7 +3113,7 @@ static u32 xhci_calculate_no_streams_bit | 
 |   * hardware or endpoints claim they can't support the number of requested | 
 |   * stream IDs. | 
 |   */ | 
 | -int xhci_alloc_streams(struct usb_hcd *hcd, struct usb_device *udev, | 
 | +static int xhci_alloc_streams(struct usb_hcd *hcd, struct usb_device *udev, | 
 |  		struct usb_host_endpoint **eps, unsigned int num_eps, | 
 |  		unsigned int num_streams, gfp_t mem_flags) | 
 |  { | 
 | @@ -3277,7 +3277,7 @@ cleanup: | 
 |   * Modify the endpoint context state, submit a configure endpoint command, | 
 |   * and free all endpoint rings for streams if that completes successfully. | 
 |   */ | 
 | -int xhci_free_streams(struct usb_hcd *hcd, struct usb_device *udev, | 
 | +static int xhci_free_streams(struct usb_hcd *hcd, struct usb_device *udev, | 
 |  		struct usb_host_endpoint **eps, unsigned int num_eps, | 
 |  		gfp_t mem_flags) | 
 |  { | 
 | @@ -3409,7 +3409,8 @@ void xhci_free_device_endpoint_resources | 
 |   * re-initialization during S3/S4. In this case, call xhci_alloc_dev() to | 
 |   * re-allocate the device. | 
 |   */ | 
 | -int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev) | 
 | +static int xhci_discover_or_reset_device(struct usb_hcd *hcd, | 
 | +		struct usb_device *udev) | 
 |  { | 
 |  	int ret, i; | 
 |  	unsigned long flags; | 
 | @@ -3574,7 +3575,7 @@ command_cleanup: | 
 |   * disconnected, and all traffic has been stopped and the endpoints have been | 
 |   * disabled.  Free any HC data structures associated with that device. | 
 |   */ | 
 | -void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) | 
 | +static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) | 
 |  { | 
 |  	struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 
 |  	struct xhci_virt_device *virt_dev; | 
 | @@ -3963,12 +3964,12 @@ out: | 
 |  	return ret; | 
 |  } | 
 |   | 
 | -int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | 
 | +static int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | 
 |  { | 
 |  	return xhci_setup_device(hcd, udev, SETUP_CONTEXT_ADDRESS); | 
 |  } | 
 |   | 
 | -int xhci_enable_device(struct usb_hcd *hcd, struct usb_device *udev) | 
 | +static int xhci_enable_device(struct usb_hcd *hcd, struct usb_device *udev) | 
 |  { | 
 |  	return xhci_setup_device(hcd, udev, SETUP_CONTEXT_ONLY); | 
 |  } | 
 | @@ -4125,7 +4126,7 @@ static int xhci_calculate_usb2_hw_lpm_pa | 
 |  	return PORT_BESLD(besld) | PORT_L1_TIMEOUT(l1) | PORT_HIRDM(hirdm); | 
 |  } | 
 |   | 
 | -int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, | 
 | +static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, | 
 |  			struct usb_device *udev, int enable) | 
 |  { | 
 |  	struct xhci_hcd	*xhci = hcd_to_xhci(hcd); | 
 | @@ -4249,7 +4250,7 @@ static int xhci_check_usb2_port_capabili | 
 |  	return 0; | 
 |  } | 
 |   | 
 | -int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) | 
 | +static int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) | 
 |  { | 
 |  	struct xhci_hcd	*xhci = hcd_to_xhci(hcd); | 
 |  	int		portnum = udev->portnum - 1; | 
 | @@ -4658,7 +4659,7 @@ static int calculate_max_exit_latency(st | 
 |  } | 
 |   | 
 |  /* Returns the USB3 hub-encoded value for the U1/U2 timeout. */ | 
 | -int xhci_enable_usb3_lpm_timeout(struct usb_hcd *hcd, | 
 | +static int xhci_enable_usb3_lpm_timeout(struct usb_hcd *hcd, | 
 |  			struct usb_device *udev, enum usb3_link_state state) | 
 |  { | 
 |  	struct xhci_hcd	*xhci; | 
 | @@ -4689,7 +4690,7 @@ int xhci_enable_usb3_lpm_timeout(struct | 
 |  	return hub_encoded_timeout; | 
 |  } | 
 |   | 
 | -int xhci_disable_usb3_lpm_timeout(struct usb_hcd *hcd, | 
 | +static int xhci_disable_usb3_lpm_timeout(struct usb_hcd *hcd, | 
 |  			struct usb_device *udev, enum usb3_link_state state) | 
 |  { | 
 |  	struct xhci_hcd	*xhci; | 
 | @@ -4705,24 +4706,24 @@ int xhci_disable_usb3_lpm_timeout(struct | 
 |  } | 
 |  #else /* CONFIG_PM */ | 
 |   | 
 | -int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, | 
 | +static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, | 
 |  				struct usb_device *udev, int enable) | 
 |  { | 
 |  	return 0; | 
 |  } | 
 |   | 
 | -int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) | 
 | +static int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) | 
 |  { | 
 |  	return 0; | 
 |  } | 
 |   | 
 | -int xhci_enable_usb3_lpm_timeout(struct usb_hcd *hcd, | 
 | +static int xhci_enable_usb3_lpm_timeout(struct usb_hcd *hcd, | 
 |  			struct usb_device *udev, enum usb3_link_state state) | 
 |  { | 
 |  	return USB3_LPM_DISABLED; | 
 |  } | 
 |   | 
 | -int xhci_disable_usb3_lpm_timeout(struct usb_hcd *hcd, | 
 | +static int xhci_disable_usb3_lpm_timeout(struct usb_hcd *hcd, | 
 |  			struct usb_device *udev, enum usb3_link_state state) | 
 |  { | 
 |  	return 0; | 
 | @@ -4734,7 +4735,7 @@ int xhci_disable_usb3_lpm_timeout(struct | 
 |  /* Once a hub descriptor is fetched for a device, we need to update the xHC's | 
 |   * internal data structures for the device. | 
 |   */ | 
 | -int xhci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev, | 
 | +static int xhci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev, | 
 |  			struct usb_tt *tt, gfp_t mem_flags) | 
 |  { | 
 |  	struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 
 | @@ -4840,7 +4841,7 @@ int xhci_update_hub_device(struct usb_hc | 
 |  	return ret; | 
 |  } | 
 |   | 
 | -int xhci_get_frame(struct usb_hcd *hcd) | 
 | +static int xhci_get_frame(struct usb_hcd *hcd) | 
 |  { | 
 |  	struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 
 |  	/* EHCI mods by the periodic size.  Why? */ | 
 | --- a/drivers/usb/host/xhci.h | 
 | +++ b/drivers/usb/host/xhci.h | 
 | @@ -1949,16 +1949,8 @@ void xhci_copy_ep0_dequeue_into_input_ct | 
 |  		struct usb_device *udev); | 
 |  unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc); | 
 |  unsigned int xhci_get_endpoint_address(unsigned int ep_index); | 
 | -unsigned int xhci_get_endpoint_flag(struct usb_endpoint_descriptor *desc); | 
 | -unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index); | 
 |  unsigned int xhci_last_valid_endpoint(u32 added_ctxs); | 
 |  void xhci_endpoint_zero(struct xhci_hcd *xhci, struct xhci_virt_device *virt_dev, struct usb_host_endpoint *ep); | 
 | -void xhci_drop_ep_from_interval_table(struct xhci_hcd *xhci, | 
 | -		struct xhci_bw_info *ep_bw, | 
 | -		struct xhci_interval_bw_table *bw_table, | 
 | -		struct usb_device *udev, | 
 | -		struct xhci_virt_ep *virt_ep, | 
 | -		struct xhci_tt_bw_info *tt_info); | 
 |  void xhci_update_tt_active_eps(struct xhci_hcd *xhci, | 
 |  		struct xhci_virt_device *virt_dev, | 
 |  		int old_active_eps); | 
 | @@ -2017,10 +2009,7 @@ void xhci_quiesce(struct xhci_hcd *xhci) | 
 |  int xhci_halt(struct xhci_hcd *xhci); | 
 |  int xhci_start(struct xhci_hcd *xhci); | 
 |  int xhci_reset(struct xhci_hcd *xhci); | 
 | -int xhci_init(struct usb_hcd *hcd); | 
 |  int xhci_run(struct usb_hcd *hcd); | 
 | -void xhci_stop(struct usb_hcd *hcd); | 
 | -void xhci_shutdown(struct usb_hcd *hcd); | 
 |  int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); | 
 |  void xhci_init_driver(struct hc_driver *drv, | 
 |  		      const struct xhci_driver_overrides *over); | 
 | @@ -2035,36 +2024,13 @@ int xhci_resume(struct xhci_hcd *xhci, b | 
 |  #define	xhci_resume	NULL | 
 |  #endif | 
 |   | 
 | -int xhci_get_frame(struct usb_hcd *hcd); | 
 |  irqreturn_t xhci_irq(struct usb_hcd *hcd); | 
 |  irqreturn_t xhci_msi_irq(int irq, void *hcd); | 
 |  int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev); | 
 | -void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev); | 
 |  int xhci_alloc_tt_info(struct xhci_hcd *xhci, | 
 |  		struct xhci_virt_device *virt_dev, | 
 |  		struct usb_device *hdev, | 
 |  		struct usb_tt *tt, gfp_t mem_flags); | 
 | -int xhci_alloc_streams(struct usb_hcd *hcd, struct usb_device *udev, | 
 | -		struct usb_host_endpoint **eps, unsigned int num_eps, | 
 | -		unsigned int num_streams, gfp_t mem_flags); | 
 | -int xhci_free_streams(struct usb_hcd *hcd, struct usb_device *udev, | 
 | -		struct usb_host_endpoint **eps, unsigned int num_eps, | 
 | -		gfp_t mem_flags); | 
 | -int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev); | 
 | -int xhci_enable_device(struct usb_hcd *hcd, struct usb_device *udev); | 
 | -int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev); | 
 | -int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd, | 
 | -				struct usb_device *udev, int enable); | 
 | -int xhci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev, | 
 | -			struct usb_tt *tt, gfp_t mem_flags); | 
 | -int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags); | 
 | -int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status); | 
 | -int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, struct usb_host_endpoint *ep); | 
 | -int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev, struct usb_host_endpoint *ep); | 
 | -void xhci_endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep); | 
 | -int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev); | 
 | -int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev); | 
 | -void xhci_reset_bandwidth(struct usb_hcd *hcd, struct usb_device *udev); | 
 |   | 
 |  /* xHCI ring, segment, TRB, and TD functions */ | 
 |  dma_addr_t xhci_trb_virt_to_dma(struct xhci_segment *seg, union xhci_trb *trb); | 
 | @@ -2108,9 +2074,6 @@ void xhci_queue_new_dequeue_state(struct | 
 |  		struct xhci_dequeue_state *deq_state); | 
 |  void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, | 
 |  		unsigned int ep_index, struct xhci_td *td); | 
 | -void xhci_queue_config_ep_quirk(struct xhci_hcd *xhci, | 
 | -		unsigned int slot_id, unsigned int ep_index, | 
 | -		struct xhci_dequeue_state *deq_state); | 
 |  void xhci_stop_endpoint_command_watchdog(unsigned long arg); | 
 |  void xhci_handle_command_timeout(struct work_struct *work); | 
 |   | 
 | @@ -2121,10 +2084,6 @@ void xhci_cleanup_command_queue(struct x | 
 |  /* xHCI roothub code */ | 
 |  void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array, | 
 |  				int port_id, u32 link_state); | 
 | -int xhci_enable_usb3_lpm_timeout(struct usb_hcd *hcd, | 
 | -			struct usb_device *udev, enum usb3_link_state state); | 
 | -int xhci_disable_usb3_lpm_timeout(struct usb_hcd *hcd, | 
 | -			struct usb_device *udev, enum usb3_link_state state); | 
 |  void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array, | 
 |  				int port_id, u32 port_bit); | 
 |  int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, |