Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1720329pxj; Wed, 19 May 2021 12:17:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwYlM9s7L+EE0pGW54fLpFaPNeHpoNggEuLDBWz1uYwm8mDe8uwzPdN/f0sV0WKvukkPdM X-Received: by 2002:a02:7702:: with SMTP id g2mr620459jac.111.1621451828792; Wed, 19 May 2021 12:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621451828; cv=none; d=google.com; s=arc-20160816; b=u/PSEklyhhA6HKGAS/pdsOEWjb9FiyvnXw0NNv2UwRqmQmgYT0ode0xP+RE+dFODAx z1qfF4d9Z29XCk3s6LPqd5Aw0GbmprLnoYzKuD0wvewQgoPG7lsLxRMikgPMZayp8ehS H50flnJ5GDEAdSCbU9b3QmI2v+qbzoF+mC1h+ug3a+EaUMlV9GRPZ8uk6kLXyuYQBFI7 B43nOGTqatLJdVaFkyS6n2qmLU81FKTdxxApKT1qhuviR+ts1y7Gcrc9PJfEmKebXvbU 39TeNtCMWQk+4affz+9Yvsw9V3kETziIXSw8OvBjyX0ez2fJ8nW2dePHEIZlDQHNrlfG BmkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=tUUnevO9M15ggeQ5j1WdXFsrrV78yZ260FsedD3njvU=; b=h5pdrEpyzYrH2dJZswfto76j08m9mtWVmeFbB5AAN1w9pUVgFKtJkYFaGfku5wSuS1 eEm5ttWzwSy93XQViQSyiK2DGqmr7dQYXDIQYmwEbO9RJnNizK4zcgipNaZpne7k67sC F2BU5md9EcW9YKxGL4kT+eRx6JxO+TzF8mwNjMYNDwCYCySbZz6c/XbcQAZ7rOwdNJy8 TMh9YRbeozAhynQDqG04EYDXUFSRVk3G8f2ypY4xya+bSSOk3bJRrmtWmR3QzXtVlM6X 8uw6S3b2RTUNbiXpX7Fdc2zlabSuGb9O/eZeBVkcIpi6jX2cykAItZ7kNDsvtqI0WOr8 z+1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d20si168803jak.40.2021.05.19.12.16.55; Wed, 19 May 2021 12:17:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234685AbhESGWQ (ORCPT + 99 others); Wed, 19 May 2021 02:22:16 -0400 Received: from elvis.franken.de ([193.175.24.41]:38501 "EHLO elvis.franken.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234472AbhESGWO (ORCPT ); Wed, 19 May 2021 02:22:14 -0400 Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1ljFZV-0001TL-00; Wed, 19 May 2021 08:20:45 +0200 Received: by alpha.franken.de (Postfix, from userid 1000) id EA4C8C0F89; Wed, 19 May 2021 08:20:30 +0200 (CEST) Date: Wed, 19 May 2021 08:20:30 +0200 From: Thomas Bogendoerfer To: Linus Walleij Cc: Bartosz Golaszewski , linux-kernel , "open list:GPIO SUBSYSTEM" Subject: Re: [PATCH v5 1/2] gpio: Add support for IDT 79RC3243x GPIO controller Message-ID: <20210519062030.GA4308@alpha.franken.de> References: <20210514123309.134048-1-tsbogend@alpha.franken.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 19, 2021 at 01:50:39AM +0200, Linus Walleij wrote: > Hi Thomas, > > thanks for your patch! > > I can see this is starting to look really good. > > There is one thing that confuses me: > > On Fri, May 14, 2021 at 2:33 PM Thomas Bogendoerfer > wrote: > > > IDT 79RC3243x SoCs integrated a gpio controller, which handles up > > to 32 gpios. All gpios could be used as an interrupt source. > > > > Signed-off-by: Thomas Bogendoerfer > > --- > > Changes in v5: > (...) > > > +static int idt_gpio_irq_set_type(struct irq_data *d, unsigned int flow_type) > > +{ > (...) > > + /* hardware only supports level triggered */ > > + if (sense == IRQ_TYPE_NONE || (sense & IRQ_TYPE_EDGE_BOTH)) > > + return -EINVAL; > (...) > > + irq_set_handler_locked(d, handle_level_irq); > > But: > > > +static void idt_gpio_ack(struct irq_data *d) > > +{ > > + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); > > + struct idt_gpio_ctrl *ctrl = gpiochip_get_data(gc); > > + > > + writel(~BIT(d->hwirq), ctrl->gpio + IDT_GPIO_ISTAT); > > +} > (...) > > + .irq_ack = idt_gpio_ack, > > Correct me if I'm wrong but I thing .irq_ack() is only called > from handle_edge_irq ... so never in this case. handle_level_irq() does a mask_ack_irq() and this uses mask_irq() and desc->irq_data.chip->irq_ack(), if there is no irq_mask_ack function. > Can this ACK just be deleted? no without it interrupts won't go away. > The code in the ACK callback also looks really weird: > write all bits except for the current IRQ into the status > register? It's usually the other way around with these > things. That really makes me suspect it is unused. interrupts are acked by writing a 0 to the bit position. I know it's unusal... Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]