diff mbox series

drm: gma500: Replace 120ms mdelay calls in mdfld_dsi_pkg_sender.c

Message ID 20181001153655.GA13422@pathfinder (mailing list archive)
State New, archived
Headers show
Series drm: gma500: Replace 120ms mdelay calls in mdfld_dsi_pkg_sender.c | expand

Commit Message

Phillip Potter Oct. 1, 2018, 3:36 p.m. UTC
Replace all 120ms mdelay macro calls with msleep function calls. As msleep is
not suitable for < 20ms sleeps, also remove comment from mdelay(5) call.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---

Comments

Patrik Jakobsson Oct. 2, 2018, 7:52 a.m. UTC | #1
On Mon, Oct 1, 2018 at 5:36 PM Phillip Potter <phil@philpotter.co.uk> wrote:
>
> Replace all 120ms mdelay macro calls with msleep function calls. As msleep is
> not suitable for < 20ms sleeps, also remove comment from mdelay(5) call.
>
> Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> ---
> diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
> index c50534c923df..a9c4116aad8a 100644
> --- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
> +++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
> @@ -322,13 +322,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 == MIPI_DCS_ENTER_SLEEP_MODE)) {
> -               /*TODO: replace it with msleep later*/
> -               mdelay(120);
> +               msleep(120);

Hi Phillip,
This is executed while holding a spinlock so we cannot sleep here.
This is true for send_pkg_done() as well.

- Patrik
>         }
>
>         if (unlikely(cmd == MIPI_DCS_EXIT_SLEEP_MODE)) {
> -               /*TODO: replace it with msleep later*/
> -               mdelay(120);
> +               msleep(120);
>         }
>         return 0;
>  }
> @@ -351,14 +349,11 @@ static int send_pkg_done(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
>         /*update panel status*/
>         if (unlikely(cmd == MIPI_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 == MIPI_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 == MIPI_DCS_SOFT_RESET)) {
> -               /*TODO: replace it with msleep later*/
>                 mdelay(5);
>         }
>
Phillip Potter Oct. 2, 2018, 8:23 a.m. UTC | #2
On Tue, Oct 02, 2018 at 09:52:51AM +0200, Patrik Jakobsson wrote:
> Hi Phillip,
> This is executed while holding a spinlock so we cannot sleep here.
> This is true for send_pkg_done() as well.
> 
> - Patrik

Dear Patrik,

Oops, sorry. I'll try and be more observant in future. Just picked up on these whilst grepping the source :-)

Regards,
Phil
Patrik Jakobsson Oct. 2, 2018, 10:42 a.m. UTC | #3
On Tue, Oct 2, 2018 at 10:23 AM Phillip Potter <phil@philpotter.co.uk> wrote:
>
> On Tue, Oct 02, 2018 at 09:52:51AM +0200, Patrik Jakobsson wrote:
> > Hi Phillip,
> > This is executed while holding a spinlock so we cannot sleep here.
> > This is true for send_pkg_done() as well.
> >
> > - Patrik
>
> Dear Patrik,
>
> Oops, sorry. I'll try and be more observant in future. Just picked up on these whilst grepping the source :-)

No worries, the comments are a bit misleading.

-Patrik

>
> Regards,
> Phil
diff mbox series

Patch

diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
index c50534c923df..a9c4116aad8a 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
@@ -322,13 +322,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 == MIPI_DCS_ENTER_SLEEP_MODE)) {
-		/*TODO: replace it with msleep later*/
-		mdelay(120);
+		msleep(120);
 	}
 
 	if (unlikely(cmd == MIPI_DCS_EXIT_SLEEP_MODE)) {
-		/*TODO: replace it with msleep later*/
-		mdelay(120);
+		msleep(120);
 	}
 	return 0;
 }
@@ -351,14 +349,11 @@  static int send_pkg_done(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
 	/*update panel status*/
 	if (unlikely(cmd == MIPI_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 == MIPI_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 == MIPI_DCS_SOFT_RESET)) {
-		/*TODO: replace it with msleep later*/
 		mdelay(5);
 	}