Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752878AbbHCJeh (ORCPT ); Mon, 3 Aug 2015 05:34:37 -0400 Received: from mail-ob0-f170.google.com ([209.85.214.170]:33378 "EHLO mail-ob0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752025AbbHCJeX (ORCPT ); Mon, 3 Aug 2015 05:34:23 -0400 MIME-Version: 1.0 In-Reply-To: <1438346937-9020-2-git-send-email-rabin@rab.in> References: <1438346937-9020-1-git-send-email-rabin@rab.in> <1438346937-9020-2-git-send-email-rabin@rab.in> Date: Mon, 3 Aug 2015 11:34:23 +0200 Message-ID: Subject: Re: [PATCH 2/2] gpio: etraxfs: add interrupt support From: Linus Walleij To: Rabin Vincent Cc: Alexandre Courbot , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1822 Lines: 51 On Fri, Jul 31, 2015 at 2:48 PM, Rabin Vincent wrote: > On ETRAX FS, all pins on the first port (and only the first port) have > interrupt support. > > On ARTPEC-3, all pins on all ports have interrupt support. However, > there are only eight interrupts. Each of the interrupts is associated > with a group of pins and for each interrupt the one pin from the group > which will trigger it can be selected. > > Signed-off-by: Rabin Vincent Hm wait now I get confused ... probably tripping over my own shoelaces as usual but help me here: > +static void etraxfs_gpio_irq_ack(struct irq_data *d) > +{ > + struct etraxfs_gpio_chip *chip = irq_data_get_irq_chip_data(d); I don't see how this works in the irqchip functions. Usually the chip data is the struct gpio_chip when using the GPIOLIB_IRQCHIP, then we use some container_of to boil out the containing struct, like: static inline struct extraxfs_gpio_chip *to_etraxfs(struct gpio_chip *chip) { return container_of(chip, struct etraxfs_gpio_chip, bgc.gc); } So it would be: struct gpio_chip *gc = irq_data_get_irq_chip_data(d); struct etraxfs_gpio_chip *chip = to_etraxfs(gc); so how did you manage to replace that pointer with a pointer to your struct etraxfs_gpio_chip? > + ret = gpiochip_irqchip_add(&bgc->gc, &etraxfs_gpio_irq_chip, 0, > + handle_level_irq, IRQ_TYPE_NONE); Because this sets the irqdomain host_data to gc, then the irqdomain .map function sets the chip data to the same. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/