All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ikjoon Jang <ikjn@chromium.org>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	<linux-usb@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Nicolas Boichat <drinkcat@chromium.org>,
	Eddie Hung <eddie.hung@mediatek.com>
Subject: [PATCH 06/17] usb: xhci-mtk: add a function to (un)load bandwidth info
Date: Fri, 5 Mar 2021 17:02:44 +0800	[thread overview]
Message-ID: <1614934975-15188-6-git-send-email-chunfeng.yun@mediatek.com> (raw)
In-Reply-To: <1614934975-15188-1-git-send-email-chunfeng.yun@mediatek.com>

Extract a function to load/unload bandwidth info, and remove
a dummy check of TT offset.

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

diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
index 9016188eee97..bef82c1f909d 100644
--- a/drivers/usb/host/xhci-mtk-sch.c
+++ b/drivers/usb/host/xhci-mtk-sch.c
@@ -375,7 +375,6 @@ static void update_bus_bw(struct mu3h_sch_bw_info *sch_bw,
 					sch_ep->bw_budget_table[j];
 		}
 	}
-	sch_ep->allocated = used;
 }
 
 static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset)
@@ -509,6 +508,19 @@ static void update_sch_tt(struct usb_device *udev,
 		list_del(&sch_ep->tt_endpoint);
 }
 
+static int load_ep_bw(struct usb_device *udev, struct mu3h_sch_bw_info *sch_bw,
+		      struct mu3h_sch_ep_info *sch_ep, bool loaded)
+{
+	if (sch_ep->sch_tt)
+		update_sch_tt(udev, sch_ep, loaded);
+
+	/* update bus bandwidth info */
+	update_bus_bw(sch_bw, sch_ep, loaded);
+	sch_ep->allocated = loaded;
+
+	return 0;
+}
+
 static u32 get_esit_boundary(struct mu3h_sch_ep_info *sch_ep)
 {
 	u32 boundary = sch_ep->esit;
@@ -535,7 +547,6 @@ static int check_sch_bw(struct usb_device *udev,
 	u32 esit_boundary;
 	u32 min_num_budget;
 	u32 min_cs_count;
-	bool tt_offset_ok = false;
 	int ret;
 
 	/*
@@ -552,8 +563,6 @@ static int check_sch_bw(struct usb_device *udev,
 			ret = check_sch_tt(udev, sch_ep, offset);
 			if (ret)
 				continue;
-			else
-				tt_offset_ok = true;
 		}
 
 		if ((offset + sch_ep->num_budget_microframes) > esit_boundary)
@@ -585,29 +594,15 @@ static int check_sch_bw(struct usb_device *udev,
 	sch_ep->cs_count = min_cs_count;
 	sch_ep->num_budget_microframes = min_num_budget;
 
-	if (sch_ep->sch_tt) {
-		/* all offset for tt is not ok*/
-		if (!tt_offset_ok)
-			return -ERANGE;
-
-		update_sch_tt(udev, sch_ep, 1);
-	}
-
-	/* update bus bandwidth info */
-	update_bus_bw(sch_bw, sch_ep, 1);
-
-	return 0;
+	return load_ep_bw(udev, sch_bw, sch_ep, true);
 }
 
 static void destroy_sch_ep(struct usb_device *udev,
 	struct mu3h_sch_bw_info *sch_bw, struct mu3h_sch_ep_info *sch_ep)
 {
 	/* only release ep bw check passed by check_sch_bw() */
-	if (sch_ep->allocated) {
-		update_bus_bw(sch_bw, sch_ep, 0);
-		if (sch_ep->sch_tt)
-			update_sch_tt(udev, sch_ep, 0);
-	}
+	if (sch_ep->allocated)
+		load_ep_bw(udev, sch_bw, sch_ep, false);
 
 	if (sch_ep->sch_tt)
 		drop_tt(udev);
-- 
2.18.0


WARNING: multiple messages have this Message-ID (diff)
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ikjoon Jang <ikjn@chromium.org>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	<linux-usb@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	 <linux-kernel@vger.kernel.org>,
	Nicolas Boichat <drinkcat@chromium.org>,
	Eddie Hung <eddie.hung@mediatek.com>
Subject: [PATCH 06/17] usb: xhci-mtk: add a function to (un)load bandwidth info
Date: Fri, 5 Mar 2021 17:02:44 +0800	[thread overview]
Message-ID: <1614934975-15188-6-git-send-email-chunfeng.yun@mediatek.com> (raw)
In-Reply-To: <1614934975-15188-1-git-send-email-chunfeng.yun@mediatek.com>

Extract a function to load/unload bandwidth info, and remove
a dummy check of TT offset.

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

diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
index 9016188eee97..bef82c1f909d 100644
--- a/drivers/usb/host/xhci-mtk-sch.c
+++ b/drivers/usb/host/xhci-mtk-sch.c
@@ -375,7 +375,6 @@ static void update_bus_bw(struct mu3h_sch_bw_info *sch_bw,
 					sch_ep->bw_budget_table[j];
 		}
 	}
-	sch_ep->allocated = used;
 }
 
 static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset)
