Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753329AbdCPPkY (ORCPT ); Thu, 16 Mar 2017 11:40:24 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:18158 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752500AbdCPPkX (ORCPT ); Thu, 16 Mar 2017 11:40:23 -0400 From: Patrice CHOTARD To: Linus Walleij CC: "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Peter Griffin , Lee Jones Subject: Re: [PATCH 1/1] pinctrl: st: add irq_request_resources callback Thread-Topic: [PATCH 1/1] pinctrl: st: add irq_request_resources callback Thread-Index: AQHSkQBVHi8O8JbN5UOjpHkIkPKvl6GUZUuAgAM+5IA= Date: Thu, 16 Mar 2017 15:39:19 +0000 Message-ID: References: <1488203368-13574-1-git-send-email-patrice.chotard@st.com> In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.75.127.44] Content-Type: text/plain; charset="utf-8" Content-ID: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-03-16_12:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v2GFec2U007497 Content-Length: 1690 Lines: 63 On 03/14/2017 03:05 PM, Linus Walleij wrote: > On Mon, Feb 27, 2017 at 2:49 PM, wrote: > >> From: Patrice Chotard >> >> When using GPIO as IRQ source, the GPIO must be configured >> in INPUT. The callback dedicated for this was missing in >> pinctrl-st driver. >> >> This fix the following kernel error when trying to lock a gpio >> as IRQ: >> >> [ 7.521095] gpio gpiochip7: (PIO11): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ >> [ 7.526018] gpio gpiochip7: (PIO11): unable to lock HW IRQ 6 for IRQ >> [ 7.529405] genirq: Failed to request resources for 0-0053 (irq 81) on irqchip GPIO >> >> Signed-off-by: Patrice Chotard > > I see what problem you are trying to solve. > >> +static int st_gpio_irq_request_resources(struct irq_data *d) >> +{ >> + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); >> + int pin = d->hwirq; >> + >> + return st_gpio_direction_input(gc, pin); >> +} > (...) >> + .irq_request_resources = st_gpio_irq_request_resources, > > But this is just hiding the problem I'm afraid. > Hi Linus > Now thay you override .irq_request_resources() > gpiochip_irq_reqres() will not be called, so then you have > to lock the irq in the driver, with something like: > > ret = gpiochip_lock_as_irq(&chip->gc, d->hwirq); > if (ret) > goto out; > Ah yes, i didn't noticed that point, thanks for the tips. > You also have to implement the .irq_release_resources() > callback and unlock the IRQ there. In this case, yes the release becomes mandatory. I will send a v2. Thanks Patrice > > Yours, > Linus Walleij >