All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
@ 2021-05-06  6:31 ` Chunfeng Yun
  0 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-06  6:31 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

Use bitfield instead of bool in struct

Refer to coding-style.rst 17) Using bool:
"If a structure has many true/false values, consider consolidating
them into a bitfield with 1 bit members, or using an appropriate
fixed width type, such as u8."

Due to @has_ippc's default vaule is 0, no need set it again if fail
to get ippc base address

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: add more changelog suggested by Greg
---
 drivers/usb/host/xhci-mtk.c | 2 --
 drivers/usb/host/xhci-mtk.h | 8 ++++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index b2058b3bc834..2548976bcf05 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -495,8 +495,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
 			goto put_usb2_hcd;
 		}
 		mtk->has_ippc = true;
-	} else {
-		mtk->has_ippc = false;
 	}
 
 	device_init_wakeup(dev, true);
diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
index cd3a37bb73e6..94a59b3d178f 100644
--- a/drivers/usb/host/xhci-mtk.h
+++ b/drivers/usb/host/xhci-mtk.h
@@ -138,17 +138,17 @@ struct xhci_hcd_mtk {
 	struct mu3h_sch_bw_info *sch_array;
 	struct list_head bw_ep_chk_list;
 	struct mu3c_ippc_regs __iomem *ippc_regs;
-	bool has_ippc;
 	int num_u2_ports;
 	int num_u3_ports;
 	int u3p_dis_msk;
 	struct regulator *vusb33;
 	struct regulator *vbus;
 	struct clk_bulk_data clks[BULK_CLKS_NUM];
-	bool lpm_support;
-	bool u2_lpm_disable;
+	unsigned int has_ippc:1;
+	unsigned int lpm_support:1;
+	unsigned int u2_lpm_disable:1;
 	/* usb remote wakeup */
-	bool uwk_en;
+	unsigned int uwk_en:1;
 	struct regmap *uwk;
 	u32 uwk_reg_base;
 	u32 uwk_vers;
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
@ 2021-05-06  6:31 ` Chunfeng Yun
  0 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-06  6:31 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

Use bitfield instead of bool in struct

Refer to coding-style.rst 17) Using bool:
"If a structure has many true/false values, consider consolidating
them into a bitfield with 1 bit members, or using an appropriate
fixed width type, such as u8."

Due to @has_ippc's default vaule is 0, no need set it again if fail
to get ippc base address

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: add more changelog suggested by Greg
---
 drivers/usb/host/xhci-mtk.c | 2 --
 drivers/usb/host/xhci-mtk.h | 8 ++++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index b2058b3bc834..2548976bcf05 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -495,8 +495,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
 			goto put_usb2_hcd;
 		}
 		mtk->has_ippc = true;
-	} else {
-		mtk->has_ippc = false;
 	}
 
 	device_init_wakeup(dev, true);
diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
index cd3a37bb73e6..94a59b3d178f 100644
--- a/drivers/usb/host/xhci-mtk.h
+++ b/drivers/usb/host/xhci-mtk.h
@@ -138,17 +138,17 @@ struct xhci_hcd_mtk {
 	struct mu3h_sch_bw_info *sch_array;
 	struct list_head bw_ep_chk_list;
 	struct mu3c_ippc_regs __iomem *ippc_regs;
-	bool has_ippc;
 	int num_u2_ports;
 	int num_u3_ports;
 	int u3p_dis_msk;
 	struct regulator *vusb33;
 	struct regulator *vbus;
 	struct clk_bulk_data clks[BULK_CLKS_NUM];
-	bool lpm_support;
-	bool u2_lpm_disable;
+	unsigned int has_ippc:1;
+	unsigned int lpm_support:1;
+	unsigned int u2_lpm_disable:1;
 	/* usb remote wakeup */
-	bool uwk_en;
+	unsigned int uwk_en:1;
 	struct regmap *uwk;
 	u32 uwk_reg_base;
 	u32 uwk_vers;
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
@ 2021-05-06  6:31 ` Chunfeng Yun
  0 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-06  6:31 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

Use bitfield instead of bool in struct

Refer to coding-style.rst 17) Using bool:
"If a structure has many true/false values, consider consolidating
them into a bitfield with 1 bit members, or using an appropriate
fixed width type, such as u8."

Due to @has_ippc's default vaule is 0, no need set it again if fail
to get ippc base address

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: add more changelog suggested by Greg
---
 drivers/usb/host/xhci-mtk.c | 2 --
 drivers/usb/host/xhci-mtk.h | 8 ++++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index b2058b3bc834..2548976bcf05 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -495,8 +495,6 @@ static int xhci_mtk_probe(struct platform_device *pdev)
 			goto put_usb2_hcd;
 		}
 		mtk->has_ippc = true;
-	} else {
-		mtk->has_ippc = false;
 	}
 
 	device_init_wakeup(dev, true);
diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
index cd3a37bb73e6..94a59b3d178f 100644
--- a/drivers/usb/host/xhci-mtk.h
+++ b/drivers/usb/host/xhci-mtk.h
@@ -138,17 +138,17 @@ struct xhci_hcd_mtk {
 	struct mu3h_sch_bw_info *sch_array;
 	struct list_head bw_ep_chk_list;
 	struct mu3c_ippc_regs __iomem *ippc_regs;
-	bool has_ippc;
 	int num_u2_ports;
 	int num_u3_ports;
 	int u3p_dis_msk;
 	struct regulator *vusb33;
 	struct regulator *vbus;
 	struct clk_bulk_data clks[BULK_CLKS_NUM];
-	bool lpm_support;
-	bool u2_lpm_disable;
+	unsigned int has_ippc:1;
+	unsigned int lpm_support:1;
+	unsigned int u2_lpm_disable:1;
 	/* usb remote wakeup */
-	bool uwk_en;
+	unsigned int uwk_en:1;
 	struct regmap *uwk;
 	u32 uwk_reg_base;
 	u32 uwk_vers;
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 2/3] usb: xhci-mtk: remove unnecessary assignments in periodic TT scheduler
  2021-05-06  6:31 ` Chunfeng Yun
  (?)
@ 2021-05-06  6:31   ` Chunfeng Yun
  -1 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-06  6:31 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

From: Ikjoon Jang <ikjn@chromium.org>

Remove unnecessary variables in check_sch_bw().
No functional changes, just for better readability.

Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: no changes
---
 drivers/usb/host/xhci-mtk-sch.c | 37 +++++++++++++--------------------
 1 file changed, 14 insertions(+), 23 deletions(-)

diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
index 8b90da5a6ed1..9fb75085e40f 100644
--- a/drivers/usb/host/xhci-mtk-sch.c
+++ b/drivers/usb/host/xhci-mtk-sch.c
@@ -476,6 +476,9 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
 	u32 start_cs, last_cs;
 	int i;
 
+	if (!sch_ep->sch_tt)
+		return 0;
+
 	start_ss = offset % 8;
 
 	if (sch_ep->ep_type == ISOC_OUT_EP) {
@@ -603,54 +606,42 @@ static u32 get_esit_boundary(struct mu3h_sch_ep_info *sch_ep)
 static int check_sch_bw(struct mu3h_sch_bw_info *sch_bw,
 			struct mu3h_sch_ep_info *sch_ep)
 {
+	const u32 esit_boundary = get_esit_boundary(sch_ep);
+	const u32 bw_boundary = get_bw_boundary(sch_ep->speed);
 	u32 offset;
-	u32 min_bw;
-	u32 min_index;
 	u32 worst_bw;
-	u32 bw_boundary;
-	u32 esit_boundary;
-	u32 min_num_budget;
-	u32 min_cs_count;
+	u32 min_bw = ~0;
+	int min_index = -1;
 	int ret = 0;
 
 	/*
 	 * Search through all possible schedule microframes.
 	 * and find a microframe where its worst bandwidth is minimum.
 	 */
-	min_bw = ~0;
-	min_index = 0;
-	min_cs_count = sch_ep->cs_count;
-	min_num_budget = sch_ep->num_budget_microframes;
-	esit_boundary = get_esit_boundary(sch_ep);
 	for (offset = 0; offset < sch_ep->esit; offset++) {
-		if (sch_ep->sch_tt) {
-			ret = check_sch_tt(sch_ep, offset);
-			if (ret)
-				continue;
-		}
+		ret = check_sch_tt(sch_ep, offset);
+		if (ret)
+			continue;
 
 		if ((offset + sch_ep->num_budget_microframes) > esit_boundary)
 			break;
 
 		worst_bw = get_max_bw(sch_bw, sch_ep, offset);
+		if (worst_bw > bw_boundary)
+			continue;
+
 		if (min_bw > worst_bw) {
 			min_bw = worst_bw;
 			min_index = offset;
-			min_cs_count = sch_ep->cs_count;
-			min_num_budget = sch_ep->num_budget_microframes;
 		}
 		if (min_bw == 0)
 			break;
 	}
 
-	bw_boundary = get_bw_boundary(sch_ep->speed);
-	/* check bandwidth */
-	if (min_bw > bw_boundary)
+	if (min_index < 0)
 		return ret ? ret : -ESCH_BW_OVERFLOW;
 
 	sch_ep->offset = min_index;
-	sch_ep->cs_count = min_cs_count;
-	sch_ep->num_budget_microframes = min_num_budget;
 
 	return load_ep_bw(sch_bw, sch_ep, true);
 }
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 2/3] usb: xhci-mtk: remove unnecessary assignments in periodic TT scheduler
@ 2021-05-06  6:31   ` Chunfeng Yun
  0 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-06  6:31 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

From: Ikjoon Jang <ikjn@chromium.org>

Remove unnecessary variables in check_sch_bw().
No functional changes, just for better readability.

Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: no changes
---
 drivers/usb/host/xhci-mtk-sch.c | 37 +++++++++++++--------------------
 1 file changed, 14 insertions(+), 23 deletions(-)

diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
index 8b90da5a6ed1..9fb75085e40f 100644
--- a/drivers/usb/host/xhci-mtk-sch.c
+++ b/drivers/usb/host/xhci-mtk-sch.c
@@ -476,6 +476,9 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
 	u32 start_cs, last_cs;
 	int i;
 
+	if (!sch_ep->sch_tt)
+		return 0;
+
 	start_ss = offset % 8;
 
 	if (sch_ep->ep_type == ISOC_OUT_EP) {
@@ -603,54 +606,42 @@ static u32 get_esit_boundary(struct mu3h_sch_ep_info *sch_ep)
 static int check_sch_bw(struct mu3h_sch_bw_info *sch_bw,
 			struct mu3h_sch_ep_info *sch_ep)
 {
+	const u32 esit_boundary = get_esit_boundary(sch_ep);
+	const u32 bw_boundary = get_bw_boundary(sch_ep->speed);
 	u32 offset;
-	u32 min_bw;
-	u32 min_index;
 	u32 worst_bw;
-	u32 bw_boundary;
-	u32 esit_boundary;
-	u32 min_num_budget;
-	u32 min_cs_count;
+	u32 min_bw = ~0;
+	int min_index = -1;
 	int ret = 0;
 
 	/*
 	 * Search through all possible schedule microframes.
 	 * and find a microframe where its worst bandwidth is minimum.
 	 */
-	min_bw = ~0;
-	min_index = 0;
-	min_cs_count = sch_ep->cs_count;
-	min_num_budget = sch_ep->num_budget_microframes;
-	esit_boundary = get_esit_boundary(sch_ep);
 	for (offset = 0; offset < sch_ep->esit; offset++) {
-		if (sch_ep->sch_tt) {
-			ret = check_sch_tt(sch_ep, offset);
-			if (ret)
-				continue;
-		}
+		ret = check_sch_tt(sch_ep, offset);
+		if (ret)
+			continue;
 
 		if ((offset + sch_ep->num_budget_microframes) > esit_boundary)
 			break;
 
 		worst_bw = get_max_bw(sch_bw, sch_ep, offset);
+		if (worst_bw > bw_boundary)
+			continue;
+
 		if (min_bw > worst_bw) {
 			min_bw = worst_bw;
 			min_index = offset;
-			min_cs_count = sch_ep->cs_count;
-			min_num_budget = sch_ep->num_budget_microframes;
 		}
 		if (min_bw == 0)
 			break;
 	}
 
-	bw_boundary = get_bw_boundary(sch_ep->speed);
-	/* check bandwidth */
-	if (min_bw > bw_boundary)
+	if (min_index < 0)
 		return ret ? ret : -ESCH_BW_OVERFLOW;
 
 	sch_ep->offset = min_index;
-	sch_ep->cs_count = min_cs_count;
-	sch_ep->num_budget_microframes = min_num_budget;
 
 	return load_ep_bw(sch_bw, sch_ep, true);
 }
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 2/3] usb: xhci-mtk: remove unnecessary assignments in periodic TT scheduler
@ 2021-05-06  6:31   ` Chunfeng Yun
  0 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-06  6:31 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

From: Ikjoon Jang <ikjn@chromium.org>

Remove unnecessary variables in check_sch_bw().
No functional changes, just for better readability.

Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: no changes
---
 drivers/usb/host/xhci-mtk-sch.c | 37 +++++++++++++--------------------
 1 file changed, 14 insertions(+), 23 deletions(-)

diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
index 8b90da5a6ed1..9fb75085e40f 100644
--- a/drivers/usb/host/xhci-mtk-sch.c
+++ b/drivers/usb/host/xhci-mtk-sch.c
@@ -476,6 +476,9 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
 	u32 start_cs, last_cs;
 	int i;
 
+	if (!sch_ep->sch_tt)
+		return 0;
+
 	start_ss = offset % 8;
 
 	if (sch_ep->ep_type == ISOC_OUT_EP) {
@@ -603,54 +606,42 @@ static u32 get_esit_boundary(struct mu3h_sch_ep_info *sch_ep)
 static int check_sch_bw(struct mu3h_sch_bw_info *sch_bw,
 			struct mu3h_sch_ep_info *sch_ep)
 {
+	const u32 esit_boundary = get_esit_boundary(sch_ep);
+	const u32 bw_boundary = get_bw_boundary(sch_ep->speed);
 	u32 offset;
-	u32 min_bw;
-	u32 min_index;
 	u32 worst_bw;
-	u32 bw_boundary;
-	u32 esit_boundary;
-	u32 min_num_budget;
-	u32 min_cs_count;
+	u32 min_bw = ~0;
+	int min_index = -1;
 	int ret = 0;
 
 	/*
 	 * Search through all possible schedule microframes.
 	 * and find a microframe where its worst bandwidth is minimum.
 	 */
-	min_bw = ~0;
-	min_index = 0;
-	min_cs_count = sch_ep->cs_count;
-	min_num_budget = sch_ep->num_budget_microframes;
-	esit_boundary = get_esit_boundary(sch_ep);
 	for (offset = 0; offset < sch_ep->esit; offset++) {
-		if (sch_ep->sch_tt) {
-			ret = check_sch_tt(sch_ep, offset);
-			if (ret)
-				continue;
-		}
+		ret = check_sch_tt(sch_ep, offset);
+		if (ret)
+			continue;
 
 		if ((offset + sch_ep->num_budget_microframes) > esit_boundary)
 			break;
 
 		worst_bw = get_max_bw(sch_bw, sch_ep, offset);
+		if (worst_bw > bw_boundary)
+			continue;
+
 		if (min_bw > worst_bw) {
 			min_bw = worst_bw;
 			min_index = offset;
-			min_cs_count = sch_ep->cs_count;
-			min_num_budget = sch_ep->num_budget_microframes;
 		}
 		if (min_bw == 0)
 			break;
 	}
 
-	bw_boundary = get_bw_boundary(sch_ep->speed);
-	/* check bandwidth */
-	if (min_bw > bw_boundary)
+	if (min_index < 0)
 		return ret ? ret : -ESCH_BW_OVERFLOW;
 
 	sch_ep->offset = min_index;
-	sch_ep->cs_count = min_cs_count;
-	sch_ep->num_budget_microframes = min_num_budget;
 
 	return load_ep_bw(sch_bw, sch_ep, true);
 }
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 3/3] usb: xhci-mtk: use first-fit for LS/FS
  2021-05-06  6:31 ` Chunfeng Yun
  (?)
@ 2021-05-06  6:31   ` Chunfeng Yun
  -1 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-06  6:31 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

Use first-fit instead of best-fit for LS/FS devices under TT,
we found that best-fit will consume more bandwidth for some
cases.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: no changes
---
 drivers/usb/host/xhci-mtk-sch.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
index 9fb75085e40f..c07411d9b16f 100644
--- a/drivers/usb/host/xhci-mtk-sch.c
+++ b/drivers/usb/host/xhci-mtk-sch.c
@@ -634,6 +634,11 @@ static int check_sch_bw(struct mu3h_sch_bw_info *sch_bw,
 			min_bw = worst_bw;
 			min_index = offset;
 		}
+
+		/* use first-fit for LS/FS */
+		if (sch_ep->sch_tt && min_index >= 0)
+			break;
+
 		if (min_bw == 0)
 			break;
 	}
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 3/3] usb: xhci-mtk: use first-fit for LS/FS
@ 2021-05-06  6:31   ` Chunfeng Yun
  0 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-06  6:31 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

Use first-fit instead of best-fit for LS/FS devices under TT,
we found that best-fit will consume more bandwidth for some
cases.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: no changes
---
 drivers/usb/host/xhci-mtk-sch.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
index 9fb75085e40f..c07411d9b16f 100644
--- a/drivers/usb/host/xhci-mtk-sch.c
+++ b/drivers/usb/host/xhci-mtk-sch.c
@@ -634,6 +634,11 @@ static int check_sch_bw(struct mu3h_sch_bw_info *sch_bw,
 			min_bw = worst_bw;
 			min_index = offset;
 		}
+
+		/* use first-fit for LS/FS */
+		if (sch_ep->sch_tt && min_index >= 0)
+			break;
+
 		if (min_bw == 0)
 			break;
 	}
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 3/3] usb: xhci-mtk: use first-fit for LS/FS
@ 2021-05-06  6:31   ` Chunfeng Yun
  0 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-06  6:31 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

Use first-fit instead of best-fit for LS/FS devices under TT,
we found that best-fit will consume more bandwidth for some
cases.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: no changes
---
 drivers/usb/host/xhci-mtk-sch.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
index 9fb75085e40f..c07411d9b16f 100644
--- a/drivers/usb/host/xhci-mtk-sch.c
+++ b/drivers/usb/host/xhci-mtk-sch.c
@@ -634,6 +634,11 @@ static int check_sch_bw(struct mu3h_sch_bw_info *sch_bw,
 			min_bw = worst_bw;
 			min_index = offset;
 		}
+
+		/* use first-fit for LS/FS */
+		if (sch_ep->sch_tt && min_index >= 0)
+			break;
+
 		if (min_bw == 0)
 			break;
 	}
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
  2021-05-06  6:31 ` Chunfeng Yun
  (?)