@@ -509,6 +508,19 @@ static void update_sch_tt(struct usb_device *udev,
 		list_del(&sch_ep->tt_endpoint);
 }
 
+static int load_ep_bw(struct usb_device *udev, struct mu3h_sch_bw_info *sch_bw,
+		      struct mu3h_sch_ep_info *sch_ep, bool loaded)
+{
+	if (sch_ep->sch_tt)
+		update_sch_tt(udev, sch_ep, loaded);
+
+	/* update bus bandwidth info */
+	update_bus_bw(sch_bw, sch_ep, loaded);
+	sch_ep->allocated = loaded;
+
+	return 0;
+}
+
 static u32 get_esit_boundary(struct mu3h_sch_ep_info *sch_ep)
 {
 	u32 boundary = sch_ep->esit;
@@ -535,7 +547,6 @@ static int check_sch_bw(struct usb_device *udev,
 	u32 esit_boundary;
 	u32 min_num_budget;
 	u32 min_cs_count;
-	bool tt_offset_ok = false;
 	int ret;
 
 	/*
@@ -552,8 +563,6 @@ static int check_sch_bw(struct usb_device *udev,
 			ret = check_sch_tt(udev, sch_ep, offset);
 			if (ret)
 				continue;
-			else
-				tt_offset_ok = true;
 		}
 
 		if ((offset + sch_ep->num_budget_microframes) > esit_boundary)
@@ -585,29 +594,15 @@ static int check_sch_bw(struct usb_device *udev,
 	sch_ep->cs_count = min_cs_count;
 	sch_ep->num_budget_microframes = min_num_budget;
 
-	if (sch_ep->sch_tt) {
-		/* all offset for tt is not ok*/
-		if (!tt_offset_ok)
-			return -ERANGE;
-
-		update_sch_tt(udev, sch_ep, 1);
-	}
-
-	/* update bus bandwidth info */
-	update_bus_bw(sch_bw, sch_ep, 1);
-
-	return 0;
+	return load_ep_bw(udev, sch_bw, sch_ep, true);
 }
 
 static void destroy_sch_ep(struct usb_device *udev,
 	struct mu3h_sch_bw_info *sch_bw, struct mu3h_sch_ep_info *sch_ep)
 {
 	/* only release ep bw check passed by check_sch_bw() */
-	if (sch_ep->allocated) {
-		update_bus_bw(sch_bw, sch_ep, 0);
-		if (sch_ep->sch_tt)
-			update_sch_tt(udev, sch_ep, 0);
-	}
+	if (sch_ep->allocated)
+		load_ep_bw(udev, sch_bw, sch_ep, false);
 
 	if (sch_ep->sch_tt)
 		drop_tt(udev);
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ikjoon Jang <ikjn@chromium.org>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	<linux-usb@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	 <linux-kernel@vger.kernel.org>,
	Nicolas Boichat <drinkcat@chromium.org>,
	Eddie Hung <eddie.hung@mediatek.com>
Subject: [PATCH 06/17] usb: xhci-mtk: add a function to (un)load bandwidth info
Date: Fri, 5 Mar 2021 17:02:44 +0800	[thread overview]
Message-ID: <1614934975-15188-6-git-send-email-chunfeng.yun@mediatek.com> (raw)
In-Reply-To: <1614934975-15188-1-git-send-email-chunfeng.yun@mediatek.com>

Extract a function to load/unload bandwidth info, and remove
a dummy check of TT offset.

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

diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
index 9016188eee97..bef82c1f909d 100644
--- a/drivers/usb/host/xhci-mtk-sch.c
+++ b/drivers/usb/host/xhci-mtk-sch.c
@@ -375,7 +375,6 @@ static void update_bus_bw(struct mu3h_sch_bw_info *sch_bw,
 					sch_ep->bw_budget_table[j];
 		}
 	}
-	sch_ep->allocated = used;
 }
 
 static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset)
@@ -509,6 +508,19 @@ static void update_sch_tt(struct usb_device *udev,
 		list_del(&sch_ep->tt_endpoint);
 }
 
