Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp682340ybh; Wed, 11 Mar 2020 08:44:24 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv5AFmIHKkTb8hmWsqenjmHD+Ht63YHziI9hwD3TV7XBC0hN9Ygr37qct6QgKulDd9hKGHV X-Received: by 2002:a9d:4810:: with SMTP id c16mr2900740otf.248.1583941464066; Wed, 11 Mar 2020 08:44:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583941464; cv=none; d=google.com; s=arc-20160816; b=nuoKQKmrPA1xT0supa05bCGgWbJET5MnlD/RiH1P/NxU28zpaexwNKT1FOw359kG6R mzjW7fU4zTNgWHv4SJ22jINF2JF5MdJTuPL/kzoBrT99C+RpUiYIGMVMvRC3XGXWp0sL E9yZ3y9AWqdbQ5xaUGnRvwVj/hJacZ2L+I6SYI5KrBB5S+CazpzJ1R/hoOeRz1umldMJ RWITqKKHviS5hCYJdFh9t8ZfLV9Us6aUmBKwKlL+7Dd4gJ+ITZgmOdaoMJ2rSeBIiSJ6 Or3W7vLuOp95Gj4EH9tBuSoD5zIEZJmmyCJQABnbDTov4Hflh/ugJF1uXCgZpZTHygu+ siMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=+jjyZBMAq0w1iEDh4XuVJoddKH+48ZEx0kaHiEru8xo=; b=osfd1lBYwSvfDgf01pg7KURxA2ihDyjnmlTjtTpgxicFJFEqObW9yOrRFtlNiw7wfl 9RpqPp8WIbkUxdSrLDetzW31ktvzaXMAHbg4STU2UtfCdT9svNVi0nGXBVMeHyAj3B5R StMEA7sRGcomWmqlDlgieDR+sQhntKVrRGoJ5G5W7x+CW3gnQikUJEt9bJyGDoT7VouG A/LLGHR/d8MjJGtLScbE0x+7zC34AuW9fr1JBb72odIZ/iIKsVqA0bArOCrsB4IS2QC/ D9k15/lJIKBL1Ryu/59WyolP2MoFyjsYr530MVcHsJ67AVnL9Tl2ggHnI+uXy45Cw34T v9Wg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x20si1312209oic.75.2020.03.11.08.44.10; Wed, 11 Mar 2020 08:44:24 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729995AbgCKPna (ORCPT + 99 others); Wed, 11 Mar 2020 11:43:30 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:38788 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729824AbgCKPn3 (ORCPT ); Wed, 11 Mar 2020 11:43:29 -0400 Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jC3Vv-0003YB-Q2; Wed, 11 Mar 2020 16:43:19 +0100 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id 04E17100F5A; Wed, 11 Mar 2020 16:43:18 +0100 (CET) From: Thomas Gleixner To: Tim Harvey , Lokesh Vutla Cc: Marc Zyngier , Santosh Shilimkar , Rob Herring , Nishanth Menon , Jason Cooper , Linux ARM Mailing List , open list , Tero Kristo , Sekhar Nori , Tony Lindgren , Linus Walleij , Peter Ujfalusi , Grygorii Strashko , Device Tree Mailing List , "open list\:GPIO SUBSYSTEM" Subject: Re: [PATCH v8 07/14] gpio: thunderx: Use the default parent apis for {request,release}_resources In-Reply-To: References: <20190430101230.21794-1-lokeshvutla@ti.com> <20190430101230.21794-8-lokeshvutla@ti.com> Date: Wed, 11 Mar 2020 16:43:18 +0100 Message-ID: <87zhcmkicp.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tim, Tim Harvey writes: > On Tue, Apr 30, 2019 at 3:14 AM Lokesh Vutla wrote: >> - if (parent_data && parent_data->chip->irq_request_resources) { >> - r = parent_data->chip->irq_request_resources(parent_data); >> - if (r) >> - goto error; >> - } >> + r = irq_chip_request_resources_parent(data); >> + if (r) >> + gpiochip_unlock_as_irq(&txgpio->chip, txline->line); > > This patch breaks irq resources for thunderx-gpio as > parent_data->chip->irq_request_resources is undefined thus your new > irq_chip_request_resources_parent() returns -ENOSYS causing this > function to return an error where as before it would happily return 0. > > Is the following the correct fix or should we qualify > data->parent_data->chip->irq_request_resources before calling > irq_chip_request_resources_parent() in thunderx-gpio? You are not supposed to fiddle with parent data at all. Just because C allows you is no excuse to violate abstractions in the first place. irq_chip_request_resources_parent() rightfully returns -ENOSYS when it can't request a resource from the parent chip because that chip does not have anything to offer. It's up to the caller to do something sensible with the return code. If your chip is happy with the parent not providing it then handle -ENOSYS. None of the chip callbacks should return -ENOSYS. If one does then that wants to be fixed. Thanks, tglx