@ 2021-05-06  7:37   ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-06  7:37 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: Mathias Nyman, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, linux-kernel, Ikjoon Jang, Eddie Hung

On Thu, May 06, 2021 at 02:31:14PM +0800, Chunfeng Yun wrote:
> Use bitfield instead of bool in struct
> 
> Refer to coding-style.rst 17) Using bool:
> "If a structure has many true/false values, consider consolidating
> them into a bitfield with 1 bit members, or using an appropriate
> fixed width type, such as u8."
> 
> Due to @has_ippc's default vaule is 0, no need set it again if fail
> to get ippc base address

Please split this change out into a separate patch, as it has nothing to
do with the "change to bitfield" change.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
@ 2021-05-06  7:37   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-06  7:37 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: Mathias Nyman, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, linux-kernel, Ikjoon Jang, Eddie Hung

On Thu, May 06, 2021 at 02:31:14PM +0800, Chunfeng Yun wrote:
> Use bitfield instead of bool in struct
> 
> Refer to coding-style.rst 17) Using bool:
> "If a structure has many true/false values, consider consolidating
> them into a bitfield with 1 bit members, or using an appropriate
> fixed width type, such as u8."
> 
> Due to @has_ippc's default vaule is 0, no need set it again if fail
> to get ippc base address

Please split this change out into a separate patch, as it has nothing to
do with the "change to bitfield" change.

