* [PATCH 1/9] usb: gadget: bdc: fix code check warning or error caused by spacing
@ 2020-07-14 8:48 Chunfeng Yun
2020-07-14 8:48 ` [PATCH 2/9] usb: gadget: bdc: fix warning of embedded function name Chunfeng Yun
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Chunfeng Yun @ 2020-07-14 8:48 UTC (permalink / raw)
To: Felipe Balbi, Florian Fainelli
Cc: Greg Kroah-Hartman, Matthias Brugger, YueHaibing, Stephen Boyd,
Chunfeng Yun, linux-usb, linux-kernel, linux-arm-kernel,
linux-mediatek
fix up check warning caused by no spaces around operators,
or multiple blank lines;
fix up check error caused by space prohibited before ','
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/gadget/udc/bdc/bdc.h | 12 ++++++------
drivers/usb/gadget/udc/bdc/bdc_cmd.c | 15 +++++++--------
drivers/usb/gadget/udc/bdc/bdc_cmd.h | 2 +-
drivers/usb/gadget/udc/bdc/bdc_core.c | 4 ++--
drivers/usb/gadget/udc/bdc/bdc_ep.c | 31 ++++++++++++++-----------------
drivers/usb/gadget/udc/bdc/bdc_udc.c | 5 ++---
6 files changed, 32 insertions(+), 37 deletions(-)
diff --git a/drivers/usb/gadget/udc/bdc/bdc.h b/drivers/usb/gadget/udc/bdc/bdc.h
index 6e1e881..f56ee76 100644
--- a/drivers/usb/gadget/udc/bdc/bdc.h
+++ b/drivers/usb/gadget/udc/bdc/bdc.h
@@ -112,7 +112,7 @@
#define BDC_CMD_EPC 0x2
#define BDC_CMD_DVC 0x1
#define BDC_CMD_CWS (0x1 << 5)
-#define BDC_CMD_CST(p) (((p) & (0xf << 6))>>6)
+#define BDC_CMD_CST(p) (((p) & (0xf << 6)) >> 6)
#define BDC_CMD_EPN(p) ((p & 0x1f) << 10)
#define BDC_SUB_CMD_ADD (0x1 << 17)
#define BDC_SUB_CMD_FWK (0x4 << 17)
@@ -150,13 +150,13 @@
#define BDC_VBS (1 << 25)
#define BDC_PRS (1 << 24)
#define BDC_PCS (1 << 23)
-#define BDC_PSP(p) (((p) & (0x7 << 20))>>20)
+#define BDC_PSP(p) (((p) & (0x7 << 20)) >> 20)
#define BDC_SCN (1 << 8)
#define BDC_SDC (1 << 7)
#define BDC_SWS (1 << 4)
-#define BDC_USPSC_RW (BDC_SCN|BDC_SDC|BDC_SWS|0xf)
-#define BDC_PSP(p) (((p) & (0x7 << 20))>>20)
+#define BDC_USPSC_RW (BDC_SCN | BDC_SDC | BDC_SWS | 0xf)
+#define BDC_PSP(p) (((p) & (0x7 << 20)) >> 20)
#define BDC_SPEED_FS 0x1
#define BDC_SPEED_LS 0x2
@@ -184,7 +184,7 @@
#define BDC_COP_RUN (2 << 29)
#define BDC_COP_STP (4 << 29)
-#define BDC_COP_MASK (BDC_COP_RST|BDC_COP_RUN|BDC_COP_STP)
+#define BDC_COP_MASK (BDC_COP_RST | BDC_COP_RUN | BDC_COP_STP)
#define BDC_COS (1 << 28)
#define BDC_CSTS(p) (((p) & (0x7 << 20)) >> 20)
@@ -218,7 +218,7 @@
#define BDC_SRR_DPI(p) (((p) & (0xff << 16)) >> 16)
#define BDC_SRR_DPI_MASK 0x00ff0000
-#define MARK_CHAIN_BD (BD_CHAIN|BD_EOT|BD_SOT)
+#define MARK_CHAIN_BD (BD_CHAIN | BD_EOT | BD_SOT)
/* Control transfer BD specific fields */
#define BD_DIR_IN (1 << 25)
diff --git a/drivers/usb/gadget/udc/bdc/bdc_cmd.c b/drivers/usb/gadget/udc/bdc/bdc_cmd.c
index 44c2a5e..fba0c68 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_cmd.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_cmd.c
@@ -109,7 +109,7 @@ int bdc_dconfig_ep(struct bdc *bdc, struct bdc_ep *ep)
{
u32 cmd_sc;
- cmd_sc = BDC_SUB_CMD_DRP_EP|BDC_CMD_EPN(ep->ep_num)|BDC_CMD_EPC;
+ cmd_sc = BDC_SUB_CMD_DRP_EP | BDC_CMD_EPN(ep->ep_num) | BDC_CMD_EPC;
dev_dbg(bdc->dev, "%s ep->ep_num =%d cmd_sc=%x\n", __func__,
ep->ep_num, cmd_sc);
@@ -163,8 +163,7 @@ int bdc_config_ep(struct bdc *bdc, struct bdc_ep *ep)
usb_endpoint_xfer_isoc(desc)) {
param2 |= si;
if (usb_endpoint_xfer_isoc(desc) && comp_desc)
- mul = comp_desc->bmAttributes;
-
+ mul = comp_desc->bmAttributes;
}
param2 |= mul << EPM_SHIFT;
if (comp_desc)
@@ -203,7 +202,7 @@ int bdc_config_ep(struct bdc *bdc, struct bdc_ep *ep)
return -EINVAL;
}
- cmd_sc |= BDC_CMD_EPC|BDC_CMD_EPN(ep->ep_num)|BDC_SUB_CMD_ADD_EP;
+ cmd_sc |= BDC_CMD_EPC | BDC_CMD_EPN(ep->ep_num) | BDC_SUB_CMD_ADD_EP;
dev_dbg(bdc->dev, "cmd_sc=%x param2=%08x\n", cmd_sc, param2);
ret = bdc_submit_cmd(bdc, cmd_sc, param0, param1, param2);
@@ -232,7 +231,7 @@ int bdc_ep_bla(struct bdc *bdc, struct bdc_ep *ep, dma_addr_t dma_addr)
cpu_to_le32s(¶m0);
cpu_to_le32s(¶m1);
- cmd_sc |= BDC_CMD_EPN(ep->ep_num)|BDC_CMD_BLA;
+ cmd_sc |= BDC_CMD_EPN(ep->ep_num) | BDC_CMD_BLA;
dev_dbg(bdc->dev, "cmd_sc=%x\n", cmd_sc);
return bdc_submit_cmd(bdc, cmd_sc, param0, param1, 0);
@@ -245,7 +244,7 @@ int bdc_address_device(struct bdc *bdc, u32 add)
u32 param2;
dev_dbg(bdc->dev, "%s: add=%d\n", __func__, add);
- cmd_sc |= BDC_SUB_CMD_ADD|BDC_CMD_DVC;
+ cmd_sc |= BDC_SUB_CMD_ADD | BDC_CMD_DVC;
param2 = add & 0x7f;
return bdc_submit_cmd(bdc, cmd_sc, 0, 0, param2);
@@ -263,7 +262,7 @@ int bdc_function_wake_fh(struct bdc *bdc, u8 intf)
param0 |= TRA_PACKET;
param0 |= (bdc->dev_addr << 25);
param1 |= DEV_NOTF_TYPE;
- param1 |= (FWK_SUBTYPE<<4);
+ param1 |= (FWK_SUBTYPE << 4);
dev_dbg(bdc->dev, "param0=%08x param1=%08x\n", param0, param1);
return bdc_submit_cmd(bdc, cmd_sc, param0, param1, 0);
@@ -277,7 +276,7 @@ int bdc_function_wake(struct bdc *bdc, u8 intf)
dev_dbg(bdc->dev, "%s intf=%d", __func__, intf);
param2 |= intf;
- cmd_sc |= BDC_SUB_CMD_FWK|BDC_CMD_DNC;
+ cmd_sc |= BDC_SUB_CMD_FWK | BDC_CMD_DNC;
return bdc_submit_cmd(bdc, cmd_sc, 0, 0, param2);
}
diff --git a/drivers/usb/gadget/udc/bdc/bdc_cmd.h b/drivers/usb/gadget/udc/bdc/bdc_cmd.h
index 29cc988..c24e6fc 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_cmd.h
+++ b/drivers/usb/gadget/udc/bdc/bdc_cmd.h
@@ -16,7 +16,7 @@
int bdc_stop_ep(struct bdc *, int);
int bdc_ep_set_stall(struct bdc *, int);
int bdc_ep_clear_stall(struct bdc *, int);
-int bdc_ep_set_halt(struct bdc_ep *, u32 , int);
+int bdc_ep_set_halt(struct bdc_ep *, u32, int);
int bdc_ep_bla(struct bdc *, struct bdc_ep *, dma_addr_t);
int bdc_function_wake(struct bdc*, u8);
int bdc_function_wake_fh(struct bdc*, u8);
diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c
index d567e20..cbdc127 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_core.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_core.c
@@ -59,7 +59,7 @@ int bdc_stop(struct bdc *bdc)
return 0;
}
temp &= ~BDC_COP_MASK;
- temp |= BDC_COS|BDC_COP_STP;
+ temp |= BDC_COS | BDC_COP_STP;
bdc_writel(bdc->regs, BDC_BDCSC, temp);
ret = poll_oip(bdc, BDC_COP_TIMEOUT);
@@ -83,7 +83,7 @@ int bdc_reset(struct bdc *bdc)
temp = bdc_readl(bdc->regs, BDC_BDCSC);
temp &= ~BDC_COP_MASK;
- temp |= BDC_COS|BDC_COP_RST;
+ temp |= BDC_COS | BDC_COP_RST;
bdc_writel(bdc->regs, BDC_BDCSC, temp);
ret = poll_oip(bdc, BDC_COP_TIMEOUT);
if (ret)
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index ba250cf..c573e9e 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -104,16 +104,16 @@ static inline void chain_table(struct bd_table *prev_table,
u32 bd_p_tab)
{
/* Chain the prev table to next table */
- prev_table->start_bd[bd_p_tab-1].offset[0] =
+ prev_table->start_bd[bd_p_tab - 1].offset[0] =
cpu_to_le32(lower_32_bits(next_table->dma));
- prev_table->start_bd[bd_p_tab-1].offset[1] =
+ prev_table->start_bd[bd_p_tab - 1].offset[1] =
cpu_to_le32(upper_32_bits(next_table->dma));
- prev_table->start_bd[bd_p_tab-1].offset[2] =
+ prev_table->start_bd[bd_p_tab - 1].offset[2] =
0x0;
- prev_table->start_bd[bd_p_tab-1].offset[3] =
+ prev_table->start_bd[bd_p_tab - 1].offset[3] =
cpu_to_le32(MARK_CHAIN_BD);
}
@@ -275,7 +275,7 @@ static inline int find_end_bdi(struct bdc_ep *ep, int next_hwd_bdi)
end_bdi = next_hwd_bdi - 1;
if (end_bdi < 0)
end_bdi = ep->bd_list.max_bdi - 1;
- else if ((end_bdi % (ep->bd_list.num_bds_table-1)) == 0)
+ else if ((end_bdi % (ep->bd_list.num_bds_table - 1)) == 0)
end_bdi--;
return end_bdi;
@@ -442,7 +442,7 @@ static int setup_bd_list_xfr(struct bdc *bdc, struct bdc_req *req, int num_bds)
req_len = req->usb_req.length;
maxp = usb_endpoint_maxp(ep->desc);
tfs = roundup(req->usb_req.length, maxp);
- tfs = tfs/maxp;
+ tfs = tfs / maxp;
dev_vdbg(bdc->dev, "%s ep:%s num_bds:%d tfs:%d r_len:%d bd:%p\n",
__func__, ep->name, num_bds, tfs, req_len, bd);
@@ -450,7 +450,7 @@ static int setup_bd_list_xfr(struct bdc *bdc, struct bdc_req *req, int num_bds)
dword2 = dword3 = 0;
/* First bd */
if (!bdnum) {
- dword3 |= BD_SOT|BD_SBF|(tfs<<BD_TFS_SHIFT);
+ dword3 |= BD_SOT | BD_SBF | (tfs << BD_TFS_SHIFT);
dword2 |= BD_LTF;
/* format of first bd for ep0 is different than other */
if (ep->ep_num == 1) {
@@ -682,7 +682,6 @@ static int ep0_queue(struct bdc_ep *ep, struct bdc_req *req)
*/
if (req->usb_req.length == 0)
return 0;
-
}
ret = usb_gadget_map_request(&bdc->gadget, &req->usb_req, ep->dir);
if (ret) {
@@ -793,7 +792,7 @@ static int ep_dequeue(struct bdc_ep *ep, struct bdc_req *req)
start_pending = true;
end_pending = true;
} else if (end_bdi >= curr_hw_dqpi || end_bdi <= eqp_bdi) {
- end_pending = true;
+ end_pending = true;
}
} else {
if (start_bdi >= curr_hw_dqpi) {
@@ -820,7 +819,7 @@ static int ep_dequeue(struct bdc_ep *ep, struct bdc_req *req)
tbi = bdi_to_tbi(ep, req->bd_xfr.next_hwd_bdi);
table = ep->bd_list.bd_table_array[tbi];
next_bd_dma = table->dma +
- sizeof(struct bdc_bd)*(req->bd_xfr.next_hwd_bdi -
+ sizeof(struct bdc_bd) * (req->bd_xfr.next_hwd_bdi -
tbi * ep->bd_list.num_bds_table);
first_req = list_first_entry(&ep->queue, struct bdc_req,
@@ -1009,14 +1008,14 @@ static void handle_xsr_succ_status(struct bdc *bdc, struct bdc_ep *ep,
bdi_to_tbi(ep, short_bdi)))
max_len_bds--;
} else {
- chain_bds = max_len_bds/bd_list->num_bds_table;
+ chain_bds = max_len_bds / bd_list->num_bds_table;
max_len_bds -= chain_bds;
}
} else {
/* there is a wrap in the ring within a xfr */
- chain_bds = (bd_list->max_bdi - start_bdi)/
+ chain_bds = (bd_list->max_bdi - start_bdi) /
bd_list->num_bds_table;
- chain_bds += short_bdi/bd_list->num_bds_table;
+ chain_bds += short_bdi / bd_list->num_bds_table;
max_len_bds = bd_list->max_bdi - start_bdi;
max_len_bds += short_bdi;
max_len_bds -= chain_bds;
@@ -1076,7 +1075,6 @@ void bdc_xsf_ep0_setup_recv(struct bdc *bdc, struct bdc_sr *sreport)
else
bdc->ep0_state = WAIT_FOR_DATA_START;
-
dev_dbg(bdc->dev,
"%s exit ep0_state:%s\n",
__func__, ep0_state_string[bdc->ep0_state]);
@@ -1344,7 +1342,7 @@ static int ep0_handle_status(struct bdc *bdc,
epnum = wIndex & USB_ENDPOINT_NUMBER_MASK;
if (epnum) {
if ((wIndex & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN)
- epnum = epnum*2 + 1;
+ epnum = epnum * 2 + 1;
else
epnum *= 2;
} else {
@@ -1634,7 +1632,6 @@ static void ep0_xsf_complete(struct bdc *bdc, struct bdc_sr *sreport)
dev_err(bdc->dev,
"Unknown ep0_state:%s\n",
ep0_state_string[bdc->ep0_state]);
-
}
}
@@ -1645,7 +1642,7 @@ void bdc_sr_xsf(struct bdc *bdc, struct bdc_sr *sreport)
u32 sr_status;
u8 ep_num;
- ep_num = (le32_to_cpu(sreport->offset[3])>>4) & 0x1f;
+ ep_num = (le32_to_cpu(sreport->offset[3]) >> 4) & 0x1f;
ep = bdc->bdc_ep_array[ep_num];
if (!ep || !(ep->flags & BDC_EP_ENABLED)) {
dev_err(bdc->dev, "xsf for ep not enabled\n");
diff --git a/drivers/usb/gadget/udc/bdc/bdc_udc.c b/drivers/usb/gadget/udc/bdc/bdc_udc.c
index 248426a..15652c5 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_udc.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_udc.c
@@ -342,7 +342,7 @@ static irqreturn_t bdc_udc_interrupt(int irq, void *_bdc)
/* update the hw dequeue pointer */
srr_int = bdc_readl(bdc->regs, BDC_SRRINT(0));
srr_int &= ~BDC_SRR_DPI_MASK;
- srr_int &= ~(BDC_SRR_RWS|BDC_SRR_RST|BDC_SRR_ISR);
+ srr_int &= ~(BDC_SRR_RWS | BDC_SRR_RST | BDC_SRR_ISR);
srr_int |= ((bdc->srr.dqp_index) << 16);
srr_int |= BDC_SRR_IP;
bdc_writel(bdc->regs, BDC_SRRINT(0), srr_int);
@@ -527,10 +527,9 @@ int bdc_udc_init(struct bdc *bdc)
bdc->gadget.sg_supported = false;
-
bdc->gadget.name = BRCM_BDC_NAME;
ret = devm_request_irq(bdc->dev, bdc->irq, bdc_udc_interrupt,
- IRQF_SHARED , BRCM_BDC_NAME, bdc);
+ IRQF_SHARED, BRCM_BDC_NAME, bdc);
if (ret) {
dev_err(bdc->dev,
"failed to request irq #%d %d\n",
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/9] usb: gadget: bdc: fix warning of embedded function name
2020-07-14 8:48 [PATCH 1/9] usb: gadget: bdc: fix code check warning or error caused by spacing Chunfeng Yun
@ 2020-07-14 8:48 ` Chunfeng Yun
2020-07-14 8:48 ` [PATCH 3/9] usb: gadget: bdc: fix improper SPDX comment style for header file Chunfeng Yun
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Chunfeng Yun @ 2020-07-14 8:48 UTC (permalink / raw)
To: Felipe Balbi, Florian Fainelli
Cc: Greg Kroah-Hartman, Matthias Brugger, YueHaibing, Stephen Boyd,
Chunfeng Yun, linux-usb, linux-kernel, linux-arm-kernel,
linux-mediatek
Use '"%s...", __func__' to replace embedded function name
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/gadget/udc/bdc/bdc_dbg.c | 2 +-
drivers/usb/gadget/udc/bdc/bdc_ep.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/gadget/udc/bdc/bdc_dbg.c b/drivers/usb/gadget/udc/bdc/bdc_dbg.c
index 7ba7448..9c03e13 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_dbg.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_dbg.c
@@ -68,7 +68,7 @@ void bdc_dbg_srr(struct bdc *bdc, u32 srr_num)
sr = bdc->srr.sr_bds;
addr = bdc->srr.dma_addr;
- dev_vdbg(bdc->dev, "bdc_dbg_srr sr:%p dqp_index:%d\n",
+ dev_vdbg(bdc->dev, "%s sr:%p dqp_index:%d\n", __func__,
sr, bdc->srr.dqp_index);
for (i = 0; i < NUM_SR_ENTRIES; i++) {
sr = &bdc->srr.sr_bds[i];
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index c573e9e..0c44002 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -756,7 +756,7 @@ static int ep_dequeue(struct bdc_ep *ep, struct bdc_req *req)
dev_dbg(bdc->dev, "%s ep:%s start:%d end:%d\n",
__func__, ep->name, start_bdi, end_bdi);
- dev_dbg(bdc->dev, "ep_dequeue ep=%p ep->desc=%p\n",
+ dev_dbg(bdc->dev, "%s ep=%p ep->desc=%p\n", __func__,
ep, (void *)ep->usb_ep.desc);
/* Stop the ep to see where the HW is ? */
ret = bdc_stop_ep(bdc, ep->ep_num);
@@ -1853,12 +1853,12 @@ static int bdc_gadget_ep_enable(struct usb_ep *_ep,
int ret;
if (!_ep || !desc || desc->bDescriptorType != USB_DT_ENDPOINT) {
- pr_debug("bdc_gadget_ep_enable invalid parameters\n");
+ pr_debug("%s invalid parameters\n", __func__);
return -EINVAL;
}
if (!desc->wMaxPacketSize) {
- pr_debug("bdc_gadget_ep_enable missing wMaxPacketSize\n");
+ pr_debug("%s missing wMaxPacketSize\n", __func__);
return -EINVAL;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/9] usb: gadget: bdc: fix improper SPDX comment style for header file
2020-07-14 8:48 [PATCH 1/9] usb: gadget: bdc: fix code check warning or error caused by spacing Chunfeng Yun
2020-07-14 8:48 ` [PATCH 2/9] usb: gadget: bdc: fix warning of embedded function name Chunfeng Yun
@ 2020-07-14 8:48 ` Chunfeng Yun
2020-07-14 8:48 ` [PATCH 4/9] usb: gadget: bdc: remove bdc_ep_set_halt() declaration Chunfeng Yun
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Chunfeng Yun @ 2020-07-14 8:48 UTC (permalink / raw)
To: Felipe Balbi, Florian Fainelli
Cc: Greg Kroah-Hartman, Matthias Brugger, YueHaibing, Stephen Boyd,
Chunfeng Yun, linux-usb, linux-kernel, linux-arm-kernel,
linux-mediatek
For C header files Documentation/process/license-rules.rst
mandates C-like comments (opposed to C source files where
C++ style should be used).
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/gadget/udc/bdc/bdc.h | 2 +-
drivers/usb/gadget/udc/bdc/bdc_cmd.h | 2 +-
drivers/usb/gadget/udc/bdc/bdc_dbg.h | 2 +-
drivers/usb/gadget/udc/bdc/bdc_ep.h | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/gadget/udc/bdc/bdc.h b/drivers/usb/gadget/udc/bdc/bdc.h
index f56ee76..ee0eafc 100644
--- a/drivers/usb/gadget/udc/bdc/bdc.h
+++ b/drivers/usb/gadget/udc/bdc/bdc.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+/* SPDX-License-Identifier: GPL-2.0+ */
/*
* bdc.h - header for the BRCM BDC USB3.0 device controller
*
diff --git a/drivers/usb/gadget/udc/bdc/bdc_cmd.h b/drivers/usb/gadget/udc/bdc/bdc_cmd.h
index c24e6fc..e481d36 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_cmd.h
+++ b/drivers/usb/gadget/udc/bdc/bdc_cmd.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+/* SPDX-License-Identifier: GPL-2.0+ */
/*
* bdc_cmd.h - header for the BDC debug functions
*
diff --git a/drivers/usb/gadget/udc/bdc/bdc_dbg.h b/drivers/usb/gadget/udc/bdc/bdc_dbg.h
index 373d5ab..859d588 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_dbg.h
+++ b/drivers/usb/gadget/udc/bdc/bdc_dbg.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+/* SPDX-License-Identifier: GPL-2.0+ */
/*
* bdc_dbg.h - header for the BDC debug functions
*
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.h b/drivers/usb/gadget/udc/bdc/bdc_ep.h
index a37ff803..5bbd73f 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.h
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+/* SPDX-License-Identifier: GPL-2.0+ */
/*
* bdc_ep.h - header for the BDC debug functions
*
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/9] usb: gadget: bdc: remove bdc_ep_set_halt() declaration
2020-07-14 8:48 [PATCH 1/9] usb: gadget: bdc: fix code check warning or error caused by spacing Chunfeng Yun
2020-07-14 8:48 ` [PATCH 2/9] usb: gadget: bdc: fix warning of embedded function name Chunfeng Yun
2020-07-14 8:48 ` [PATCH 3/9] usb: gadget: bdc: fix improper SPDX comment style for header file Chunfeng Yun
@ 2020-07-14 8:48 ` Chunfeng Yun
2020-07-14 8:48 ` [PATCH 5/9] usb: gadget: bdc: add identifier name for function declaraion Chunfeng Yun
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Chunfeng Yun @ 2020-07-14 8:48 UTC (permalink / raw)
To: Felipe Balbi, Florian Fainelli
Cc: Greg Kroah-Hartman, Matthias Brugger, YueHaibing, Stephen Boyd,
Chunfeng Yun, linux-usb, linux-kernel, linux-arm-kernel,
linux-mediatek
No definition for bdc_ep_set_halt(), so remove it.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/gadget/udc/bdc/bdc_cmd.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/usb/gadget/udc/bdc/bdc_cmd.h b/drivers/usb/gadget/udc/bdc/bdc_cmd.h
index e481d36..a3a6dbd 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_cmd.h
+++ b/drivers/usb/gadget/udc/bdc/bdc_cmd.h
@@ -16,7 +16,6 @@
int bdc_stop_ep(struct bdc *, int);
int bdc_ep_set_stall(struct bdc *, int);
int bdc_ep_clear_stall(struct bdc *, int);
-int bdc_ep_set_halt(struct bdc_ep *, u32, int);
int bdc_ep_bla(struct bdc *, struct bdc_ep *, dma_addr_t);
int bdc_function_wake(struct bdc*, u8);
int bdc_function_wake_fh(struct bdc*, u8);
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/9] usb: gadget: bdc: add identifier name for function declaraion
2020-07-14 8:48 [PATCH 1/9] usb: gadget: bdc: fix code check warning or error caused by spacing Chunfeng Yun
` (2 preceding siblings ...)
2020-07-14 8:48 ` [PATCH 4/9] usb: gadget: bdc: remove bdc_ep_set_halt() declaration Chunfeng Yun
@ 2020-07-14 8:48 ` Chunfeng Yun
2020-07-14 8:48 ` [PATCH 6/9] usb: gadget: bdc: fix check warning of block comments alignment Chunfeng Yun
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Chunfeng Yun @ 2020-07-14 8:48 UTC (permalink / raw)
To: Felipe Balbi, Florian Fainelli
Cc: Greg Kroah-Hartman, Matthias Brugger, YueHaibing, Stephen Boyd,
Chunfeng Yun, linux-usb, linux-kernel, linux-arm-kernel,
linux-mediatek
This is used to avoid the warning of function arguments, e.g.
WARNING:FUNCTION_ARGUMENTS: function definition argument 'u32'
should also have an identifier name
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/gadget/udc/bdc/bdc.h | 28 ++++++++++++++--------------
drivers/usb/gadget/udc/bdc/bdc_cmd.h | 18 +++++++++---------
drivers/usb/gadget/udc/bdc/bdc_dbg.h | 8 ++++----
drivers/usb/gadget/udc/bdc/bdc_ep.h | 8 ++++----
4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/drivers/usb/gadget/udc/bdc/bdc.h b/drivers/usb/gadget/udc/bdc/bdc.h
index ee0eafc..9615438 100644
--- a/drivers/usb/gadget/udc/bdc/bdc.h
+++ b/drivers/usb/gadget/udc/bdc/bdc.h
@@ -466,24 +466,24 @@ static inline void bdc_writel(void __iomem *base, u32 offset, u32 value)
}
/* Buffer descriptor list operations */
-void bdc_notify_xfr(struct bdc *, u32);
-void bdc_softconn(struct bdc *);
-void bdc_softdisconn(struct bdc *);
-int bdc_run(struct bdc *);
-int bdc_stop(struct bdc *);
-int bdc_reset(struct bdc *);
-int bdc_udc_init(struct bdc *);
-void bdc_udc_exit(struct bdc *);
-int bdc_reinit(struct bdc *);
+void bdc_notify_xfr(struct bdc *bdc, u32 epnum);
+void bdc_softconn(struct bdc *bdc);
+void bdc_softdisconn(struct bdc *bdc);
+int bdc_run(struct bdc *bdc);
+int bdc_stop(struct bdc *bdc);
+int bdc_reset(struct bdc *bdc);
+int bdc_udc_init(struct bdc *bdc);
+void bdc_udc_exit(struct bdc *bdc);
+int bdc_reinit(struct bdc *bdc);
/* Status report handlers */
/* Upstream port status change sr */
-void bdc_sr_uspc(struct bdc *, struct bdc_sr *);
+void bdc_sr_uspc(struct bdc *bdc, struct bdc_sr *sreport);
/* transfer sr */
-void bdc_sr_xsf(struct bdc *, struct bdc_sr *);
+void bdc_sr_xsf(struct bdc *bdc, struct bdc_sr *sreport);
/* EP0 XSF handlers */
-void bdc_xsf_ep0_setup_recv(struct bdc *, struct bdc_sr *);
-void bdc_xsf_ep0_data_start(struct bdc *, struct bdc_sr *);
-void bdc_xsf_ep0_status_start(struct bdc *, struct bdc_sr *);
+void bdc_xsf_ep0_setup_recv(struct bdc *bdc, struct bdc_sr *sreport);
+void bdc_xsf_ep0_data_start(struct bdc *bdc, struct bdc_sr *sreport);
+void bdc_xsf_ep0_status_start(struct bdc *bdc, struct bdc_sr *sreport);
#endif /* __LINUX_BDC_H__ */
diff --git a/drivers/usb/gadget/udc/bdc/bdc_cmd.h b/drivers/usb/gadget/udc/bdc/bdc_cmd.h
index a3a6dbd..533ad52 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_cmd.h
+++ b/drivers/usb/gadget/udc/bdc/bdc_cmd.h
@@ -10,14 +10,14 @@
#define __LINUX_BDC_CMD_H__
/* Command operations */
-int bdc_address_device(struct bdc *, u32);
-int bdc_config_ep(struct bdc *, struct bdc_ep *);
-int bdc_dconfig_ep(struct bdc *, struct bdc_ep *);
-int bdc_stop_ep(struct bdc *, int);
-int bdc_ep_set_stall(struct bdc *, int);
-int bdc_ep_clear_stall(struct bdc *, int);
-int bdc_ep_bla(struct bdc *, struct bdc_ep *, dma_addr_t);
-int bdc_function_wake(struct bdc*, u8);
-int bdc_function_wake_fh(struct bdc*, u8);
+int bdc_address_device(struct bdc *bdc, u32 add);
+int bdc_config_ep(struct bdc *bdc, struct bdc_ep *ep);
+int bdc_dconfig_ep(struct bdc *bdc, struct bdc_ep *ep);
+int bdc_stop_ep(struct bdc *bdc, int epnum);
+int bdc_ep_set_stall(struct bdc *bdc, int epnum);
+int bdc_ep_clear_stall(struct bdc *bdc, int epnum);
+int bdc_ep_bla(struct bdc *bdc, struct bdc_ep *ep, dma_addr_t dma_addr);
+int bdc_function_wake(struct bdc *bdc, u8 intf);
+int bdc_function_wake_fh(struct bdc *bdc, u8 intf);
#endif /* __LINUX_BDC_CMD_H__ */
diff --git a/drivers/usb/gadget/udc/bdc/bdc_dbg.h b/drivers/usb/gadget/udc/bdc/bdc_dbg.h
index 859d588..acd8332 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_dbg.h
+++ b/drivers/usb/gadget/udc/bdc/bdc_dbg.h
@@ -12,10 +12,10 @@
#include "bdc.h"
#ifdef CONFIG_USB_GADGET_VERBOSE
-void bdc_dbg_bd_list(struct bdc *, struct bdc_ep*);
-void bdc_dbg_srr(struct bdc *, u32);
-void bdc_dbg_regs(struct bdc *);
-void bdc_dump_epsts(struct bdc *);
+void bdc_dbg_bd_list(struct bdc *bdc, struct bdc_ep *ep);
+void bdc_dbg_srr(struct bdc *bdc, u32 srr_num);
+void bdc_dbg_regs(struct bdc *bdc);
+void bdc_dump_epsts(struct bdc *bdc);
#else
static inline void bdc_dbg_regs(struct bdc *bdc)
{ }
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.h b/drivers/usb/gadget/udc/bdc/bdc_ep.h
index 5bbd73f..4d3affd 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.h
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.h
@@ -9,9 +9,9 @@
#ifndef __LINUX_BDC_EP_H__
#define __LINUX_BDC_EP_H__
-int bdc_init_ep(struct bdc *);
-int bdc_ep_disable(struct bdc_ep *);
-int bdc_ep_enable(struct bdc_ep *);
-void bdc_free_ep(struct bdc *);
+int bdc_init_ep(struct bdc *bdc);
+int bdc_ep_disable(struct bdc_ep *ep);
+int bdc_ep_enable(struct bdc_ep *ep);
+void bdc_free_ep(struct bdc *bdc);
#endif /* __LINUX_BDC_EP_H__ */
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/9] usb: gadget: bdc: fix check warning of block comments alignment
2020-07-14 8:48 [PATCH 1/9] usb: gadget: bdc: fix code check warning or error caused by spacing Chunfeng Yun
` (3 preceding siblings ...)
2020-07-14 8:48 ` [PATCH 5/9] usb: gadget: bdc: add identifier name for function declaraion Chunfeng Yun
@ 2020-07-14 8:48 ` Chunfeng Yun
2020-07-14 8:48 ` [PATCH 7/9] usb: gadget: bdc: avoid precedence issues Chunfeng Yun
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Chunfeng Yun @ 2020-07-14 8:48 UTC (permalink / raw)
To: Felipe Balbi, Florian Fainelli
Cc: Greg Kroah-Hartman, Matthias Brugger, YueHaibing, Stephen Boyd,
Chunfeng Yun, linux-usb, linux-kernel, linux-arm-kernel,
linux-mediatek
fix the warning:
WARNING:BLOCK_COMMENT_STYLE:
Block comments should align the * on each line
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/gadget/udc/bdc/bdc.h | 2 +-
drivers/usb/gadget/udc/bdc/bdc_ep.c | 2 +-
drivers/usb/gadget/udc/bdc/bdc_udc.c | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/gadget/udc/bdc/bdc.h b/drivers/usb/gadget/udc/bdc/bdc.h
index 9615438..6940934 100644
--- a/drivers/usb/gadget/udc/bdc/bdc.h
+++ b/drivers/usb/gadget/udc/bdc/bdc.h
@@ -35,7 +35,7 @@
/*
* Maximum size of ep0 response buffer for ch9 requests,
* the set_sel request uses 6 so far, the max.
-*/
+ */
#define EP0_RESPONSE_BUFF 6
/* Start with SS as default */
#define EP0_MAX_PKT_SIZE 512
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index 0c44002..eea66d5 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -68,7 +68,7 @@ static void ep_bd_list_free(struct bdc_ep *ep, u32 num_tabs)
* check if the bd_table struct is allocated ?
* if yes, then check if bd memory has been allocated, then
* free the dma_pool and also the bd_table struct memory
- */
+ */
bd_table = bd_list->bd_table_array[index];
dev_dbg(bdc->dev, "bd_table:%p index:%d\n", bd_table, index);
if (!bd_table) {
diff --git a/drivers/usb/gadget/udc/bdc/bdc_udc.c b/drivers/usb/gadget/udc/bdc/bdc_udc.c
index 15652c5..ba9365e 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_udc.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_udc.c
@@ -164,7 +164,7 @@ static void bdc_func_wake_timer(struct work_struct *work)
/*
* Check if host has started transferring on endpoints
* FUNC_WAKE_ISSUED is cleared when transfer has started after resume
- */
+ */
if (bdc->devstatus & FUNC_WAKE_ISSUED) {
dev_dbg(bdc->dev, "FUNC_WAKE_ISSUED FLAG IS STILL SET\n");
/* flag is still set, so again send func wake */
@@ -205,7 +205,7 @@ static void handle_link_state_change(struct bdc *bdc, u32 uspc)
* if not then send function wake again every
* TNotification secs until host initiates
* transfer to BDC, USB3 spec Table 8.13
- */
+ */
schedule_delayed_work(
&bdc->func_wake_notify,
msecs_to_jiffies(BDC_TNOTIFY));
@@ -379,7 +379,7 @@ static int bdc_udc_start(struct usb_gadget *gadget,
* Run the controller from here and when BDC is connected to
* Host then driver will receive a USPC SR with VBUS present
* and then driver will do a softconnect.
- */
+ */
ret = bdc_run(bdc);
if (ret) {
dev_err(bdc->dev, "%s bdc run fail\n", __func__);
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 7/9] usb: gadget: bdc: avoid precedence issues
2020-07-14 8:48 [PATCH 1/9] usb: gadget: bdc: fix code check warning or error caused by spacing Chunfeng Yun
` (4 preceding siblings ...)
2020-07-14 8:48 ` [PATCH 6/9] usb: gadget: bdc: fix check warning of block comments alignment Chunfeng Yun
@ 2020-07-14 8:48 ` Chunfeng Yun
2020-07-14 8:48 ` [PATCH 8/9] usb: gadget: bdc: use the BIT macro to define bit filed Chunfeng Yun
2020-07-14 8:48 ` [PATCH 9/9] usb: gadget: bdc: prefer pointer dereference to pointer type Chunfeng Yun
7 siblings, 0 replies; 9+ messages in thread
From: Chunfeng Yun @ 2020-07-14 8:48 UTC (permalink / raw)
To: Felipe Balbi, Florian Fainelli
Cc: Greg Kroah-Hartman, Matthias Brugger, YueHaibing, Stephen Boyd,
Chunfeng Yun, linux-usb, linux-kernel, linux-arm-kernel,
linux-mediatek
Add () around macro argument to avoid precedence issues
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/gadget/udc/bdc/bdc.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/gadget/udc/bdc/bdc.h b/drivers/usb/gadget/udc/bdc/bdc.h
index 6940934..7b14af1 100644
--- a/drivers/usb/gadget/udc/bdc/bdc.h
+++ b/drivers/usb/gadget/udc/bdc/bdc.h
@@ -86,20 +86,20 @@
#define BDC_EPSTS5 0x74
#define BDC_EPSTS6 0x78
#define BDC_EPSTS7 0x7c
-#define BDC_SRRBAL(n) (0x200 + (n * 0x10))
-#define BDC_SRRBAH(n) (0x204 + (n * 0x10))
-#define BDC_SRRINT(n) (0x208 + (n * 0x10))
-#define BDC_INTCTLS(n) (0x20c + (n * 0x10))
+#define BDC_SRRBAL(n) (0x200 + ((n) * 0x10))
+#define BDC_SRRBAH(n) (0x204 + ((n) * 0x10))
+#define BDC_SRRINT(n) (0x208 + ((n) * 0x10))
+#define BDC_INTCTLS(n) (0x20c + ((n) * 0x10))
/* Extended capability regs */
#define BDC_FSCNOC 0xcd4
#define BDC_FSCNIC 0xce4
-#define NUM_NCS(p) (p >> 28)
+#define NUM_NCS(p) ((p) >> 28)
/* Register bit fields and Masks */
/* BDC Configuration 0 */
#define BDC_PGS(p) (((p) & (0x7 << 8)) >> 8)
-#define BDC_SPB(p) (p & 0x7)
+#define BDC_SPB(p) ((p) & 0x7)
/* BDC Capability1 */
#define BDC_P64 (1 << 0)
@@ -113,7 +113,7 @@
#define BDC_CMD_DVC 0x1
#define BDC_CMD_CWS (0x1 << 5)
#define BDC_CMD_CST(p) (((p) & (0xf << 6)) >> 6)
-#define BDC_CMD_EPN(p) ((p & 0x1f) << 10)
+#define BDC_CMD_EPN(p) (((p) & 0x1f) << 10)
#define BDC_SUB_CMD_ADD (0x1 << 17)
#define BDC_SUB_CMD_FWK (0x4 << 17)
/* Reset sequence number */
@@ -163,7 +163,7 @@
#define BDC_SPEED_HS 0x3
#define BDC_SPEED_SS 0x4
-#define BDC_PST(p) (p & 0xf)
+#define BDC_PST(p) ((p) & 0xf)
#define BDC_PST_MASK 0xf
/* USPPMS */
@@ -228,7 +228,7 @@
/* status report defines */
#define SR_XSF 0
#define SR_USPC 4
-#define SR_BD_LEN(p) (p & 0xffffff)
+#define SR_BD_LEN(p) ((p) & 0xffffff)
#define XSF_SUCC 0x1
#define XSF_SHORT 0x3
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 8/9] usb: gadget: bdc: use the BIT macro to define bit filed
2020-07-14 8:48 [PATCH 1/9] usb: gadget: bdc: fix code check warning or error caused by spacing Chunfeng Yun
` (5 preceding siblings ...)
2020-07-14 8:48 ` [PATCH 7/9] usb: gadget: bdc: avoid precedence issues Chunfeng Yun
@ 2020-07-14 8:48 ` Chunfeng Yun
2020-07-14 8:48 ` [PATCH 9/9] usb: gadget: bdc: prefer pointer dereference to pointer type Chunfeng Yun
7 siblings, 0 replies; 9+ messages in thread
From: Chunfeng Yun @ 2020-07-14 8:48 UTC (permalink / raw)
To: Felipe Balbi, Florian Fainelli
Cc: Greg Kroah-Hartman, Matthias Brugger, YueHaibing, Stephen Boyd,
Chunfeng Yun, linux-usb, linux-kernel, linux-arm-kernel,
linux-mediatek
Prefer using the BIT macro to define bit fileds
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/gadget/udc/bdc/bdc.h | 84 ++++++++++++++++++++--------------------
1 file changed, 42 insertions(+), 42 deletions(-)
diff --git a/drivers/usb/gadget/udc/bdc/bdc.h b/drivers/usb/gadget/udc/bdc/bdc.h
index 7b14af1..de850ce 100644
--- a/drivers/usb/gadget/udc/bdc/bdc.h
+++ b/drivers/usb/gadget/udc/bdc/bdc.h
@@ -102,7 +102,7 @@
#define BDC_SPB(p) ((p) & 0x7)
/* BDC Capability1 */
-#define BDC_P64 (1 << 0)
+#define BDC_P64 BIT(0)
/* BDC Command register */
#define BDC_CMD_FH 0xe
@@ -111,7 +111,7 @@
#define BDC_CMD_BLA 0x3
#define BDC_CMD_EPC 0x2
#define BDC_CMD_DVC 0x1
-#define BDC_CMD_CWS (0x1 << 5)
+#define BDC_CMD_CWS BIT(5)
#define BDC_CMD_CST(p) (((p) & (0xf << 6)) >> 6)
#define BDC_CMD_EPN(p) (((p) & 0x1f) << 10)
#define BDC_SUB_CMD_ADD (0x1 << 17)
@@ -124,7 +124,7 @@
#define BDC_SUB_CMD_EP_STP (0x2 << 17)
#define BDC_SUB_CMD_EP_STL (0x4 << 17)
#define BDC_SUB_CMD_EP_RST (0x1 << 17)
-#define BDC_CMD_SRD (1 << 27)
+#define BDC_CMD_SRD BIT(27)
/* CMD completion status */
#define BDC_CMDS_SUCC 0x1
@@ -141,19 +141,19 @@
#define EPM_SHIFT 4
/* BDC USPSC */
-#define BDC_VBC (1 << 31)
-#define BDC_PRC (1 << 30)
-#define BDC_PCE (1 << 29)
-#define BDC_CFC (1 << 28)
-#define BDC_PCC (1 << 27)
-#define BDC_PSC (1 << 26)
-#define BDC_VBS (1 << 25)
-#define BDC_PRS (1 << 24)
-#define BDC_PCS (1 << 23)
+#define BDC_VBC BIT(31)
+#define BDC_PRC BIT(30)
+#define BDC_PCE BIT(29)
+#define BDC_CFC BIT(28)
+#define BDC_PCC BIT(27)
+#define BDC_PSC BIT(26)
+#define BDC_VBS BIT(25)
+#define BDC_PRS BIT(24)
+#define BDC_PCS BIT(23)
#define BDC_PSP(p) (((p) & (0x7 << 20)) >> 20)
-#define BDC_SCN (1 << 8)
-#define BDC_SDC (1 << 7)
-#define BDC_SWS (1 << 4)
+#define BDC_SCN BIT(8)
+#define BDC_SDC BIT(7)
+#define BDC_SWS BIT(4)
#define BDC_USPSC_RW (BDC_SCN | BDC_SDC | BDC_SWS | 0xf)
#define BDC_PSP(p) (((p) & (0x7 << 20)) >> 20)
@@ -167,17 +167,17 @@
#define BDC_PST_MASK 0xf
/* USPPMS */
-#define BDC_U2E (0x1 << 31)
-#define BDC_U1E (0x1 << 30)
-#define BDC_U2A (0x1 << 29)
-#define BDC_PORT_W1S (0x1 << 17)
+#define BDC_U2E BIT(31)
+#define BDC_U1E BIT(30)
+#define BDC_U2A BIT(29)
+#define BDC_PORT_W1S BIT(17)
#define BDC_U1T(p) ((p) & 0xff)
#define BDC_U2T(p) (((p) & 0xff) << 8)
#define BDC_U1T_MASK 0xff
/* USBPM2 */
/* Hardware LPM Enable */
-#define BDC_HLE (1 << 16)
+#define BDC_HLE BIT(16)
/* BDC Status and Control */
#define BDC_COP_RST (1 << 29)
@@ -186,11 +186,11 @@
#define BDC_COP_MASK (BDC_COP_RST | BDC_COP_RUN | BDC_COP_STP)
-#define BDC_COS (1 << 28)
+#define BDC_COS BIT(28)
#define BDC_CSTS(p) (((p) & (0x7 << 20)) >> 20)
-#define BDC_MASK_MCW (1 << 7)
-#define BDC_GIE (1 << 1)
-#define BDC_GIP (1 << 0)
+#define BDC_MASK_MCW BIT(7)
+#define BDC_GIE BIT(1)
+#define BDC_GIP BIT(0)
#define BDC_HLT 1
#define BDC_NOR 2
@@ -201,19 +201,19 @@
#define BD_CHAIN 0xf
#define BD_TFS_SHIFT 4
-#define BD_SOT (1 << 26)
-#define BD_EOT (1 << 27)
-#define BD_ISP (1 << 29)
-#define BD_IOC (1 << 30)
-#define BD_SBF (1 << 31)
+#define BD_SOT BIT(26)
+#define BD_EOT BIT(27)
+#define BD_ISP BIT(29)
+#define BD_IOC BIT(30)
+#define BD_SBF BIT(31)
#define BD_INTR_TARGET(p) (((p) & 0x1f) << 27)
-#define BDC_SRR_RWS (1 << 4)
-#define BDC_SRR_RST (1 << 3)
-#define BDC_SRR_ISR (1 << 2)
-#define BDC_SRR_IE (1 << 1)
-#define BDC_SRR_IP (1 << 0)
+#define BDC_SRR_RWS BIT(4)
+#define BDC_SRR_RST BIT(3)
+#define BDC_SRR_ISR BIT(2)
+#define BDC_SRR_IE BIT(1)
+#define BDC_SRR_IP BIT(0)
#define BDC_SRR_EPI(p) (((p) & (0xff << 24)) >> 24)
#define BDC_SRR_DPI(p) (((p) & (0xff << 16)) >> 16)
#define BDC_SRR_DPI_MASK 0x00ff0000
@@ -221,7 +221,7 @@
#define MARK_CHAIN_BD (BD_CHAIN | BD_EOT | BD_SOT)
/* Control transfer BD specific fields */
-#define BD_DIR_IN (1 << 25)
+#define BD_DIR_IN BIT(25)
#define BDC_PTC_MASK 0xf0000000
@@ -241,13 +241,13 @@
/* Transfer BD fields */
#define BD_LEN(p) ((p) & 0x1ffff)
-#define BD_LTF (1 << 25)
+#define BD_LTF BIT(25)
#define BD_TYPE_DS 0x1
#define BD_TYPE_SS 0x2
-#define BDC_EP_ENABLED (1 << 0)
-#define BDC_EP_STALL (1 << 1)
-#define BDC_EP_STOP (1 << 2)
+#define BDC_EP_ENABLED BIT(0)
+#define BDC_EP_STALL BIT(1)
+#define BDC_EP_STOP BIT(2)
/* One BD can transfer max 65536 bytes */
#define BD_MAX_BUFF_SIZE (1 << 16)
@@ -266,9 +266,9 @@
/* FUNCTION WAKE DEV NOTIFICATION interval, USB3 spec table 8.13 */
#define BDC_TNOTIFY 2500 /*in ms*/
/* Devstatus bitfields */
-#define REMOTE_WAKEUP_ISSUED (1 << 16)
-#define DEVICE_SUSPENDED (1 << 17)
-#define FUNC_WAKE_ISSUED (1 << 18)
+#define REMOTE_WAKEUP_ISSUED BIT(16)
+#define DEVICE_SUSPENDED BIT(17)
+#define FUNC_WAKE_ISSUED BIT(18)
#define REMOTE_WAKE_ENABLE (1 << USB_DEVICE_REMOTE_WAKEUP)
/* On disconnect, preserve these bits and clear rest */
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 9/9] usb: gadget: bdc: prefer pointer dereference to pointer type
2020-07-14 8:48 [PATCH 1/9] usb: gadget: bdc: fix code check warning or error caused by spacing Chunfeng Yun
` (6 preceding siblings ...)
2020-07-14 8:48 ` [PATCH 8/9] usb: gadget: bdc: use the BIT macro to define bit filed Chunfeng Yun
@ 2020-07-14 8:48 ` Chunfeng Yun
7 siblings, 0 replies; 9+ messages in thread
From: Chunfeng Yun @ 2020-07-14 8:48 UTC (permalink / raw)
To: Felipe Balbi, Florian Fainelli
Cc: Greg Kroah-Hartman, Matthias Brugger, YueHaibing, Stephen Boyd,
Chunfeng Yun, linux-usb, linux-kernel, linux-arm-kernel,
linux-mediatek
Prefer kzalloc(sizeof(*bd_table)...) over
kzalloc(sizeof(struct bd_table)
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/gadget/udc/bdc/bdc_ep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index eea66d5..d1ace77 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -147,7 +147,7 @@ static int ep_bd_list_alloc(struct bdc_ep *ep)
/* Allocate memory for each table */
for (index = 0; index < num_tabs; index++) {
/* Allocate memory for bd_table structure */
- bd_table = kzalloc(sizeof(struct bd_table), GFP_ATOMIC);
+ bd_table = kzalloc(sizeof(*bd_table), GFP_ATOMIC);
if (!bd_table)
goto fail;
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-07-14 8:51 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 8:48 [PATCH 1/9] usb: gadget: bdc: fix code check warning or error caused by spacing Chunfeng Yun
2020-07-14 8:48 ` [PATCH 2/9] usb: gadget: bdc: fix warning of embedded function name Chunfeng Yun
2020-07-14 8:48 ` [PATCH 3/9] usb: gadget: bdc: fix improper SPDX comment style for header file Chunfeng Yun
2020-07-14 8:48 ` [PATCH 4/9] usb: gadget: bdc: remove bdc_ep_set_halt() declaration Chunfeng Yun
2020-07-14 8:48 ` [PATCH 5/9] usb: gadget: bdc: add identifier name for function declaraion Chunfeng Yun
2020-07-14 8:48 ` [PATCH 6/9] usb: gadget: bdc: fix check warning of block comments alignment Chunfeng Yun
2020-07-14 8:48 ` [PATCH 7/9] usb: gadget: bdc: avoid precedence issues Chunfeng Yun
2020-07-14 8:48 ` [PATCH 8/9] usb: gadget: bdc: use the BIT macro to define bit filed Chunfeng Yun
2020-07-14 8:48 ` [PATCH 9/9] usb: gadget: bdc: prefer pointer dereference to pointer type Chunfeng Yun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).