From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A396C33C9E for ; Wed, 8 Jan 2020 11:26:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69F98206DB for ; Wed, 8 Jan 2020 11:26:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726411AbgAHL0R (ORCPT ); Wed, 8 Jan 2020 06:26:17 -0500 Received: from mga18.intel.com ([134.134.136.126]:44512 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726107AbgAHL0Q (ORCPT ); Wed, 8 Jan 2020 06:26:16 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2020 03:26:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,409,1571727600"; d="scan'208";a="218043679" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga008.fm.intel.com with ESMTP; 08 Jan 2020 03:26:09 -0800 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1ip9TV-0001sB-6p; Wed, 08 Jan 2020 13:26:09 +0200 Date: Wed, 8 Jan 2020 13:26:09 +0200 From: Andy Shevchenko To: Yingjoe Chen Cc: fengping yu , Matthias Brugger , Dmitry Torokhov , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , Shawn Guo , Olof Johansson , Aisheng Dong , Anson Huang , Maxime Ripard , Leonard Crestez , Dinh Nguyen , Marcin Juszkiewicz , Valentin Schneider , Arnd Bergmann , Mark Brown , Thierry Reding , YueHaibing , Stefan Agner , Jacky Bai , Marco Felsch , devicetree@vger.kernel.org, wsd_upstream@mediatek.com, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH V2 2/2] drivers: input: keyboard Message-ID: <20200108112609.GN32742@smile.fi.intel.com> References: <20200108062923.14684-1-fengping.yu@mediatek.com> <20200108062923.14684-3-fengping.yu@mediatek.com> <1578473162.12131.13.camel@mtksdaap41> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1578473162.12131.13.camel@mtksdaap41> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org On Wed, Jan 08, 2020 at 04:46:02PM +0800, Yingjoe Chen wrote: > On Wed, 2020-01-08 at 14:29 +0800, fengping yu wrote: > > + tasklet_init(&keypad->tasklet, kpd_keymap_handler, > > + (unsigned long)keypad); > > + > > + writew((u16)(keypad->key_debounce & KPD_DEBOUNCE_MASK), > > + keypad->base + KP_DEBOUNCE); > > You use a 13 bits mask and set it directly to KP_DEBOUNCE register. Are > you sure the debounce unit is ms? > > > + > > + /* register IRQ */ > > + err = request_irq(keypad->irqnr, kpd_irq_handler, IRQF_TRIGGER_NONE, > > + KPD_NAME, keypad); > > please consider using devm_request_irq, otherwise you have to free it in > _remove function. No, you may not use devm_*_irq() when tasklets are in use. There is a nasty race condition. Actually the rule of thumb is to NOT use devm_*_irq() unless you exactly know what you are doing. P.S. Why simple not to switch to threaded IRQ handler and drop tasklet? In such case devm_*_irq() is fine. -- With Best Regards, Andy Shevchenko