thanks,

greg k-h

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
@ 2021-05-06  7:37   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-06  7:37 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: Mathias Nyman, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, linux-kernel, Ikjoon Jang, Eddie Hung

On Thu, May 06, 2021 at 02:31:14PM +0800, Chunfeng Yun wrote:
> Use bitfield instead of bool in struct
> 
> Refer to coding-style.rst 17) Using bool:
> "If a structure has many true/false values, consider consolidating
> them into a bitfield with 1 bit members, or using an appropriate
> fixed width type, such as u8."
> 
> Due to @has_ippc's default vaule is 0, no need set it again if fail
> to get ippc base address

Please split this change out into a separate patch, as it has nothing to
do with the "change to bitfield" change.

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
  2021-05-06  6:31 ` Chunfeng Yun
  (?)
@ 2021-05-06  8:50   ` Sergei Shtylyov
  -1 siblings, 0 replies; 21+ messages in thread
From: Sergei Shtylyov @ 2021-05-06  8:50 UTC (permalink / raw)
  To: Chunfeng Yun, Mathias Nyman
  Cc: Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

Hello!

On 06.05.2021 9:31, Chunfeng Yun wrote:

> Use bitfield instead of bool in struct
> 
> Refer to coding-style.rst 17) Using bool:
> "If a structure has many true/false values, consider consolidating
> them into a bitfield with 1 bit members, or using an appropriate
> fixed width type, such as u8."
> 
> Due to @has_ippc's default vaule is 0, no need set it again if fail

    Value. :-)

