Skip to contentSkip to conversation

drivers: Change calls to mdelay to msleep in order to stop CPU busy looping in mdfld_dsi_pkg_sender.c

PATCH In review Nicholas Krause 2 participants 3 messages Nov 15, 2014 – Nov 17, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: Change calls to mdelay to msleep in order to stop CPU busy looping in mdfld_dsi_pkg_sender.c

Changes the calls of mdelay to msleep in the driver file mdfld_dsi_pkg_sender.c in order to prevent CPU busy looping in order to save CPU cycles as this is considered bad form over sleeping the CPU for high resolution timer function calls as this driver needs in order to function properly.

---
 drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c +5 -10
index 87885d8..77c656a 100644
@@ -335,13 +335,11 @@ static int send_pkg_prepare(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
 
 	/*wait for 120 milliseconds in case exit_sleep_mode just be sent*/
 	if (unlikely(cmd == DCS_ENTER_SLEEP_MODE)) {
-		/*TODO: replace it with msleep later*/
-		mdelay(120);
+		msleep(120);
 	}
 
 	if (unlikely(cmd == DCS_EXIT_SLEEP_MODE)) {
-		/*TODO: replace it with msleep later*/
-		mdelay(120);
+		msleep(120);
 	}
 	return 0;
 }
@@ -364,15 +362,12 @@ static int send_pkg_done(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
 	/*update panel status*/
 	if (unlikely(cmd == DCS_ENTER_SLEEP_MODE)) {
 		sender->panel_mode |= MDFLD_DSI_PANEL_MODE_SLEEP;
-		/*TODO: replace it with msleep later*/
-		mdelay(120);
+		msleep(120);
 	} else if (unlikely(cmd == DCS_EXIT_SLEEP_MODE)) {
 		sender->panel_mode &= ~MDFLD_DSI_PANEL_MODE_SLEEP;
-		/*TODO: replace it with msleep later*/
-		mdelay(120);
+		msleep(120);
 	} else if (unlikely(cmd == DCS_SOFT_RESET)) {
-		/*TODO: replace it with msleep later*/
-		mdelay(5);
+		msleep(5);
 	}
 
 	sender->status = MDFLD_DSI_PKG_SENDER_FREE;
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 4 lines · Nicholas Krause

Changes the calls of mdelay to msleep in the driver file mdfld_dsi_pkg_sender.c in order to prevent CPU busy looping in order to save CPU cycles as this is considered bad form over sleeping the CPU for high resolution timer function calls as this driver needs in order to function properly.

The code paths are called with sender->lock spinlock held.

BR,
Jani.

Quoted 52 lines
---
 drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c +5 -10
index 87885d8..77c656a 100644
@@ -335,13 +335,11 @@ static int send_pkg_prepare(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
 
 	/*wait for 120 milliseconds in case exit_sleep_mode just be sent*/
 	if (unlikely(cmd == DCS_ENTER_SLEEP_MODE)) {
-		/*TODO: replace it with msleep later*/
-		mdelay(120);
+		msleep(120);
 	}
 
 	if (unlikely(cmd == DCS_EXIT_SLEEP_MODE)) {
-		/*TODO: replace it with msleep later*/
-		mdelay(120);
+		msleep(120);
 	}
 	return 0;
 }
@@ -364,15 +362,12 @@ static int send_pkg_done(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
 	/*update panel status*/
 	if (unlikely(cmd == DCS_ENTER_SLEEP_MODE)) {
 		sender->panel_mode |= MDFLD_DSI_PANEL_MODE_SLEEP;
-		/*TODO: replace it with msleep later*/
-		mdelay(120);
+		msleep(120);
 	} else if (unlikely(cmd == DCS_EXIT_SLEEP_MODE)) {
 		sender->panel_mode &= ~MDFLD_DSI_PANEL_MODE_SLEEP;
-		/*TODO: replace it with msleep later*/
-		mdelay(120);
+		msleep(120);
 	} else if (unlikely(cmd == DCS_SOFT_RESET)) {
-		/*TODO: replace it with msleep later*/
-		mdelay(5);
+		msleep(5);
 	}
 
 	sender->status = MDFLD_DSI_PKG_SENDER_FREE;
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#2 lore raw
Quoted 59 lines · Jani Nikula
Quoted 4 lines · Nicholas Krause

Changes the calls of mdelay to msleep in the driver file mdfld_dsi_pkg_sender.c in order to prevent CPU busy looping in order to save CPU cycles as this is considered bad form over sleeping the CPU for high resolution timer function calls as this driver needs in order to function properly.

The code paths are called with sender->lock spinlock held.

BR,
Jani.

Quoted 48 lines
---
 drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c +5 -11
index 87885d8..77c656a 100644
@@ -335,13 +335,11 @@ static int send_pkg_prepare(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
 
      /*wait for 120 milliseconds in case exit_sleep_mode just be sent*/
      if (unlikely(cmd == DCS_ENTER_SLEEP_MODE)) {
-             /*TODO: replace it with msleep later*/
-             mdelay(120);
+             msleep(120);
      }
 
      if (unlikely(cmd == DCS_EXIT_SLEEP_MODE)) {
-             /*TODO: replace it with msleep later*/
-             mdelay(120);
+             msleep(120);
      }
      return 0;
 }
@@ -364,15 +362,12 @@ static int send_pkg_done(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
      /*update panel status*/
      if (unlikely(cmd == DCS_ENTER_SLEEP_MODE)) {
              sender->panel_mode |= MDFLD_DSI_PANEL_MODE_SLEEP;
-             /*TODO: replace it with msleep later*/
-             mdelay(120);
+             msleep(120);
      } else if (unlikely(cmd == DCS_EXIT_SLEEP_MODE)) {
              sender->panel_mode &= ~MDFLD_DSI_PANEL_MODE_SLEEP;
-             /*TODO: replace it with msleep later*/
-             mdelay(120);
+             msleep(120);
      } else if (unlikely(cmd == DCS_SOFT_RESET)) {
-             /*TODO: replace it with msleep later*/
-             mdelay(5);
+             msleep(5);
      }
 
      sender->status = MDFLD_DSI_PKG_SENDER_FREE;
--

1.9.1

Quoted 7 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Jani Nikula, Intel Open Source Technology Center

Then surely we can remove this to dos or do we have to move all the code to another coding scheme for this driver using mutuxes as they don't loop.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel