Received: by 10.223.185.116 with SMTP id b49csp7459972wrg; Thu, 1 Mar 2018 06:01:17 -0800 (PST) X-Google-Smtp-Source: AG47ELt3kQAIEH2DGwlw7Hz6Eu0PuMA2MqNmRh9C4+XSrn3wY4ga5ygCN59Xk+DQwe4Baa0vrfgM X-Received: by 10.99.97.86 with SMTP id v83mr1633825pgb.138.1519912877675; Thu, 01 Mar 2018 06:01:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519912877; cv=none; d=google.com; s=arc-20160816; b=ogSoFZ4w4Nwefcob4kd+jdVjk6/jLyOB4Awf/NknhamlBv2NKkkwFFoQccSJfW44Mg BwDQ4LHTk0TqDnftIM0t14g6nVZQy5WpJjL0mJbCB7E3IMc3LvAsRGMz+y99oEdlTfVh Ubr7WlshiZaJ8XKkBr011twdhaMjcMcqnfIMiy4wUlyBh0Ak1pAK0PBCE8unZRbEifMI cLnSrjgKCmeXhTQ0AD3466AtKuA96R2ui75lo49GjU9nX42CVsnrdGeQ2gmwYF1Dnuww K6ev4iTvqwWQcvv7tG3UUo0NKedcRbDnS2GiqTXYQ0wLIDFrnbUEXM32crlUHlzlNddG 8tIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=KfontG6W3TBXe7pwLy9tyiUOl9sP5VPvBoU+M+TkNXY=; b=JfbKNsH21LtO+TpiM86JM+Df7UWs59ugSoAn6g1s7Q0PBRN6X6V/afVenGei2S4eV9 QwWfOZemg3l0jgJ5SO0hK2J63O+7nQenXbvIg5qgATVgRBjOy8gOfKeQJhXwci4udOvk gZIGLVSyRlDUttVGQiJEFu3VOoBd88znwHkb7xw1a8qqe+6dlzudy+t0kHMDNJHoq5vO By2opbY4tE4L6I1p9cbsvpjcjp362ojYbA+ynwFK7Fq/p7Bg18PEAviWgDVOIwxoT++v 0k1sqEMWwcRalDFQPiHUmxLESZCXu9o2AF1fB2tS/81Lm5xSwewzK0W5dFQ1OvX+hAol E1SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ckWuIIg3; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l5-v6si3218519pls.438.2018.03.01.06.01.01; Thu, 01 Mar 2018 06:01:17 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=ckWuIIg3; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031073AbeCAN7P (ORCPT + 99 others); Thu, 1 Mar 2018 08:59:15 -0500 Received: from mail-qt0-f170.google.com ([209.85.216.170]:37650 "EHLO mail-qt0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030891AbeCAN7N (ORCPT ); Thu, 1 Mar 2018 08:59:13 -0500 Received: by mail-qt0-f170.google.com with SMTP id r16so7593230qtm.4; Thu, 01 Mar 2018 05:59:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=KfontG6W3TBXe7pwLy9tyiUOl9sP5VPvBoU+M+TkNXY=; b=ckWuIIg3H8ZFcoIy9lKged4XM7bpv/8WnvyZnVMZuwHc5WdEI4rigXkxV4N9OF3NZY ROfCpQRyx0ls+6IT09+7ldYw3t5xYAng/6gvDO3xhL4yvF6RY9F4FGqLJ1Cz4T3RRWQZ iJsXSHGqEy+qFlBv5gaBMjitYBB4cV7bjyG+FMTsjAWnWllxAKRgOoLwWbHyEQYwqa67 dTB25zzFvCJLlIrWpw+CQZLk5V2BGKRqwu1WiH5wlJzLzOqIlIwesL50ZbWjop5E7zkt Ng0dDaagcgqa4puxPbKRjMABOegcwGUUz0sN0IBdW5D0shAkuGQadocUbh8r6dZ0poIa hA0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KfontG6W3TBXe7pwLy9tyiUOl9sP5VPvBoU+M+TkNXY=; b=ieSc7l9UwZsHdsZ8OT77b7jj677cn1bJMK18rJwZ4I6/0Ye3KAHghoyJ7gH+Qt71vS afAt1FF1ADQnHaFzrBJfsf4S67PMbgsWGfyVmyS87zm13MxuZpEw1qrQ96l7tG2jE6gT FrdFvkAbQ2a1xgwH/aEOwL5oLjMks4egJodfL5lMPcDJXk6cif4+H6HOM54iQcQanyag A+5CQ2Zd0NiFu3/nTEQPUJw4bwajfCpF+jEr2SPI5uwoGryhLQzU39bXFV3FmyDpNTbd TL5Hv3LUL31jG2cfKhmrnrhQNuBZPXIQOL1+KTrc7fTMuoH4SFyxlK3M7nHomP5JReS3 zonA== X-Gm-Message-State: AElRT7Eut8SjrRNT6RituuEIPUCTfW+JS5h22KR1MkEa+y9ltAW+RqAq 2ZiViyRp4P1pl32EPR70PdyhW0zUFQf44ezQ1J4= X-Received: by 10.237.59.232 with SMTP id s37mr2983618qte.83.1519912752352; Thu, 01 Mar 2018 05:59:12 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Thu, 1 Mar 2018 05:59:11 -0800 (PST) In-Reply-To: References: <9ea2faf9c1cf8439f3a8ad495c6a2b49dacad7bd.1519889208.git.baolin.wang@linaro.org> From: Andy Shevchenko Date: Thu, 1 Mar 2018 15:59:11 +0200 Message-ID: Subject: Re: [PATCH v4] Input: gpio_keys: Add level trigger support for GPIO keys To: Arnd Bergmann Cc: Baolin Wang , Dmitry Torokhov , Rob Herring , Mark Rutland , Greg Kroah-Hartman , stephen lu , Arvind Yadav , Joseph Lo , Kate Stewart , Philippe Ombredanne , Thomas Gleixner , linux-input , devicetree , Linux Kernel Mailing List , Mark Brown , Linus Walleij Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 1, 2018 at 2:37 PM, Arnd Bergmann wrote: > On Thu, Mar 1, 2018 at 1:09 PM, Andy Shevchenko > wrote: >> On Thu, Mar 1, 2018 at 9:36 AM, Baolin Wang wrote: >>> On some platforms (such as Spreadtrum platform), the GPIO keys can only >>> be triggered by level type. So this patch introduces one trigger_type to >>> indicate if the button's interrupt type is level trigger or edge trigger. >> >>> button->irq = >>> irq_of_parse_and_map(to_of_node(child), 0); >> >> AFAIU, 0 means NO_IRQ, thus, >> >>> + if (button->irq) >>> + button->trigger_type = >>> + irq_get_trigger_type(button->irq); >> >> irq_get_trigger_type(NO_IRQ) should return 0. >> >> Therefore, if (button->irq) is redundant. >> Did I miss anything? > > "irq_of_parse_and_map(to_of_node(child), 0);" is the first interrupt. A > more common way to express the same thing in modern drivers is > 'platform_get_irq(pdev, 0)'. Yes, though I'm talking about _returned_ value. > However, there is one more thing I'm missing: with my suggestion > of emulating edge-triggered interrupts in the irqchip/gpio driver, the > trigger type here should also be 'IRQF_TRIGGER_RISING | > IRQF_TRIGGER_FALLING' in the DT description, so I don't think > we need to change the gpio-keys driver at all, just the gpio driver. Sounds even better. -- With Best Regards, Andy Shevchenko