> to get ippc base address
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
@ 2021-05-06  8:50   ` Sergei Shtylyov
  0 siblings, 0 replies; 21+ messages in thread
From: Sergei Shtylyov @ 2021-05-06  8:50 UTC (permalink / raw)
  To: Chunfeng Yun, Mathias Nyman
  Cc: Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

Hello!

On 06.05.2021 9:31, Chunfeng Yun wrote:

> Use bitfield instead of bool in struct
> 
> Refer to coding-style.rst 17) Using bool:
> "If a structure has many true/false values, consider consolidating
> them into a bitfield with 1 bit members, or using an appropriate
> fixed width type, such as u8."
> 
> Due to @has_ippc's default vaule is 0, no need set it again if fail

    Value. :-)

> to get ippc base address
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
[...]

MBR, Sergei

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
@ 2021-05-06  8:50   ` Sergei Shtylyov
  0 siblings, 0 replies; 21+ messages in thread
From: Sergei Shtylyov @ 2021-05-06  8:50 UTC (permalink / raw)
  To: Chunfeng Yun, Mathias Nyman
  Cc: Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

Hello!

On 06.05.2021 9:31, Chunfeng Yun wrote:

> Use bitfield instead of bool in struct
> 
> Refer to coding-style.rst 17) Using bool:
> "If a structure has many true/false values, consider consolidating
> them into a bitfield with 1 bit members, or using an appropriate
> fixed width type, such as u8."
> 
> Due to @has_ippc's default vaule is 0, no need set it again if fail

    Value. :-)

