Received: by 10.192.165.156 with SMTP id m28csp395281imm; Mon, 16 Apr 2018 01:57:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx49xmeOtCpDd8K4sWMzh2sxcjqjBDp5YcwUWBy/VJM07+wjK9dA4VqWtLPysc937V85kuhbN X-Received: by 10.167.129.154 with SMTP id g26mr642951pfi.169.1523869032815; Mon, 16 Apr 2018 01:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523869032; cv=none; d=google.com; s=arc-20160816; b=ZYxq36TSkfuKGmqbYXKRvK84F3lKl/SKMVd9XMWR82Qp8jaKzIx3oUIp3Ts9DbhBXe 114+s2xsAZ5Z3YPrnc1Zgsl5poMZuu2D/YOCooeBBw+0Oe6uO8bjFmCdT61N7bPO6+5s b2ccy6HYQU6Y+4GjS90VJq7kY9IhJBuGARa7JNJlCHWDAPHQQnUwfSEtOVsHQKXxBzsD P51XY8Ic5vdEDrwyLLSqsHJhvakRo/u32/20/3yW6XOmEkU4Aa1UWh5GWHfG90OoY9+R 6yBjbvOElANzytCtvU12HPZ9UymD6a4hGmtg/1pfAlMAGipFipiDZp0ogLrnSNqJXRl/ acYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter :arc-authentication-results; bh=OuJF6j1zxkxE6NvVkWRFbMRRQToYEbHv+i2cxHHq6ug=; b=xOnV2N6lNDx7tDLz3iaHM6ffaQAbn0cSNtSw15omrLAzg2m75eGjXiYGeOlczz3fDB id5wLcV5jkj12noPh3GpxkdqsUJGPW6KD2x6UuhsZR+VKBnjVQ3XeM+INKRhUg9Za9ma R3jQyR1WnL3iNc1SGuXDoklMwGGQzrIzAo9B7e/FBA+y2PE2eql8QndxFajQU/wHeH4h Wz28fBkxliJI2u1/hlLS+9AG5DgLvFff5/4j6gBgHWQcOl2pypLbPD9bTg13ufLqWMmv tjIHKRDx8NFkHm7xcYj8YH3D3gLUAkkfK3Bi07Q8tqdRApkCXACDPAUa9afroMt4ynFp 6Hjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Frf2cxNH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si11260961pll.332.2018.04.16.01.56.58; Mon, 16 Apr 2018 01:57:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Frf2cxNH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754379AbeDPIzn (ORCPT + 99 others); Mon, 16 Apr 2018 04:55:43 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:42585 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754354AbeDPIzk (ORCPT ); Mon, 16 Apr 2018 04:55:40 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180416085537euoutp023efdb53125a12cd1db879e3e582aa62b~l3rmo0aeQ1931519315euoutp02b; Mon, 16 Apr 2018 08:55:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180416085537euoutp023efdb53125a12cd1db879e3e582aa62b~l3rmo0aeQ1931519315euoutp02b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1523868938; bh=OuJF6j1zxkxE6NvVkWRFbMRRQToYEbHv+i2cxHHq6ug=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=Frf2cxNHoNcATsVG62kMqT5jlOOwFSxMQl/BiRdNjR6ucVThIu/9pSmGyMRFxwWRt UAj5ODcjl/FSGmA71W4CxnCrnMmir+WWmjrh09bTqon0wg3h8gjD5F+lFqNG4ctYCU a7A9BznpeoEJel7SRJYgbj2LpFzrRRttNJqgruY4= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180416085537eucas1p259cc1d20d6a23890328860ba68f75194~l3rl20L8T2987229872eucas1p2G; Mon, 16 Apr 2018 08:55:37 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 65.31.10409.80564DA5; Mon, 16 Apr 2018 09:55:36 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20180416085536eucas1p1782ef8a3efb1e4579f76d45d3ac7fad3~l3rk8Xnmg2794927949eucas1p12; Mon, 16 Apr 2018 08:55:36 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20180416085535eusmtrp2779d59b4a581b8f60424f2a9d630c4e7~l3rksDfqq1645416454eusmtrp23; Mon, 16 Apr 2018 08:55:35 +0000 (GMT) X-AuditID: cbfec7f5-b45ff700000028a9-14-5ad465080316 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 08.83.04183.70564DA5; Mon, 16 Apr 2018 09:55:35 +0100 (BST) Received: from [106.120.43.17] (unknown [106.120.43.17]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20180416085534eusmtip298433d309b83cb2f2869bd72fd2ff500~l3rjeeh6p2476324763eusmtip2I; Mon, 16 Apr 2018 08:55:34 +0000 (GMT) Subject: Re: [PATCH v6 25/30] drm/rockchip: Cancel PSR enable work before changing the state To: Enric Balletbo i Serra , architt@codeaurora.org, inki.dae@samsung.com, thierry.reding@gmail.com, hjc@rock-chips.com, seanpaul@chromium.org, airlied@linux.ie, tfiga@chromium.org, heiko@sntech.de Cc: dri-devel@lists.freedesktop.org, dianders@chromium.org, ykk@rock-chips.com, kernel@collabora.com, m.szyprowski@samsung.com, linux-samsung-soc@vger.kernel.org, jy0922.shim@samsung.com, rydberg@bitmath.org, krzk@kernel.org, linux-rockchip@lists.infradead.org, kgene@kernel.org, linux-input@vger.kernel.org, orjan.eide@arm.com, wxt@rock-chips.com, jeffy.chen@rock-chips.com, linux-arm-kernel@lists.infradead.org, mark.yao@rock-chips.com, wzz@rock-chips.com, hl@rock-chips.com, jingoohan1@gmail.com, sw0312.kim@samsung.com, linux-kernel@vger.kernel.org, kyungmin.park@samsung.com, Laurent.pinchart@ideasonboard.com, kuankuan.y@gmail.com, hshi@chromium.org From: Andrzej Hajda Message-ID: <39f15f1d-c984-d328-4d1f-dc115f71b98f@samsung.com> Date: Mon, 16 Apr 2018 10:55:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180405095000.9756-26-enric.balletbo@collabora.com> Content-Transfer-Encoding: 8bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA02SfUxTZxTG995vmMVLUXkn29iqy9wXYmayk8zpIsu8/2wx22IIibi7eYNO Wk0LDt3YujqlBUVXjZZWYYsMDcHYFITaJSC4iUBuoWlhMFZwgA6LFWMpjE1klMsy/nvO7zwn 5zxvXo5U32FWcrt1eZJeJ+ZqmHiq/sa09zVOCmSld9vS4Zi3jQC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2Xxu494p17/OMffyj6c36YaqvzgU1OqxN1uUjKTTqj+lTZL2P+sSesyMAwAA X-CMS-MailID: 20180416085536eucas1p1782ef8a3efb1e4579f76d45d3ac7fad3 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-MTR: 20180416085536eucas1p1782ef8a3efb1e4579f76d45d3ac7fad3 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180405095309epcas2p429f551f81c6fee6e6c7ed674318f4bf2 X-RootMTR: 20180405095309epcas2p429f551f81c6fee6e6c7ed674318f4bf2 References: <20180405095000.9756-1-enric.balletbo@collabora.com> <20180405095000.9756-26-enric.balletbo@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05.04.2018 11:49, Enric Balletbo i Serra wrote: > From: Tomasz Figa > > If we change the state first and reschedule later, we might have the > work executed according to previous scheduled time and end up with PSR > re-enabled instantly. Let's cancel the work before changing the state. > > While at it, consolidate psr_disable_handler() to just call > rockchip_drm_do_flush(), as they are both supposed to do the same. > > Signed-off-by: Tomasz Figa > Signed-off-by: Thierry Escande > Signed-off-by: Enric Balletbo i Serra > Tested-by: Marek Szyprowski > --- > > drivers/gpu/drm/rockchip/rockchip_drm_psr.c | 20 ++++++++------------ > 1 file changed, 8 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c > index a107845ba97c..c8655e625ba2 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c > @@ -138,18 +138,6 @@ static void psr_flush_handler(struct work_struct *work) > mutex_unlock(&psr->lock); > } > > -static void psr_disable_handler(struct work_struct *work) > -{ > - struct psr_drv *psr = container_of(work, struct psr_drv, disable_work); > - > - /* If the state has changed since we initiated the flush, do nothing */ > - mutex_lock(&psr->lock); > - if (psr->state == PSR_ENABLE) > - psr_set_state_locked(psr, PSR_FLUSH); > - mutex_unlock(&psr->lock); > - mod_delayed_work(system_wq, &psr->flush_work, PSR_FLUSH_TIMEOUT_MS); > -} > - > /** > * rockchip_drm_psr_activate - activate PSR on the given pipe > * @encoder: encoder to obtain the PSR encoder > @@ -198,6 +186,7 @@ EXPORT_SYMBOL(rockchip_drm_psr_deactivate); > > static void rockchip_drm_do_flush(struct psr_drv *psr) > { > + cancel_delayed_work_sync(&psr->flush_work); > psr_set_state(psr, PSR_FLUSH); > mod_delayed_work(system_wq, &psr->flush_work, PSR_FLUSH_TIMEOUT_MS); I guess you can change it to schedule_delayed_work then. Anyway: Reviewed-by: Andrzej Hajda  -- Regards Andrzej > } > @@ -244,6 +233,13 @@ void rockchip_drm_psr_flush_all(struct drm_device *dev) > } > EXPORT_SYMBOL(rockchip_drm_psr_flush_all); > > +static void psr_disable_handler(struct work_struct *work) > +{ > + struct psr_drv *psr = container_of(work, struct psr_drv, disable_work); > + > + rockchip_drm_do_flush(psr); > +} > + > static void psr_input_event(struct input_handle *handle, > unsigned int type, unsigned int code, > int value)