linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Noralf Trønnes" <noralf@tronnes.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/6] staging: fbtft: convert fbtft_reset() to be non-atomic
Date: Tue, 3 Jan 2017 18:22:09 +0100	[thread overview]
Message-ID: <cae5ba4f-ba6d-ac04-75e1-9b0ebb48ec95@tronnes.org> (raw)
In-Reply-To: <20170102113534.127692-2-andriy.shevchenko@linux.intel.com>


Den 02.01.2017 12:35, skrev Andy Shevchenko:
> First of all, fbtft in current state doesn't allow to override GPIOs to be
> optional, like "reset" one. It might be a bug somewhere, but rather out of
> scope of this fix.
>
> Second, not all GPIOs available on the board would be SoC based, some of them
> might sit on I2C GPIO expanders, for example, on Intel Edison/Arduino, and thus
> any communication with them might sleep.
>
> Besides that using udelay() and mdelay() is kinda resource wasteful.
>
> Summarize all of the above, convert fbtft_reset() function to non-atomic
> variant by using gpio_set_value_cansleep(), usleep_range(), and msleep().
>
> To avoid potential use in atomic context annotate it via might_sleep() macro.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/staging/fbtft/fbtft-core.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
> index bbe89c9c4fb9..e8bf0d1ec11f 100644
> --- a/drivers/staging/fbtft/fbtft-core.c
> +++ b/drivers/staging/fbtft/fbtft-core.c
> @@ -336,11 +336,14 @@ static void fbtft_reset(struct fbtft_par *par)
>   {
>   	if (par->gpio.reset == -1)
>   		return;
> +
> +	might_sleep();

gpio_set_value_cansleep() already does might_sleep().
So with that removed:
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>

> +
>   	fbtft_par_dbg(DEBUG_RESET, par, "%s()\n", __func__);
> -	gpio_set_value(par->gpio.reset, 0);
> -	udelay(20);
> -	gpio_set_value(par->gpio.reset, 1);
> -	mdelay(120);
> +	gpio_set_value_cansleep(par->gpio.reset, 0);
> +	usleep_range(20, 40);
> +	gpio_set_value_cansleep(par->gpio.reset, 1);
> +	msleep(120);
>   }
>   
>   static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line,

  reply	other threads:[~2017-01-03 17:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-02 11:35 [PATCH v2 0/6] fbtft: make it work with DMA enabled SPI Andy Shevchenko
2017-01-02 11:35 ` [PATCH v2 1/6] staging: fbtft: convert fbtft_reset() to be non-atomic Andy Shevchenko
2017-01-03 17:22   ` Noralf Trønnes [this message]
2017-01-02 11:35 ` [PATCH v2 2/6] staging: fbtft: do not override DMA coherent mask Andy Shevchenko
2017-01-02 18:14   ` Noralf Trønnes
2017-01-03 10:51     ` Andy Shevchenko
2017-01-03 13:58       ` Andy Shevchenko
2017-01-03 17:18         ` Noralf Trønnes
2017-01-02 11:35 ` [PATCH v2 3/6] staging: fbtft: fallback to usual allocation when DMA fails Andy Shevchenko
2017-01-03 16:12   ` Andy Shevchenko
2017-01-03 17:23     ` Noralf Trønnes
2017-01-02 11:35 ` [PATCH v2 4/6] staging: fbtft: propagate error code from kstrto*() Andy Shevchenko
2017-01-02 18:19   ` kbuild test robot
2017-01-02 11:35 ` [PATCH v2 5/6] staging: fbtft: fb_ssd1306: Support smaller screen sizes Andy Shevchenko
2017-01-03 17:27   ` Noralf Trønnes
2017-01-02 11:35 ` [PATCH v2 6/6] staging: fbtft: fb_ssd1306: Refactor write_vmem() Andy Shevchenko
2017-01-02 11:37 ` [PATCH v2 0/6] fbtft: make it work with DMA enabled SPI Andy Shevchenko
2017-01-03 15:27   ` Greg Kroah-Hartman
2017-01-03 15:49     ` Andy Shevchenko

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=cae5ba4f-ba6d-ac04-75e1-9b0ebb48ec95@tronnes.org \
    --to=noralf@tronnes.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.petazzoni@free-electrons.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 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).