Commit 9da51974 authored by John Youn's avatar John Youn Committed by Felipe Balbi

usb: dwc2: Cleanup some checkpatch issues

This commmit is the result of running checkpatch --fix.

The results were verified for correctness. Some of the fixes result in
line over 80 char which we will fix manually later.

The following is a summary of what was done by checkpatch:
* Remove externs on function prototypes.
* Replace symbolic permissions with octal.
* Align code to open parens.
* Replace 'unsigned' with 'unsigned int'.
* Remove unneccessary blank lines.
* Add blank lines after declarations.
* Add spaces around operators.
* Remove unnecessary spaces after casts.
* Replace 'x == NULL' with '!x'.
* Replace kzalloc() with kcalloc().
* Concatenate multi-line strings.
* Use the BIT() macro.
Signed-off-by: default avatarJohn Youn <johnyoun@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 33e4c1a9
...@@ -793,7 +793,7 @@ void dwc2_disable_global_interrupts(struct dwc2_hsotg *hsotg) ...@@ -793,7 +793,7 @@ void dwc2_disable_global_interrupts(struct dwc2_hsotg *hsotg)
} }
/* Returns the controller's GHWCFG2.OTG_MODE. */ /* Returns the controller's GHWCFG2.OTG_MODE. */
unsigned dwc2_op_mode(struct dwc2_hsotg *hsotg) unsigned int dwc2_op_mode(struct dwc2_hsotg *hsotg)
{ {
u32 ghwcfg2 = dwc2_readl(hsotg->regs + GHWCFG2); u32 ghwcfg2 = dwc2_readl(hsotg->regs + GHWCFG2);
...@@ -804,7 +804,7 @@ unsigned dwc2_op_mode(struct dwc2_hsotg *hsotg) ...@@ -804,7 +804,7 @@ unsigned dwc2_op_mode(struct dwc2_hsotg *hsotg)
/* Returns true if the controller is capable of DRD. */ /* Returns true if the controller is capable of DRD. */
bool dwc2_hw_is_otg(struct dwc2_hsotg *hsotg) bool dwc2_hw_is_otg(struct dwc2_hsotg *hsotg)
{ {
unsigned op_mode = dwc2_op_mode(hsotg); unsigned int op_mode = dwc2_op_mode(hsotg);
return (op_mode == GHWCFG2_OP_MODE_HNP_SRP_CAPABLE) || return (op_mode == GHWCFG2_OP_MODE_HNP_SRP_CAPABLE) ||
(op_mode == GHWCFG2_OP_MODE_SRP_ONLY_CAPABLE) || (op_mode == GHWCFG2_OP_MODE_SRP_ONLY_CAPABLE) ||
...@@ -814,7 +814,7 @@ bool dwc2_hw_is_otg(struct dwc2_hsotg *hsotg) ...@@ -814,7 +814,7 @@ bool dwc2_hw_is_otg(struct dwc2_hsotg *hsotg)
/* Returns true if the controller is host-only. */ /* Returns true if the controller is host-only. */
bool dwc2_hw_is_host(struct dwc2_hsotg *hsotg) bool dwc2_hw_is_host(struct dwc2_hsotg *hsotg)
{ {
unsigned op_mode = dwc2_op_mode(hsotg); unsigned int op_mode = dwc2_op_mode(hsotg);
return (op_mode == GHWCFG2_OP_MODE_SRP_CAPABLE_HOST) || return (op_mode == GHWCFG2_OP_MODE_SRP_CAPABLE_HOST) ||
(op_mode == GHWCFG2_OP_MODE_NO_SRP_CAPABLE_HOST); (op_mode == GHWCFG2_OP_MODE_NO_SRP_CAPABLE_HOST);
...@@ -823,7 +823,7 @@ bool dwc2_hw_is_host(struct dwc2_hsotg *hsotg) ...@@ -823,7 +823,7 @@ bool dwc2_hw_is_host(struct dwc2_hsotg *hsotg)
/* Returns true if the controller is device-only. */ /* Returns true if the controller is device-only. */
bool dwc2_hw_is_device(struct dwc2_hsotg *hsotg) bool dwc2_hw_is_device(struct dwc2_hsotg *hsotg)
{ {
unsigned op_mode = dwc2_op_mode(hsotg); unsigned int op_mode = dwc2_op_mode(hsotg);
return (op_mode == GHWCFG2_OP_MODE_SRP_CAPABLE_DEVICE) || return (op_mode == GHWCFG2_OP_MODE_SRP_CAPABLE_DEVICE) ||
(op_mode == GHWCFG2_OP_MODE_NO_SRP_CAPABLE_DEVICE); (op_mode == GHWCFG2_OP_MODE_NO_SRP_CAPABLE_DEVICE);
......
...@@ -1101,37 +1101,37 @@ static inline bool dwc2_is_hs_iot(struct dwc2_hsotg *hsotg) ...@@ -1101,37 +1101,37 @@ static inline bool dwc2_is_hs_iot(struct dwc2_hsotg *hsotg)
* The following functions support initialization of the core driver component * The following functions support initialization of the core driver component
* and the DWC_otg controller * and the DWC_otg controller
*/ */
extern int dwc2_core_reset(struct dwc2_hsotg *hsotg); int dwc2_core_reset(struct dwc2_hsotg *hsotg);
extern int dwc2_core_reset_and_force_dr_mode(struct dwc2_hsotg *hsotg); int dwc2_core_reset_and_force_dr_mode(struct dwc2_hsotg *hsotg);
extern int dwc2_enter_hibernation(struct dwc2_hsotg *hsotg); int dwc2_enter_hibernation(struct dwc2_hsotg *hsotg);
extern int dwc2_exit_hibernation(struct dwc2_hsotg *hsotg, bool restore); int dwc2_exit_hibernation(struct dwc2_hsotg *hsotg, bool restore);
bool dwc2_force_mode_if_needed(struct dwc2_hsotg *hsotg, bool host); bool dwc2_force_mode_if_needed(struct dwc2_hsotg *hsotg, bool host);
void dwc2_clear_force_mode(struct dwc2_hsotg *hsotg); void dwc2_clear_force_mode(struct dwc2_hsotg *hsotg);
void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg); void dwc2_force_dr_mode(struct dwc2_hsotg *hsotg);
extern bool dwc2_is_controller_alive(struct dwc2_hsotg *hsotg); bool dwc2_is_controller_alive(struct dwc2_hsotg *hsotg);
/* /*
* Common core Functions. * Common core Functions.
* The following functions support managing the DWC_otg controller in either * The following functions support managing the DWC_otg controller in either
* device or host mode. * device or host mode.
*/ */
extern void dwc2_read_packet(struct dwc2_hsotg *hsotg, u8 *dest, u16 bytes); void dwc2_read_packet(struct dwc2_hsotg *hsotg, u8 *dest, u16 bytes);
extern void dwc2_flush_tx_fifo(struct dwc2_hsotg *hsotg, const int num); void dwc2_flush_tx_fifo(struct dwc2_hsotg *hsotg, const int num);
extern void dwc2_flush_rx_fifo(struct dwc2_hsotg *hsotg); void dwc2_flush_rx_fifo(struct dwc2_hsotg *hsotg);
extern void dwc2_enable_global_interrupts(struct dwc2_hsotg *hcd); void dwc2_enable_global_interrupts(struct dwc2_hsotg *hcd);
extern void dwc2_disable_global_interrupts(struct dwc2_hsotg *hcd); void dwc2_disable_global_interrupts(struct dwc2_hsotg *hcd);
/* This function should be called on every hardware interrupt. */ /* This function should be called on every hardware interrupt. */
extern irqreturn_t dwc2_handle_common_intr(int irq, void *dev); irqreturn_t dwc2_handle_common_intr(int irq, void *dev);
/* The device ID match table */ /* The device ID match table */
extern const struct of_device_id dwc2_of_match_table[]; extern const struct of_device_id dwc2_of_match_table[];
extern int dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg); int dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg);
extern int dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg); int dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg);
/* Parameters */ /* Parameters */
int dwc2_get_hwparams(struct dwc2_hsotg *hsotg); int dwc2_get_hwparams(struct dwc2_hsotg *hsotg);
...@@ -1145,7 +1145,7 @@ int dwc2_init_params(struct dwc2_hsotg *hsotg); ...@@ -1145,7 +1145,7 @@ int dwc2_init_params(struct dwc2_hsotg *hsotg);
* are read in and cached so they always read directly from the * are read in and cached so they always read directly from the
* GHWCFG2 register. * GHWCFG2 register.
*/ */
unsigned dwc2_op_mode(struct dwc2_hsotg *hsotg); unsigned int dwc2_op_mode(struct dwc2_hsotg *hsotg);
bool dwc2_hw_is_otg(struct dwc2_hsotg *hsotg); bool dwc2_hw_is_otg(struct dwc2_hsotg *hsotg);
bool dwc2_hw_is_host(struct dwc2_hsotg *hsotg); bool dwc2_hw_is_host(struct dwc2_hsotg *hsotg);
bool dwc2_hw_is_device(struct dwc2_hsotg *hsotg); bool dwc2_hw_is_device(struct dwc2_hsotg *hsotg);
...@@ -1157,6 +1157,7 @@ static inline int dwc2_is_host_mode(struct dwc2_hsotg *hsotg) ...@@ -1157,6 +1157,7 @@ static inline int dwc2_is_host_mode(struct dwc2_hsotg *hsotg)
{ {
return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) != 0; return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) != 0;
} }
static inline int dwc2_is_device_mode(struct dwc2_hsotg *hsotg) static inline int dwc2_is_device_mode(struct dwc2_hsotg *hsotg)
{ {
return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) == 0; return (dwc2_readl(hsotg->regs + GINTSTS) & GINTSTS_CURMODE_HOST) == 0;
...@@ -1165,26 +1166,26 @@ static inline int dwc2_is_device_mode(struct dwc2_hsotg *hsotg) ...@@ -1165,26 +1166,26 @@ static inline int dwc2_is_device_mode(struct dwc2_hsotg *hsotg)
/* /*
* Dump core registers and SPRAM * Dump core registers and SPRAM
*/ */
extern void dwc2_dump_dev_registers(struct dwc2_hsotg *hsotg); void dwc2_dump_dev_registers(struct dwc2_hsotg *hsotg);
extern void dwc2_dump_host_registers(struct dwc2_hsotg *hsotg); void dwc2_dump_host_registers(struct dwc2_hsotg *hsotg);
extern void dwc2_dump_global_registers(struct dwc2_hsotg *hsotg); void dwc2_dump_global_registers(struct dwc2_hsotg *hsotg);
/* /*
* Return OTG version - either 1.3 or 2.0 * Return OTG version - either 1.3 or 2.0
*/ */
extern u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg); u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg);
/* Gadget defines */ /* Gadget defines */
#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) #if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
extern int dwc2_hsotg_remove(struct dwc2_hsotg *hsotg); int dwc2_hsotg_remove(struct dwc2_hsotg *hsotg);
extern int dwc2_hsotg_suspend(struct dwc2_hsotg *dwc2); int dwc2_hsotg_suspend(struct dwc2_hsotg *dwc2);
extern int dwc2_hsotg_resume(struct dwc2_hsotg *dwc2); int dwc2_hsotg_resume(struct dwc2_hsotg *dwc2);
extern int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq); int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq);
extern void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2, void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2,
bool reset); bool reset);
extern void dwc2_hsotg_core_connect(struct dwc2_hsotg *hsotg); void dwc2_hsotg_core_connect(struct dwc2_hsotg *hsotg);
extern void dwc2_hsotg_disconnect(struct dwc2_hsotg *dwc2); void dwc2_hsotg_disconnect(struct dwc2_hsotg *dwc2);
extern int dwc2_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode); int dwc2_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode);
#define dwc2_is_device_connected(hsotg) (hsotg->connected) #define dwc2_is_device_connected(hsotg) (hsotg->connected)
int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg); int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg);
int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg); int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg);
...@@ -1212,11 +1213,11 @@ static inline int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg) ...@@ -1212,11 +1213,11 @@ static inline int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg)
#endif #endif
#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) #if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
extern int dwc2_hcd_get_frame_number(struct dwc2_hsotg *hsotg); int dwc2_hcd_get_frame_number(struct dwc2_hsotg *hsotg);
extern int dwc2_hcd_get_future_frame_number(struct dwc2_hsotg *hsotg, int us); int dwc2_hcd_get_future_frame_number(struct dwc2_hsotg *hsotg, int us);
extern void dwc2_hcd_connect(struct dwc2_hsotg *hsotg); void dwc2_hcd_connect(struct dwc2_hsotg *hsotg);
extern void dwc2_hcd_disconnect(struct dwc2_hsotg *hsotg, bool force); void dwc2_hcd_disconnect(struct dwc2_hsotg *hsotg, bool force);
extern void dwc2_hcd_start(struct dwc2_hsotg *hsotg); void dwc2_hcd_start(struct dwc2_hsotg *hsotg);
int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg); int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg);
int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg); int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg);
#else #else
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
#include "core.h" #include "core.h"
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
extern int dwc2_debugfs_init(struct dwc2_hsotg *); int dwc2_debugfs_init(struct dwc2_hsotg *);
extern void dwc2_debugfs_exit(struct dwc2_hsotg *); void dwc2_debugfs_exit(struct dwc2_hsotg *);
#else #else
static inline int dwc2_debugfs_init(struct dwc2_hsotg *hsotg) static inline int dwc2_debugfs_init(struct dwc2_hsotg *hsotg)
{ return 0; } { return 0; }
......
...@@ -338,23 +338,23 @@ static void dwc2_hsotg_create_debug(struct dwc2_hsotg *hsotg) ...@@ -338,23 +338,23 @@ static void dwc2_hsotg_create_debug(struct dwc2_hsotg *hsotg)
{ {
struct dentry *root; struct dentry *root;
struct dentry *file; struct dentry *file;
unsigned epidx; unsigned int epidx;
root = hsotg->debug_root; root = hsotg->debug_root;
/* create general state file */ /* create general state file */
file = debugfs_create_file("state", S_IRUGO, root, hsotg, &state_fops); file = debugfs_create_file("state", 0444, root, hsotg, &state_fops);
if (IS_ERR(file)) if (IS_ERR(file))
dev_err(hsotg->dev, "%s: failed to create state\n", __func__); dev_err(hsotg->dev, "%s: failed to create state\n", __func__);
file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, hsotg, file = debugfs_create_file("testmode", 0644, root, hsotg,
&testmode_fops); &testmode_fops);
if (IS_ERR(file)) if (IS_ERR(file))
dev_err(hsotg->dev, "%s: failed to create testmode\n", dev_err(hsotg->dev, "%s: failed to create testmode\n",
__func__); __func__);
file = debugfs_create_file("fifo", S_IRUGO, root, hsotg, &fifo_fops); file = debugfs_create_file("fifo", 0444, root, hsotg, &fifo_fops);
if (IS_ERR(file)) if (IS_ERR(file))
dev_err(hsotg->dev, "%s: failed to create fifo\n", __func__); dev_err(hsotg->dev, "%s: failed to create fifo\n", __func__);
...@@ -364,7 +364,7 @@ static void dwc2_hsotg_create_debug(struct dwc2_hsotg *hsotg) ...@@ -364,7 +364,7 @@ static void dwc2_hsotg_create_debug(struct dwc2_hsotg *hsotg)
ep = hsotg->eps_out[epidx]; ep = hsotg->eps_out[epidx];
if (ep) { if (ep) {
file = debugfs_create_file(ep->name, S_IRUGO, file = debugfs_create_file(ep->name, 0444,
root, ep, &ep_fops); root, ep, &ep_fops);
if (IS_ERR(file)) if (IS_ERR(file))
dev_err(hsotg->dev, "failed to create %s debug file\n", dev_err(hsotg->dev, "failed to create %s debug file\n",
...@@ -377,7 +377,7 @@ static void dwc2_hsotg_create_debug(struct dwc2_hsotg *hsotg) ...@@ -377,7 +377,7 @@ static void dwc2_hsotg_create_debug(struct dwc2_hsotg *hsotg)
ep = hsotg->eps_in[epidx]; ep = hsotg->eps_in[epidx];
if (ep) { if (ep) {
file = debugfs_create_file(ep->name, S_IRUGO, file = debugfs_create_file(ep->name, 0444,
root, ep, &ep_fops); root, ep, &ep_fops);
if (IS_ERR(file)) if (IS_ERR(file))
dev_err(hsotg->dev, "failed to create %s debug file\n", dev_err(hsotg->dev, "failed to create %s debug file\n",
...@@ -750,7 +750,7 @@ int dwc2_debugfs_init(struct dwc2_hsotg *hsotg) ...@@ -750,7 +750,7 @@ int dwc2_debugfs_init(struct dwc2_hsotg *hsotg)
hsotg->regset->nregs = ARRAY_SIZE(dwc2_regs); hsotg->regset->nregs = ARRAY_SIZE(dwc2_regs);
hsotg->regset->base = hsotg->regs; hsotg->regset->base = hsotg->regs;
file = debugfs_create_regset32("regdump", S_IRUGO, hsotg->debug_root, file = debugfs_create_regset32("regdump", 0444, hsotg->debug_root,
hsotg->regset); hsotg->regset);
if (!file) { if (!file) {
ret = -ENOMEM; ret = -ENOMEM;
......
...@@ -316,6 +316,7 @@ static void dwc2_hsotg_unmap_dma(struct dwc2_hsotg *hsotg, ...@@ -316,6 +316,7 @@ static void dwc2_hsotg_unmap_dma(struct dwc2_hsotg *hsotg,
struct dwc2_hsotg_req *hs_req) struct dwc2_hsotg_req *hs_req)
{ {
struct usb_request *req = &hs_req->req; struct usb_request *req = &hs_req->req;
usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->dir_in); usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->dir_in);
} }
...@@ -547,17 +548,17 @@ static int dwc2_hsotg_write_fifo(struct dwc2_hsotg *hsotg, ...@@ -547,17 +548,17 @@ static int dwc2_hsotg_write_fifo(struct dwc2_hsotg *hsotg,
* Return the maximum data that can be queued in one go on a given endpoint * Return the maximum data that can be queued in one go on a given endpoint
* so that transfers that are too long can be split. * so that transfers that are too long can be split.
*/ */
static unsigned get_ep_limit(struct dwc2_hsotg_ep *hs_ep) static unsigned int get_ep_limit(struct dwc2_hsotg_ep *hs_ep)
{ {
int index = hs_ep->index; int index = hs_ep->index;
unsigned maxsize; unsigned int maxsize;
unsigned maxpkt; unsigned int maxpkt;
if (index != 0) { if (index != 0) {
maxsize = DXEPTSIZ_XFERSIZE_LIMIT + 1; maxsize = DXEPTSIZ_XFERSIZE_LIMIT + 1;
maxpkt = DXEPTSIZ_PKTCNT_LIMIT + 1; maxpkt = DXEPTSIZ_PKTCNT_LIMIT + 1;
} else { } else {
maxsize = 64+64; maxsize = 64 + 64;
if (hs_ep->dir_in) if (hs_ep->dir_in)
maxpkt = DIEPTSIZ0_PKTCNT_LIMIT + 1; maxpkt = DIEPTSIZ0_PKTCNT_LIMIT + 1;
else else
...@@ -885,9 +886,9 @@ static void dwc2_hsotg_start_req(struct dwc2_hsotg *hsotg, ...@@ -885,9 +886,9 @@ static void dwc2_hsotg_start_req(struct dwc2_hsotg *hsotg,
u32 epsize_reg; u32 epsize_reg;
u32 epsize; u32 epsize;
u32 ctrl; u32 ctrl;
unsigned length; unsigned int length;
unsigned packets; unsigned int packets;
unsigned maxreq; unsigned int maxreq;
unsigned int dma_reg; unsigned int dma_reg;
if (index != 0) { if (index != 0) {
...@@ -1889,7 +1890,6 @@ static void dwc2_hsotg_complete_request(struct dwc2_hsotg *hsotg, ...@@ -1889,7 +1890,6 @@ static void dwc2_hsotg_complete_request(struct dwc2_hsotg *hsotg,
struct dwc2_hsotg_req *hs_req, struct dwc2_hsotg_req *hs_req,
int result) int result)
{ {
if (!hs_req) { if (!hs_req) {
dev_dbg(hsotg->dev, "%s: nothing to complete?\n", __func__); dev_dbg(hsotg->dev, "%s: nothing to complete?\n", __func__);
return; return;
...@@ -2068,7 +2068,6 @@ static void dwc2_hsotg_rx_data(struct dwc2_hsotg *hsotg, int ep_idx, int size) ...@@ -2068,7 +2068,6 @@ static void dwc2_hsotg_rx_data(struct dwc2_hsotg *hsotg, int ep_idx, int size)
int max_req; int max_req;
int read_ptr; int read_ptr;
if (!hs_req) { if (!hs_req) {
u32 epctl = dwc2_readl(hsotg->regs + DOEPCTL(ep_idx)); u32 epctl = dwc2_readl(hsotg->regs + DOEPCTL(ep_idx));
int ptr; int ptr;
...@@ -2191,7 +2190,7 @@ static void dwc2_hsotg_handle_outdone(struct dwc2_hsotg *hsotg, int epnum) ...@@ -2191,7 +2190,7 @@ static void dwc2_hsotg_handle_outdone(struct dwc2_hsotg *hsotg, int epnum)
struct dwc2_hsotg_ep *hs_ep = hsotg->eps_out[epnum]; struct dwc2_hsotg_ep *hs_ep = hsotg->eps_out[epnum];
struct dwc2_hsotg_req *hs_req = hs_ep->req; struct dwc2_hsotg_req *hs_req = hs_ep->req;
struct usb_request *req = &hs_req->req; struct usb_request *req = &hs_req->req;
unsigned size_left = DXEPTSIZ_XFERSIZE_GET(epsize); unsigned int size_left = DXEPTSIZ_XFERSIZE_GET(epsize);
int result = 0; int result = 0;
if (!hs_req) { if (!hs_req) {
...@@ -2210,7 +2209,7 @@ static void dwc2_hsotg_handle_outdone(struct dwc2_hsotg *hsotg, int epnum) ...@@ -2210,7 +2209,7 @@ static void dwc2_hsotg_handle_outdone(struct dwc2_hsotg *hsotg, int epnum)
size_left = dwc2_gadget_get_xfersize_ddma(hs_ep); size_left = dwc2_gadget_get_xfersize_ddma(hs_ep);
if (using_dma(hsotg)) { if (using_dma(hsotg)) {
unsigned size_done; unsigned int size_done;
/* /*
* Calculate the size of the transfer by checking how much * Calculate the size of the transfer by checking how much
...@@ -3059,7 +3058,7 @@ static void kill_all_requests(struct dwc2_hsotg *hsotg, ...@@ -3059,7 +3058,7 @@ static void kill_all_requests(struct dwc2_hsotg *hsotg,
int result) int result)
{ {
struct dwc2_hsotg_req *req, *treq; struct dwc2_hsotg_req *req, *treq;
unsigned size; unsigned int size;
ep->req = NULL; ep->req = NULL;
...@@ -3084,7 +3083,7 @@ static void kill_all_requests(struct dwc2_hsotg *hsotg, ...@@ -3084,7 +3083,7 @@ static void kill_all_requests(struct dwc2_hsotg *hsotg,
*/ */
void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg) void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
{ {
unsigned ep; unsigned int ep;
if (!hsotg->connected) if (!hsotg->connected)
return; return;
...@@ -3462,7 +3461,6 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw) ...@@ -3462,7 +3461,6 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw)
} }
if (gintsts & (GINTSTS_USBRST | GINTSTS_RESETDET)) { if (gintsts & (GINTSTS_USBRST | GINTSTS_RESETDET)) {
u32 usb_status = dwc2_readl(hsotg->regs + GOTGCTL); u32 usb_status = dwc2_readl(hsotg->regs + GOTGCTL);
u32 connected = hsotg->connected; u32 connected = hsotg->connected;
...@@ -3827,12 +3825,13 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, ...@@ -3827,12 +3825,13 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep,
if (dir_in && hsotg->dedicated_fifos) { if (dir_in && hsotg->dedicated_fifos) {
u32 fifo_index = 0; u32 fifo_index = 0;
u32 fifo_size = UINT_MAX; u32 fifo_size = UINT_MAX;
size = hs_ep->ep.maxpacket*hs_ep->mc;
size = hs_ep->ep.maxpacket * hs_ep->mc;
for (i = 1; i < hsotg->num_of_eps; ++i) { for (i = 1; i < hsotg->num_of_eps; ++i) {
if (hsotg->fifo_map & (1<<i)) if (hsotg->fifo_map & (1 << i))
continue; continue;
val = dwc2_readl(hsotg->regs + DPTXFSIZN(i)); val = dwc2_readl(hsotg->regs + DPTXFSIZN(i));
val = (val >> FIFOSIZE_DEPTH_SHIFT)*4; val = (val >> FIFOSIZE_DEPTH_SHIFT) * 4;
if (val < size) if (val < size)
continue; continue;
/* Search for smallest acceptable fifo */ /* Search for smallest acceptable fifo */
...@@ -4046,7 +4045,6 @@ static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now) ...@@ -4046,7 +4045,6 @@ static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now)
} }
dwc2_writel(epctl, hs->regs + epreg); dwc2_writel(epctl, hs->regs + epreg);
} else { } else {
epreg = DOEPCTL(index); epreg = DOEPCTL(index);
epctl = dwc2_readl(hs->regs + epreg); epctl = dwc2_readl(hs->regs + epreg);
...@@ -4098,7 +4096,7 @@ static struct usb_ep_ops dwc2_hsotg_ep_ops = { ...@@ -4098,7 +4096,7 @@ static struct usb_ep_ops dwc2_hsotg_ep_ops = {
}; };
/** /**
* dwc2_hsotg_init - initalize the usb core * dwc2_hsotg_init - initialize the usb core
* @hsotg: The driver state * @hsotg: The driver state
*/ */
static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg) static void dwc2_hsotg_init(struct dwc2_hsotg *hsotg)
...@@ -4337,7 +4335,7 @@ static int dwc2_hsotg_vbus_session(struct usb_gadget *gadget, int is_active) ...@@ -4337,7 +4335,7 @@ static int dwc2_hsotg_vbus_session(struct usb_gadget *gadget, int is_active)
* *
* Report how much power the device may consume to the phy. * Report how much power the device may consume to the phy.
*/ */
static int dwc2_hsotg_vbus_draw(struct usb_gadget *gadget, unsigned mA) static int dwc2_hsotg_vbus_draw(struct usb_gadget *gadget, unsigned int mA)
{ {
struct dwc2_hsotg *hsotg = to_hsotg(gadget); struct dwc2_hsotg *hsotg = to_hsotg(gadget);
...@@ -4423,6 +4421,7 @@ static void dwc2_hsotg_initep(struct dwc2_hsotg *hsotg, ...@@ -4423,6 +4421,7 @@ static void dwc2_hsotg_initep(struct dwc2_hsotg *hsotg,
if (using_dma(hsotg)) { if (using_dma(hsotg)) {
u32 next = DXEPCTL_NEXTEP((epnum + 1) % 15); u32 next = DXEPCTL_NEXTEP((epnum + 1) % 15);
if (dir_in) if (dir_in)
dwc2_writel(next, hsotg->regs + DIEPCTL(epnum)); dwc2_writel(next, hsotg->regs + DIEPCTL(epnum));
else else
...@@ -4529,7 +4528,6 @@ static void dwc2_hsotg_dump(struct dwc2_hsotg *hsotg) ...@@ -4529,7 +4528,6 @@ static void dwc2_hsotg_dump(struct dwc2_hsotg *hsotg)
idx, dwc2_readl(regs + DOEPCTL(idx)), idx, dwc2_readl(regs + DOEPCTL(idx)),
dwc2_readl(regs + DOEPTSIZ(idx)), dwc2_readl(regs + DOEPTSIZ(idx)),
dwc2_readl(regs + DOEPDMA(idx))); dwc2_readl(regs + DOEPDMA(idx)));
} }
dev_info(dev, "DVBUSDIS=0x%08x, DVBUSPULSE=%08x\n", dev_info(dev, "DVBUSDIS=0x%08x, DVBUSPULSE=%08x\n",
......
...@@ -4047,7 +4047,7 @@ static struct dwc2_hsotg *dwc2_hcd_to_hsotg(struct usb_hcd *hcd) ...@@ -4047,7 +4047,7 @@ static struct dwc2_hsotg *dwc2_hcd_to_hsotg(struct usb_hcd *hcd)
{ {
struct wrapper_priv_data *p; struct wrapper_priv_data *p;
p = (struct wrapper_priv_data *) &hcd->hcd_priv; p = (struct wrapper_priv_data *)&hcd->hcd_priv;
return p->hsotg; return p->hsotg;
} }
...@@ -4082,7 +4082,7 @@ struct dwc2_tt *dwc2_host_get_tt_info(struct dwc2_hsotg *hsotg, void *context, ...@@ -4082,7 +4082,7 @@ struct dwc2_tt *dwc2_host_get_tt_info(struct dwc2_hsotg *hsotg, void *context,
*ttport = urb->dev->ttport; *ttport = urb->dev->ttport;
dwc_tt = urb->dev->tt->hcpriv; dwc_tt = urb->dev->tt->hcpriv;
if (dwc_tt == NULL) { if (!dwc_tt) {
size_t bitmap_size; size_t bitmap_size;
/* /*
...@@ -4096,7 +4096,7 @@ struct dwc2_tt *dwc2_host_get_tt_info(struct dwc2_hsotg *hsotg, void *context, ...@@ -4096,7 +4096,7 @@ struct dwc2_tt *dwc2_host_get_tt_info(struct dwc2_hsotg *hsotg, void *context,
dwc_tt = kzalloc(sizeof(*dwc_tt) + bitmap_size, dwc_tt = kzalloc(sizeof(*dwc_tt) + bitmap_size,
mem_flags); mem_flags);
if (dwc_tt == NULL) if (!dwc_tt)
return NULL; return NULL;
dwc_tt->usb_tt = urb->dev->tt; dwc_tt->usb_tt = urb->dev->tt;
...@@ -4123,7 +4123,7 @@ struct dwc2_tt *dwc2_host_get_tt_info(struct dwc2_hsotg *hsotg, void *context, ...@@ -4123,7 +4123,7 @@ struct dwc2_tt *dwc2_host_get_tt_info(struct dwc2_hsotg *hsotg, void *context,
void dwc2_host_put_tt_info(struct dwc2_hsotg *hsotg, struct dwc2_tt *dwc_tt) void dwc2_host_put_tt_info(struct dwc2_hsotg *hsotg, struct dwc2_tt *dwc_tt)
{ {
/* Model kfree and make put of NULL a no-op */ /* Model kfree and make put of NULL a no-op */
if (dwc_tt == NULL) if (!dwc_tt)
return; return;
WARN_ON(dwc_tt->refcount < 1); WARN_ON(dwc_tt->refcount < 1);
...@@ -4206,7 +4206,6 @@ void dwc2_host_complete(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, ...@@ -4206,7 +4206,6 @@ void dwc2_host_complete(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd,
usb_pipein(urb->pipe) ? "IN" : "OUT", status, usb_pipein(urb->pipe) ? "IN" : "OUT", status,
urb->actual_length); urb->actual_length);
if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
urb->error_count = dwc2_hcd_urb_get_error_count(qtd->urb); urb->error_count = dwc2_hcd_urb_get_error_count(qtd->urb);
for (i = 0; i < urb->number_of_packets; ++i) { for (i = 0; i < urb->number_of_packets; ++i) {
...@@ -4584,7 +4583,7 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, ...@@ -4584,7 +4583,7 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
dwc2_dump_urb_info(hcd, urb, "urb_enqueue"); dwc2_dump_urb_info(hcd, urb, "urb_enqueue");
} }
if (ep == NULL) if (!ep)
return -EINVAL; return -EINVAL;
if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS || if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS ||
...@@ -4654,7 +4653,7 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, ...@@ -4654,7 +4653,7 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
urb->iso_frame_desc[i].length); urb->iso_frame_desc[i].length);
urb->hcpriv = dwc2_urb; urb->hcpriv = dwc2_urb;
qh = (struct dwc2_qh *) ep->hcpriv; qh = (struct dwc2_qh *)ep->hcpriv;
/* Create QH for the endpoint if it doesn't exist */ /* Create QH for the endpoint if it doesn't exist */
if (!qh) { if (!qh) {
qh = dwc2_hcd_qh_create(hsotg, dwc2_urb, mem_flags); qh = dwc2_hcd_qh_create(hsotg, dwc2_urb, mem_flags);
...@@ -4908,7 +4907,7 @@ static void dwc2_hcd_free(struct dwc2_hsotg *hsotg) ...@@ -4908,7 +4907,7 @@ static void dwc2_hcd_free(struct dwc2_hsotg *hsotg)
for (i = 0; i < MAX_EPS_CHANNELS; i++) { for (i = 0; i < MAX_EPS_CHANNELS; i++) {
struct dwc2_host_chan *chan = hsotg->hc_ptr_array[i]; struct dwc2_host_chan *chan = hsotg->hc_ptr_array[i];
if (chan != NULL) { if (chan) {
dev_dbg(hsotg->dev, "HCD Free channel #%i, chan=%p\n", dev_dbg(hsotg->dev, "HCD Free channel #%i, chan=%p\n",
i, chan); i, chan);
hsotg->hc_ptr_array[i] = NULL; hsotg->hc_ptr_array[i] = NULL;
...@@ -4997,7 +4996,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) ...@@ -4997,7 +4996,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
/* Check if the bus driver or platform code has setup a dma_mask */ /* Check if the bus driver or platform code has setup a dma_mask */
if (hsotg->params.host_dma > 0 && if (hsotg->params.host_dma > 0 &&
hsotg->dev->dma_mask == NULL) { !hsotg->dev->dma_mask) {
dev_warn(hsotg->dev, dev_warn(hsotg->dev,
"dma_mask not set, disabling DMA\n"); "dma_mask not set, disabling DMA\n");
hsotg->params.host_dma = false; hsotg->params.host_dma = false;
...@@ -5021,7 +5020,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) ...@@ -5021,7 +5020,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
hcd->has_tt = 1; hcd->has_tt = 1;
((struct wrapper_priv_data *) &hcd->hcd_priv)->hsotg = hsotg; ((struct wrapper_priv_data *)&hcd->hcd_priv)->hsotg = hsotg;
hsotg->priv = hcd; hsotg->priv = hcd;
/* /*
...@@ -5069,7 +5068,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) ...@@ -5069,7 +5068,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
for (i = 0; i < num_channels; i++) { for (i = 0; i < num_channels; i++) {
channel = kzalloc(sizeof(*channel), GFP_KERNEL); channel = kzalloc(sizeof(*channel), GFP_KERNEL);
if (channel == NULL) if (!channel)
goto error3; goto error3;
channel->hc_num = i; channel->hc_num = i;
INIT_LIST_HEAD(&channel->split_order_list_entry); INIT_LIST_HEAD(&channel->split_order_list_entry);
......
...@@ -521,28 +521,28 @@ static inline u8 dwc2_hcd_is_pipe_out(struct dwc2_hcd_pipe_info *pipe) ...@@ -521,28 +521,28 @@ static inline u8 dwc2_hcd_is_pipe_out(struct dwc2_hcd_pipe_info *pipe)
return !dwc2_hcd_is_pipe_in(pipe); return !dwc2_hcd_is_pipe_in(pipe);
} }
extern int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq); int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq);
extern void dwc2_hcd_remove(struct dwc2_hsotg *hsotg); void dwc2_hcd_remove(struct dwc2_hsotg *hsotg);
/* Transaction Execution Functions */ /* Transaction Execution Functions */
extern enum dwc2_transaction_type dwc2_hcd_select_transactions( enum dwc2_transaction_type dwc2_hcd_select_transactions(
struct dwc2_hsotg *hsotg); struct dwc2_hsotg *hsotg);
extern void dwc2_hcd_queue_transactions(struct dwc2_hsotg *hsotg, void dwc2_hcd_queue_transactions(struct dwc2_hsotg *hsotg,
enum dwc2_transaction_type tr_type); enum dwc2_transaction_type tr_type);
/* Schedule Queue Functions */ /* Schedule Queue Functions */
/* Implemented in hcd_queue.c */ /* Implemented in hcd_queue.c */
extern struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg,
struct dwc2_hcd_urb *urb, struct dwc2_hcd_urb *urb,
gfp_t mem_flags); gfp_t mem_flags);
extern void dwc2_hcd_qh_free(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); void dwc2_hcd_qh_free(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh);
extern int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh);
extern void dwc2_hcd_qh_unlink(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); void dwc2_hcd_qh_unlink(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh);
extern void dwc2_hcd_qh_deactivate(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, void dwc2_hcd_qh_deactivate(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
int sched_csplit); int sched_csplit);
extern void dwc2_hcd_qtd_init(struct dwc2_qtd *qtd, struct dwc2_hcd_urb *urb); void dwc2_hcd_qtd_init(struct dwc2_qtd *qtd, struct dwc2_hcd_urb *urb);
extern int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd,
struct dwc2_qh *qh); struct dwc2_qh *qh);
/* Unlinks and frees a QTD */ /* Unlinks and frees a QTD */
...@@ -556,15 +556,15 @@ static inline void dwc2_hcd_qtd_unlink_and_free(struct dwc2_hsotg *hsotg, ...@@ -556,15 +556,15 @@ static inline void dwc2_hcd_qtd_unlink_and_free(struct dwc2_hsotg *hsotg,
} }
/* Descriptor DMA support functions */ /* Descriptor DMA support functions */
extern void dwc2_hcd_start_xfer_ddma(struct dwc2_hsotg *hsotg, void dwc2_hcd_start_xfer_ddma(struct dwc2_hsotg *hsotg,
struct dwc2_qh *qh); struct dwc2_qh *qh);
extern void dwc2_hcd_complete_xfer_ddma(struct dwc2_hsotg *hsotg, void dwc2_hcd_complete_xfer_ddma(struct dwc2_hsotg *hsotg,
struct dwc2_host_chan *chan, int chnum, struct dwc2_host_chan *chan, int chnum,
enum dwc2_halt_status halt_status); enum dwc2_halt_status halt_status);
extern int dwc2_hcd_qh_init_ddma(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, int dwc2_hcd_qh_init_ddma(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
gfp_t mem_flags); gfp_t mem_flags);
extern void dwc2_hcd_qh_free_ddma(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); void dwc2_hcd_qh_free_ddma(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh);
/* Check if QH is non-periodic */ /* Check if QH is non-periodic */
#define dwc2_qh_is_non_per(_qh_ptr_) \ #define dwc2_qh_is_non_per(_qh_ptr_) \
...@@ -732,7 +732,7 @@ static inline u16 dwc2_hcd_get_ep_bandwidth(struct dwc2_hsotg *hsotg, ...@@ -732,7 +732,7 @@ static inline u16 dwc2_hcd_get_ep_bandwidth(struct dwc2_hsotg *hsotg,
return qh->host_us; return qh->host_us;
} }
extern void dwc2_hcd_save_data_toggle(struct dwc2_hsotg *hsotg, void dwc2_hcd_save_data_toggle(struct dwc2_hsotg *hsotg,
struct dwc2_host_chan *chan, int chnum, struct dwc2_host_chan *chan, int chnum,
struct dwc2_qtd *qtd); struct dwc2_qtd *qtd);
...@@ -746,14 +746,14 @@ extern void dwc2_hcd_save_data_toggle(struct dwc2_hsotg *hsotg, ...@@ -746,14 +746,14 @@ extern void dwc2_hcd_save_data_toggle(struct dwc2_hsotg *hsotg,
* Returns IRQ_HANDLED if interrupt is handled * Returns IRQ_HANDLED if interrupt is handled
* Return IRQ_NONE if interrupt is not handled * Return IRQ_NONE if interrupt is not handled
*/ */
extern irqreturn_t dwc2_handle_hcd_intr(struct dwc2_hsotg *hsotg); irqreturn_t dwc2_handle_hcd_intr(struct dwc2_hsotg *hsotg);
/** /**
* dwc2_hcd_stop() - Halts the DWC_otg host mode operation * dwc2_hcd_stop() - Halts the DWC_otg host mode operation
* *
* @hsotg: The DWC2 HCD * @hsotg: The DWC2 HCD
*/ */
extern void dwc2_hcd_stop(struct dwc2_hsotg *hsotg); void dwc2_hcd_stop(struct dwc2_hsotg *hsotg);
/** /**
* dwc2_hcd_is_b_host() - Returns 1 if core currently is acting as B host, * dwc2_hcd_is_b_host() - Returns 1 if core currently is acting as B host,
...@@ -761,7 +761,7 @@ extern void dwc2_hcd_stop(struct dwc2_hsotg *hsotg); ...@@ -761,7 +761,7 @@ extern void dwc2_hcd_stop(struct dwc2_hsotg *hsotg);
* *
* @hsotg: The DWC2 HCD * @hsotg: The DWC2 HCD
*/ */
extern int dwc2_hcd_is_b_host(struct dwc2_hsotg *hsotg); int dwc2_hcd_is_b_host(struct dwc2_hsotg *hsotg);
/** /**
* dwc2_hcd_dump_state() - Dumps hsotg state * dwc2_hcd_dump_state() - Dumps hsotg state
...@@ -771,7 +771,7 @@ extern int dwc2_hcd_is_b_host(struct dwc2_hsotg *hsotg); ...@@ -771,7 +771,7 @@ extern int dwc2_hcd_is_b_host(struct dwc2_hsotg *hsotg);
* NOTE: This function will be removed once the peripheral controller code * NOTE: This function will be removed once the peripheral controller code
* is integrated and the driver is stable * is integrated and the driver is stable
*/ */
extern void dwc2_hcd_dump_state(struct dwc2_hsotg *hsotg); void dwc2_hcd_dump_state(struct dwc2_hsotg *hsotg);
/** /**
* dwc2_hcd_dump_frrem() - Dumps the average frame remaining at SOF * dwc2_hcd_dump_frrem() - Dumps the average frame remaining at SOF
...@@ -784,7 +784,7 @@ extern void dwc2_hcd_dump_state(struct dwc2_hsotg *hsotg); ...@@ -784,7 +784,7 @@ extern void dwc2_hcd_dump_state(struct dwc2_hsotg *hsotg);
* NOTE: This function will be removed once the peripheral controller code * NOTE: This function will be removed once the peripheral controller code
* is integrated and the driver is stable * is integrated and the driver is stable
*/ */
extern void dwc2_hcd_dump_frrem(struct dwc2_hsotg *hsotg); void dwc2_hcd_dump_frrem(struct dwc2_hsotg *hsotg);
/* URB interface */ /* URB interface */
...@@ -793,14 +793,14 @@ extern void dwc2_hcd_dump_frrem(struct dwc2_hsotg *hsotg); ...@@ -793,14 +793,14 @@ extern void dwc2_hcd_dump_frrem(struct dwc2_hsotg *hsotg);
#define URB_SEND_ZERO_PACKET 0x2 #define URB_SEND_ZERO_PACKET 0x2
/* Host driver callbacks */ /* Host driver callbacks */
extern struct dwc2_tt *dwc2_host_get_tt_info(struct dwc2_hsotg *hsotg, struct dwc2_tt *dwc2_host_get_tt_info(struct dwc2_hsotg *hsotg,
void *context, gfp_t mem_flags, void *context, gfp_t mem_flags,
int *ttport); int *ttport);
extern void dwc2_host_put_tt_info(struct dwc2_hsotg *hsotg, void dwc2_host_put_tt_info(struct dwc2_hsotg *hsotg,
struct dwc2_tt *dwc_tt); struct dwc2_tt *dwc_tt);
extern int dwc2_host_get_speed(struct dwc2_hsotg *hsotg, void *context); int dwc2_host_get_speed(struct dwc2_hsotg *hsotg, void *context);
extern void dwc2_host_complete(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, void dwc2_host_complete(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd,
int status); int status);
#ifdef DEBUG #ifdef DEBUG
......
...@@ -106,7 +106,7 @@ static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, ...@@ -106,7 +106,7 @@ static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
qh->desc_list_sz, qh->desc_list_sz,
DMA_TO_DEVICE); DMA_TO_DEVICE);
qh->n_bytes = kzalloc(sizeof(u32) * dwc2_max_desc_num(qh), flags); qh->n_bytes = kcalloc(dwc2_max_desc_num(qh), sizeof(u32), flags);
if (!qh->n_bytes) { if (!qh->n_bytes) {
dma_unmap_single(hsotg->dev, qh->desc_list_dma, dma_unmap_single(hsotg->dev, qh->desc_list_dma,
qh->desc_list_sz, qh->desc_list_sz,
...@@ -175,7 +175,6 @@ static void dwc2_frame_list_free(struct dwc2_hsotg *hsotg) ...@@ -175,7 +175,6 @@ static void dwc2_frame_list_free(struct dwc2_hsotg *hsotg)
hsotg->frame_list = NULL; hsotg->frame_list = NULL;
spin_unlock_irqrestore(&hsotg->lock, flags); spin_unlock_irqrestore(&hsotg->lock, flags);
} }
static void dwc2_per_sched_enable(struct dwc2_hsotg *hsotg, u32 fr_list_en) static void dwc2_per_sched_enable(struct dwc2_hsotg *hsotg, u32 fr_list_en)
......
...@@ -442,7 +442,7 @@ static u32 dwc2_get_actual_xfer_length(struct dwc2_hsotg *hsotg, ...@@ -442,7 +442,7 @@ static u32 dwc2_get_actual_xfer_length(struct dwc2_hsotg *hsotg,
count = (hctsiz & TSIZ_XFERSIZE_MASK) >> count = (hctsiz & TSIZ_XFERSIZE_MASK) >>
TSIZ_XFERSIZE_SHIFT; TSIZ_XFERSIZE_SHIFT;
length = chan->xfer_len - count; length = chan->xfer_len - count;
if (short_read != NULL) if (short_read)
*short_read = (count != 0); *short_read = (count != 0);
} else if (chan->qh->do_split) { } else if (chan->qh->do_split) {
length = qtd->ssplit_out_xfer_count; length = qtd->ssplit_out_xfer_count;
...@@ -1620,7 +1620,6 @@ static void dwc2_hc_xacterr_intr(struct dwc2_hsotg *hsotg, ...@@ -1620,7 +1620,6 @@ static void dwc2_hc_xacterr_intr(struct dwc2_hsotg *hsotg,
case USB_ENDPOINT_XFER_BULK: case USB_ENDPOINT_XFER_BULK:
qtd->error_count++; qtd->error_count++;
if (!chan->qh->ping_state) { if (!chan->qh->ping_state) {
dwc2_update_urb_state_abn(hsotg, chan, chnum, qtd->urb, dwc2_update_urb_state_abn(hsotg, chan, chnum, qtd->urb,
qtd, DWC2_HC_XFER_XACT_ERR); qtd, DWC2_HC_XFER_XACT_ERR);
dwc2_hcd_save_data_toggle(hsotg, chan, chnum, qtd); dwc2_hcd_save_data_toggle(hsotg, chan, chnum, qtd);
...@@ -1970,7 +1969,7 @@ static bool dwc2_check_qtd_still_ok(struct dwc2_qtd *qtd, struct dwc2_qh *qh) ...@@ -1970,7 +1969,7 @@ static bool dwc2_check_qtd_still_ok(struct dwc2_qtd *qtd, struct dwc2_qh *qh)
{ {
struct dwc2_qtd *cur_head; struct dwc2_qtd *cur_head;
if (qh == NULL) if (!qh)
return false; return false;
cur_head = list_first_entry(&qh->qtd_list, struct dwc2_qtd, cur_head = list_first_entry(&qh->qtd_list, struct dwc2_qtd,
......
...@@ -82,8 +82,8 @@ static int dwc2_periodic_channel_available(struct dwc2_hsotg *hsotg) ...@@ -82,8 +82,8 @@ static int dwc2_periodic_channel_available(struct dwc2_hsotg *hsotg)
status = 0; status = 0;
} else { } else {
dev_dbg(hsotg->dev, dev_dbg(hsotg->dev,
"%s: Total channels: %d, Periodic: %d, " "%s: Total channels: %d, Periodic: %d, Non-periodic: %d\n",
"Non-periodic: %d\n", __func__, num_channels, __func__, num_channels,
hsotg->periodic_channels, hsotg->non_periodic_channels); hsotg->periodic_channels, hsotg->non_periodic_channels);
status = -ENOSPC; status = -ENOSPC;
} }
...@@ -485,7 +485,6 @@ static void pmap_print(unsigned long *map, int bits_per_period, ...@@ -485,7 +485,6 @@ static void pmap_print(unsigned long *map, int bits_per_period,
} }
} }
struct dwc2_qh_print_data { struct dwc2_qh_print_data {
struct dwc2_hsotg *hsotg; struct dwc2_hsotg *hsotg;
struct dwc2_qh *qh; struct dwc2_qh *qh;
...@@ -587,7 +586,7 @@ static int dwc2_ls_pmap_schedule(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, ...@@ -587,7 +586,7 @@ static int dwc2_ls_pmap_schedule(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
unsigned long *map = dwc2_get_ls_map(hsotg, qh); unsigned long *map = dwc2_get_ls_map(hsotg, qh);
int slice; int slice;
if (map == NULL) if (!map)
return -EINVAL; return -EINVAL;
/* /*
...@@ -626,7 +625,7 @@ static void dwc2_ls_pmap_unschedule(struct dwc2_hsotg *hsotg, ...@@ -626,7 +625,7 @@ static void dwc2_ls_pmap_unschedule(struct dwc2_hsotg *hsotg,
unsigned long *map = dwc2_get_ls_map(hsotg, qh); unsigned long *map = dwc2_get_ls_map(hsotg, qh);
/* Schedule should have failed, so no worries about no error code */ /* Schedule should have failed, so no worries about no error code */
if (map == NULL) if (!map)
return; return;
pmap_unschedule(map, DWC2_LS_PERIODIC_SLICES_PER_FRAME, pmap_unschedule(map, DWC2_LS_PERIODIC_SLICES_PER_FRAME,
...@@ -1501,7 +1500,6 @@ static void dwc2_qh_init(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, ...@@ -1501,7 +1500,6 @@ static void dwc2_qh_init(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
device_ns += dwc_tt->usb_tt->think_time; device_ns += dwc_tt->usb_tt->think_time;
qh->device_us = NS_TO_US(device_ns); qh->device_us = NS_TO_US(device_ns);
qh->device_interval = urb->interval; qh->device_interval = urb->interval;
qh->host_interval = urb->interval * (do_split ? 8 : 1); qh->host_interval = urb->interval * (do_split ? 8 : 1);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment