From patchwork Thu Oct 12 17:55:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10002467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 695D460216 for ; Thu, 12 Oct 2017 17:56:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D16128E5B for ; Thu, 12 Oct 2017 17:56:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 523D328E60; Thu, 12 Oct 2017 17:56:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 74F5C28E5B for ; Thu, 12 Oct 2017 17:56:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5467F6E8F9; Thu, 12 Oct 2017 17:56:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-x22e.google.com (mail-qt0-x22e.google.com [IPv6:2607:f8b0:400d:c0d::22e]) by gabe.freedesktop.org (Postfix) with ESMTPS id A5C0D6E8F9 for ; Thu, 12 Oct 2017 17:56:27 +0000 (UTC) Received: by mail-qt0-x22e.google.com with SMTP id q4so15145513qtq.8 for ; Thu, 12 Oct 2017 10:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GPObBzUDDw/vk8d05jyeeW23jpNGDRJvD51rxZnhbqY=; b=Y/vHUGUbdhnpGtBylPJblrbXofnPumc3srdpEToX26F73X2k38TycCRd0dMqaMzfcF fjfK5rDQJsBA+s3t+JKsDpL2RWLoon6PXna2+6on6VHQRk3r51tMHgaMEdJPyA4mp5TU 3Ce6AoXF3PtIAkJBmZoLmKACh0mNDzOSMNmNw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GPObBzUDDw/vk8d05jyeeW23jpNGDRJvD51rxZnhbqY=; b=YLOIKM8sXSdeyi5OME4lX+Fj+pm6SzXpZFOh+YbAlyoVv2jYC23d2oYwdSFMkqeqbW kB1MZM6dpPsy4YK6kHX8UERr8WuiSbBddbmN+2JzrHpAOULiATEpo1TVQmK8wMs1ITyn 3l0W4BHkPUIxFowJwwmKd9K79ypfxE/uCVp3QrIrmWpefdBSAK3Vtj1qBHbhPeq2v9H+ +QUc/z+G/ANmgco4xanQ/gMnepLVLZUdb+xto5ImJZbtCEwLuMWD4BLQk9hRD/SJ/4E8 gIXNDBnjpfDGtVlqm+QC2VJFY24XEsc2MfHqOcSlsvGUDM/lDipGIcZdqCR6yewEbfOZ ZCew== X-Gm-Message-State: AMCzsaXxNAIhQhZrnZK335nRhZW7Rg7UC+MKXCThVeRCT16LRQ8Colid 4B708Weo7ejVW1Be7Sshf6DlDP1uk08= X-Google-Smtp-Source: AOwi7QA2DjmiXhuxelmjDmIO0l+azTLmuPBmtmh8mh8yMjdTrmizCjuEo4HoITo6numxke63fDQrSQ== X-Received: by 10.129.199.74 with SMTP id i10mr2355557ywl.10.1507830986464; Thu, 12 Oct 2017 10:56:26 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:0:f685:3152:9ba1:429a]) by smtp.gmail.com with ESMTPSA id x140sm5853087ywd.60.2017.10.12.10.56.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Oct 2017 10:56:26 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 06/10] drm/panel: otm8009a: Properly sequence [un]prepare with backlight Date: Thu, 12 Oct 2017 13:55:33 -0400 Message-Id: <20171012175546.21323-7-seanpaul@chromium.org> X-Mailer: git-send-email 2.15.0.rc0.271.g36b669edcc-goog In-Reply-To: <20171012175546.21323-1-seanpaul@chromium.org> References: <20171012175546.21323-1-seanpaul@chromium.org> Cc: thierry.reding@gmail.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP I noticed while removing the enabled flag that backlight update checks prepared in such a way that could race with hardware turning on/off. This patch adds a mutex to ensure these races don't happen. In addition to the lock, this patch also renames prepared to initialized to better reflect what it means when used in the backlight hook. Signed-off-by: Sean Paul --- drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 43 ++++++++++++++++-------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c index 0a5898fd4502..d099af3c91df 100644 --- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c +++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c @@ -11,6 +11,7 @@ #include #include #include +#include #include