Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp312711imm; Wed, 29 Aug 2018 00:14:57 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYPaA5zBlPjjTxbU+QcgZ1uJEUSxrtestpgJhDe+/CSLdv65kciWSJ08VPnMBLxp+Mc4vNU X-Received: by 2002:a63:f414:: with SMTP id g20-v6mr2610245pgi.407.1535526897070; Wed, 29 Aug 2018 00:14:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535526897; cv=none; d=google.com; s=arc-20160816; b=dUwSMFm/MsiO72niU91JplpBkgaiJA1fSWrgaO+aZI4RW+p/cPr0N0DsYJGx/S8Ev/ kndajyhy4E0XVchhpb4Zo0/4wmLZ5I6pl+fO7bsv1a/AhhGhmgh0IBcxxalrDKhktLYg 3MSrEIshWmPX0sBAZHKCRi2wYfIU7orvrJMuN4V/RX4S+BGFdrBeRnuOcjhAMR8soIK+ qDn2+9S4DlZwIRQS5laXE9kfftnr9tj3sYzU5CLqbngKFf7w2GcCUyhXHPmSDZo0kB+5 JWreBFQdI+aV3DFLszqo5j6GyJ/EBt3zsUpD/IXo8QzDDQ7k/0b+Zhkl8tfls2f1WRPm P3QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=QyPN1vQCzMJbbG4wQos4JK0I0lney6fUl96+cFGvRnQ=; b=PV+40p9N8AnLaAKLD45SsKKgiummvwJYJAIk12ByW7hr7w3iNW3Ps+eGkpFzgDYRds bvfQyphWjubCKyhgqsiwM37ZKCRF8RpggUBSysvm2KkCzUKWgjK9XLj1cVk/AoJV8uGO C511jQ0icL1zVPrlTnTrh0Lk6cx0V9CjL4K6fBk6pXhkfCt1SgnyaNSQexuV/7RKK6QL OBwlmklRPFmB8P4iiW+xCTZYCr73WChOqP7EGioCoDIvfOAEM8W3LGhnCi5aDcJkNU+A /K1fO6ehU+CWVrsCQLk38UzGUTpC2PM71BHV79nlC8gORCb+9PBHFZb+dvxsl8bBqx+O ORYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=eTynB6Hb; dkim=pass header.i=@codeaurora.org header.s=default header.b=IOh6agEb; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t21-v6si3230566plj.261.2018.08.29.00.14.42; Wed, 29 Aug 2018 00:14:57 -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=@codeaurora.org header.s=default header.b=eTynB6Hb; dkim=pass header.i=@codeaurora.org header.s=default header.b=IOh6agEb; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727643AbeH2LI6 (ORCPT + 99 others); Wed, 29 Aug 2018 07:08:58 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:41450 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727156AbeH2LI5 (ORCPT ); Wed, 29 Aug 2018 07:08:57 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D63B260540; Wed, 29 Aug 2018 07:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1535526809; bh=dzPkriEpsu0jPqhoR24QNFhQBeJecYxGuFn1tIk0wIU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=eTynB6HbMF3iESOOm7pUHCVJzTEg1kLEL2qdR3c0vQ0+x1wCEOn0Vj8oNW6xiw0ZF gl/H49At8Fc2YDTA1i2g0cIYCLaXm+Bq8tfLsZbl+jCipNITKELRkJmIGWELJA23IU n9vwHado7XCXRNCnjJNv7eVNsIgtDu8z9wnJHPyE= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id D91E160227; Wed, 29 Aug 2018 07:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1535526808; bh=dzPkriEpsu0jPqhoR24QNFhQBeJecYxGuFn1tIk0wIU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IOh6agEb1m/45+6CdGBQcgUBuC6KgwBgBUgVWswWCDGJGrgDW1RJ0XuxhJrBNc/Tj HhTHJqhfROToOdn90wFXN5enPwP9QUl36Xsms+DZE5DALr9Y3VXRXPkqjwBZXHrpFH UHlVaemX1ca215mubXCDxD6sLFq56SnHjWf8dvGc= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 29 Aug 2018 12:43:28 +0530 From: kgunda@codeaurora.org To: Bjorn Andersson Cc: jingoohan1@gmail.com, lee.jones@linaro.org, b.zolnierkie@samsung.com, dri-devel@lists.freedesktop.org, daniel.thompson@linaro.org, jacek.anaszewski@gmail.com, pavel@ucw.cz, robh+dt@kernel.org, mark.rutland@arm.com, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH V5 8/8] backlight: qcom-wled: Add auto string detection logic In-Reply-To: <20180827145420.GL3048@tuxbook-pro> References: <1535106467-17843-1-git-send-email-kgunda@codeaurora.org> <1535106467-17843-9-git-send-email-kgunda@codeaurora.org> <20180827145420.GL3048@tuxbook-pro> Message-ID: X-Sender: kgunda@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-08-27 20:24, Bjorn Andersson wrote: > On Fri 24 Aug 03:27 PDT 2018, Kiran Gunda wrote: >> diff --git a/drivers/video/backlight/qcom-wled.c >> b/drivers/video/backlight/qcom-wled.c > [..] >> struct wled { >> @@ -135,16 +146,22 @@ struct wled { >> struct regmap *regmap; >> struct mutex lock; /* Lock to avoid race from thread irq handler */ >> ktime_t last_short_event; >> + ktime_t start_ovp_fault_time; >> u16 ctrl_addr; >> u16 sink_addr; >> u16 max_string_count; >> + u16 auto_detection_ovp_count; >> u32 brightness; >> u32 max_brightness; >> u32 short_count; >> + u32 auto_detect_count; >> bool disabled_by_short; >> bool has_short_detect; >> + int ovp_irq; >> + bool ovp_irq_disabled; > > ovp_irq_disabled is now only assigned, never read. So you should be > able > to drop it. > Ok. will address in next series. > [..] >> @@ -200,7 +226,18 @@ static int wled_module_enable(struct wled *wled, >> int val) >> WLED_CTRL_REG_MOD_EN, >> WLED_CTRL_REG_MOD_EN_MASK, >> val << WLED_CTRL_REG_MOD_EN_SHIFT); >> - return rc; >> + if (rc < 0) >> + return rc; >> + >> + if (val) { >> + schedule_delayed_work(&wled->ovp_work, HZ / 100); > > wled_ovp_work() is a nop when ovp_irq == 0, so wrap the entire if/else > in a check for ovp_irq > 0 (rather than include it in the else) and > drop > it from the worker. > Will address in next series. >> + } else { >> + if (!cancel_delayed_work_sync(&wled->ovp_work) && >> + wled->ovp_irq > 0) >> + disable_irq(wled->ovp_irq); >> + } >> + >> + return 0; > > Also, if a user calls rmmod within 10ms of enabling module we will > schedule work of code that's no longer available in the kernel. So you > need to also cancel_delayed_work_sync() in the remove function of the > driver. > > Will address in next series. > Apart from this I think this patch looks good now! > Thank you > Regards, > Bjorn