[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=U-9WoyZTyj0weDxVkZjQ7ESc+pwJXX=19JuGrOCrsKcQ@mail.gmail.com>
Date: Fri, 22 Jul 2016 21:04:41 -0700
From: Doug Anderson <dianders@...omium.org>
To: Yakir Yang <ykk@...k-chips.com>
Cc: Mark Yao <yzq@...k-chips.com>, Inki Dae <inki.dae@...sung.com>,
Jingoo Han <jingoohan1@...il.com>,
Heiko Stuebner <heiko@...ech.de>,
Javier Martinez Canillas <javier@....samsung.com>,
Stéphane Marchesin <marcheu@...omium.org>,
Sean Paul <seanpaul@...omium.org>,
Tomasz Figa <tfiga@...omium.org>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Thierry Reding <treding@...dia.com>,
Krzysztof Kozlowski <k.kozlowski@...sung.com>,
Emil Velikov <emil.l.velikov@...il.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
linux-samsung-soc <linux-samsung-soc@...r.kernel.org>,
"open list:ARM/Rockchip SoC..." <linux-rockchip@...ts.infradead.org>
Subject: Re: [PATCH v4 2/4] drm/rockchip: add an common abstracted PSR driver
Yakir,
On Wed, Jul 13, 2016 at 9:15 PM, Yakir Yang <ykk@...k-chips.com> wrote:
> +static void psr_set_state(struct psr_drv *psr, enum psr_state state)
> +{
> + mutex_lock(&psr->state_mutex);
> +
> + if (psr->state == state) {
> + mutex_unlock(&psr->state_mutex);
> + return;
> + }
> +
> + psr->state = state;
> + switch (state) {
> + case PSR_ENABLE:
> + psr->set(psr->encoder, true);
> + break;
> +
> + case PSR_DISABLE:
> + case PSR_FLUSH:
> + psr->set(psr->encoder, false);
> + break;
> + };
> +
> + mutex_unlock(&psr->state_mutex);
> +}
> +
> +static void psr_flush_handler(unsigned long data)
> +{
> + struct psr_drv *psr = (struct psr_drv *)data;
> +
> + if (!psr || psr->state != PSR_FLUSH)
> + return;
> +
> + psr_set_state(psr, PSR_ENABLE);
As mentioned in a separate thread, this is probably not OK.
psr_set_state() grabs a mutex and that might sleep. ...but
psr_flush_handler() is a timer. I'm nearly certain that timers can't
sleep.
I believe this is the source of "sleeping function called from invalid
context" that I've seen at times.
-Doug
Powered by blists - more mailing lists