> to get ippc base address
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
[...]

MBR, Sergei

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
  2021-05-06  7:37   ` Greg Kroah-Hartman
  (?)
@ 2021-05-07  1:27     ` Chunfeng Yun
  -1 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-07  1:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mathias Nyman, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, linux-kernel, Ikjoon Jang, Eddie Hung

On Thu, 2021-05-06 at 09:37 +0200, Greg Kroah-Hartman wrote:
> On Thu, May 06, 2021 at 02:31:14PM +0800, Chunfeng Yun wrote:
> > Use bitfield instead of bool in struct
> > 
> > Refer to coding-style.rst 17) Using bool:
> > "If a structure has many true/false values, consider consolidating
> > them into a bitfield with 1 bit members, or using an appropriate
> > fixed width type, such as u8."
> > 
> > Due to @has_ippc's default vaule is 0, no need set it again if fail
> > to get ippc base address
> 
> Please split this change out into a separate patch, as it has nothing to
> do with the "change to bitfield" change.
Ok, thanks

> 
> thanks,
> 
> greg k-h


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
@ 2021-05-07  1:27     ` Chunfeng Yun
  0 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-07  1:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mathias Nyman, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, linux-kernel, Ikjoon Jang, Eddie Hung

On Thu, 2021-05-06 at 09:37 +0200, Greg Kroah-Hartman wrote:
> On Thu, May 06, 2021 at 02:31:14PM +0800, Chunfeng Yun wrote:
> > Use bitfield instead of bool in struct
> > 
> > Refer to coding-style.rst 17) Using bool:
> > "If a structure has many true/false values, consider consolidating
> > them into a bitfield with 1 bit members, or using an appropriate
> > fixed width type, such as u8."
> > 
> > Due to @has_ippc's default vaule is 0, no need set it again if fail
> > to get ippc base address
> 
> Please split this change out into a separate patch, as it has nothing to
> do with the "change to bitfield" change.
Ok, thanks

> 
> thanks,
> 
> greg k-h

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
@ 2021-05-07  1:27     ` Chunfeng Yun
  0 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-07  1:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Mathias Nyman, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, linux-kernel, Ikjoon Jang, Eddie Hung

On Thu, 2021-05-06 at 09:37 +0200, Greg Kroah-Hartman wrote:
> On Thu, May 06, 2021 at 02:31:14PM +0800, Chunfeng Yun wrote:
> > Use bitfield instead of bool in struct
> > 
> > Refer to coding-style.rst 17) Using bool:
> > "If a structure has many true/false values, consider consolidating
> > them into a bitfield with 1 bit members, or using an appropriate
> > fixed width type, such as u8."
> > 
> > Due to @has_ippc's default vaule is 0, no need set it again if fail
> > to get ippc base address
> 
> Please split this change out into a separate patch, as it has nothing to
> do with the "change to bitfield" change.
Ok, thanks