+static int load_ep_bw(struct usb_device *udev, struct mu3h_sch_bw_info *sch_bw,
+		      struct mu3h_sch_ep_info *sch_ep, bool loaded)
+{
+	if (sch_ep->sch_tt)
+		update_sch_tt(udev, sch_ep, loaded);
+
+	/* update bus bandwidth info */
+	update_bus_bw(sch_bw, sch_ep, loaded);
+	sch_ep->allocated = loaded;
+
+	return 0;
+}
+
 static u32 get_esit_boundary(struct mu3h_sch_ep_info *sch_ep)
 {
 	u32 boundary = sch_ep->esit;
@@ -535,7 +547,6 @@ static int check_sch_bw(struct usb_device *udev,
 	u32 esit_boundary;
 	u32 min_num_budget;
 	u32 min_cs_count;
-	bool tt_offset_ok = false;
 	int ret;
 
 	/*
@@ -552,8 +563,6 @@ static int check_sch_bw(struct usb_device *udev,
 			ret = check_sch_tt(udev, sch_ep, offset);
 			if (ret)
 				continue;
-			else
-				tt_offset_ok = true;
 		}
 
 		if ((offset + sch_ep->num_budget_microframes) > esit_boundary)
@@ -585,29 +594,15 @@ static int check_sch_bw(struct usb_device *udev,
 	sch_ep->cs_count = min_cs_count;
 	sch_ep->num_budget_microframes = min_num_budget;
 
-	if (sch_ep->sch_tt) {
-		/* all offset for tt is not ok*/
-		if (!tt_offset_ok)
-			return -ERANGE;
-
-		update_sch_tt(udev, sch_ep, 1);
-	}
-
-	/* update bus bandwidth info */
-	update_bus_bw(sch_bw, sch_ep, 1);
-
-	return 0;
+	return load_ep_bw(udev, sch_bw, sch_ep, true);
 }
 
 static void destroy_sch_ep(struct usb_device *udev,
 	struct mu3h_sch_bw_info *sch_bw, struct mu3h_sch_ep_info *sch_ep)
 {
 	/* only release ep bw check passed by check_sch_bw() */
-	if (sch_ep->allocated) {
-		update_bus_bw(sch_bw, sch_ep, 0);
-		if (sch_ep->sch_tt)
-			update_sch_tt(udev, sch_ep, 0);
-	}
+	if (sch_ep->allocated)
+		load_ep_bw(udev, sch_bw, sch_ep, false);
 
 	if (sch_ep->sch_tt)
 		drop_tt(udev);
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-03-05  9:04 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05  9:02 [PATCH 01/17] usb: xhci-mtk: remove or operator for setting schedule parameters Chunfeng Yun
2021-03-05  9:02 ` Chunfeng Yun
2021-03-05  9:02 ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 02/17] usb: xhci-mtk: improve bandwidth scheduling with TT Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 03/17] usb: xhci-mtk: get the microframe boundary for ESIT Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:13   ` Sergei Shtylyov
2021-03-05  9:13     ` Sergei Shtylyov
2021-03-05  9:13     ` Sergei Shtylyov
2021-03-05  9:16     ` Greg Kroah-Hartman
2021-03-05  9:16       ` Greg Kroah-Hartman
2021-03-05  9:16       ` Greg Kroah-Hartman
2021-03-08  1:57     ` Chunfeng Yun
2021-03-08  1:57       ` Chunfeng Yun
2021-03-08  1:57       ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 04/17] usb: xhci-mtk: add only one extra CS for FS/LS INTR Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 05/17] usb: xhci-mtk: use @sch_tt to check whether need do TT schedule Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02 ` Chunfeng Yun [this message]
2021-03-05  9:02   ` [PATCH 06/17] usb: xhci-mtk: add a function to (un)load bandwidth info Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 07/17] usb: xhci-mtk: add a function to get bandwidth boundary Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 08/17] usb: xhci-mtk: remove unnecessary members of mu3h_sch_tt struct Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 09/17] usb: xhci-mtk: use clear type instead of void Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 10/17] usb: xhci-mtk: add a member @speed in mu3h_sch_ep_info struct Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 11/17] usb: xhci-mtk: use @tt_info to check the FS/LS device is under a HS hub Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 12/17] usb: xhci-mtk: rebuild the way to get bandwidth domain Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 13/17] usb: xhci-mtk: add some schedule error number Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 14/17] usb: xhci-mtk: remove declaration of xhci_mtk_setup() Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 15/17] usb: xhci-mtk: support to build xhci-mtk-hcd.ko Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-07 16:00   ` Greg Kroah-Hartman
2021-03-07 16:00     ` Greg Kroah-Hartman
2021-03-07 16:00     ` Greg Kroah-Hartman
2021-03-08 11:13     ` Mathias Nyman
2021-03-08 11:13       ` Mathias Nyman
2021-03-08 11:13       ` Mathias Nyman
2021-03-05  9:02 ` [PATCH 16/17] usb: common: add function to get interval expressed in us unit Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05 15:33   ` Alan Stern
2021-03-05 15:33     ` Alan Stern
2021-03-05 15:33     ` Alan Stern
2021-03-05 15:47     ` Greg Kroah-Hartman
2021-03-05 15:47       ` Greg Kroah-Hartman
2021-03-05 15:47       ` Greg Kroah-Hartman
2021-03-08  2:02       ` Chunfeng Yun
2021-03-08  2:02         ` Chunfeng Yun
2021-03-08  2:02         ` Chunfeng Yun
2021-03-08  1:58     ` Chunfeng Yun
2021-03-08  1:58       ` Chunfeng Yun
2021-03-08  1:58       ` Chunfeng Yun
2021-03-05  9:02 ` [PATCH 17/17] usb: xhci-mtk: print debug info of endpoint interval Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun
2021-03-05  9:02   ` Chunfeng Yun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1614934975-15188-6-git-send-email-chunfeng.yun@mediatek.com \
    --to=chunfeng.yun@mediatek.com \
    --cc=drinkcat@chromium.org \
    --cc=eddie.hung@mediatek.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ikjn@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=matthias.bgg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.