> 
> thanks,
> 
> greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
  2021-05-06  8:50   ` Sergei Shtylyov
  (?)
@ 2021-05-07  1:28     ` Chunfeng Yun
  -1 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-07  1:28 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Mathias Nyman, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

On Thu, 2021-05-06 at 11:50 +0300, Sergei Shtylyov wrote:
> Hello!
> 
> On 06.05.2021 9:31, Chunfeng Yun wrote:
> 
> > Use bitfield instead of bool in struct
> > 
> > Refer to coding-style.rst 17) Using bool:
> > "If a structure has many true/false values, consider consolidating
> > them into a bitfield with 1 bit members, or using an appropriate
> > fixed width type, such as u8."
> > 
> > Due to @has_ippc's default vaule is 0, no need set it again if fail
> 
>     Value. :-)
Will fix it, thanks
> 
> > to get ippc base address
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> [...]
> 
> MBR, Sergei


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
@ 2021-05-07  1:28     ` Chunfeng Yun
  0 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-07  1:28 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Mathias Nyman, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

On Thu, 2021-05-06 at 11:50 +0300, Sergei Shtylyov wrote:
> Hello!
> 
> On 06.05.2021 9:31, Chunfeng Yun wrote:
> 
> > Use bitfield instead of bool in struct
> > 
> > Refer to coding-style.rst 17) Using bool:
> > "If a structure has many true/false values, consider consolidating
> > them into a bitfield with 1 bit members, or using an appropriate
> > fixed width type, such as u8."
> > 
> > Due to @has_ippc's default vaule is 0, no need set it again if fail
> 
>     Value. :-)
Will fix it, thanks
> 
> > to get ippc base address
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> [...]
> 
> MBR, Sergei

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool
@ 2021-05-07  1:28     ` Chunfeng Yun
  0 siblings, 0 replies; 21+ messages in thread
From: Chunfeng Yun @ 2021-05-07  1:28 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Mathias Nyman, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Ikjoon Jang,
	Eddie Hung

On Thu, 2021-05-06 at 11:50 +0300, Sergei Shtylyov wrote:
> Hello!
> 
> On 06.05.2021 9:31, Chunfeng Yun wrote:
> 
> > Use bitfield instead of bool in struct
> > 
> > Refer to coding-style.rst 17) Using bool:
> > "If a structure has many true/false values, consider consolidating
> > them into a bitfield with 1 bit members, or using an appropriate
> > fixed width type, such as u8."
> > 
> > Due to @has_ippc's default vaule is 0, no need set it again if fail
> 
>     Value. :-)
Will fix it, thanks
> 
> > to get ippc base address
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> [...]
> 
> MBR, Sergei

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-05-07  1:32 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06  6:31 [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool Chunfeng Yun
2021-05-06  6:31 ` Chunfeng Yun
2021-05-06  6:31 ` Chunfeng Yun
2021-05-06  6:31 ` [PATCH v2 2/3] usb: xhci-mtk: remove unnecessary assignments in periodic TT scheduler Chunfeng Yun
2021-05-06  6:31   ` Chunfeng Yun
2021-05-06  6:31   ` Chunfeng Yun
2021-05-06  6:31 ` [PATCH v2 3/3] usb: xhci-mtk: use first-fit for LS/FS Chunfeng Yun
2021-05-06  6:31   ` Chunfeng Yun
2021-05-06  6:31   ` Chunfeng Yun
2021-05-06  7:37 ` [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool Greg Kroah-Hartman
2021-05-06  7:37   ` Greg Kroah-Hartman
2021-05-06  7:37   ` Greg Kroah-Hartman
2021-05-07  1:27   ` Chunfeng Yun
2021-05-07  1:27     ` Chunfeng Yun
2021-05-07  1:27     ` Chunfeng Yun
2021-05-06  8:50 ` Sergei Shtylyov
2021-05-06  8:50   ` Sergei Shtylyov
2021-05-06  8:50   ` Sergei Shtylyov
2021-05-07  1:28   ` Chunfeng Yun
2021-05-07  1:28     ` Chunfeng Yun
2021-05-07  1:28     ` Chunfeng Yun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.