From patchwork Wed Mar 11 15:43:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 1253045 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gateworks.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48cxvV19xpz9s3x for ; Thu, 12 Mar 2020 03:17:58 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730055AbgCKQR5 (ORCPT ); Wed, 11 Mar 2020 12:17:57 -0400 Received: from lists.gateworks.com ([108.161.130.12]:39867 "EHLO lists.gateworks.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730162AbgCKQR5 (ORCPT ); Wed, 11 Mar 2020 12:17:57 -0400 X-Greylist: delayed 2040 seconds by postgrey-1.27 at vger.kernel.org; Wed, 11 Mar 2020 12:17:57 EDT Received: from 68-189-91-139.static.snlo.ca.charter.com ([68.189.91.139] helo=tharvey.pdc.gateworks.com) by lists.gateworks.com with esmtp (Exim 4.82) (envelope-from ) id 1jC3Xn-0008Ub-Ga; Wed, 11 Mar 2020 15:45:15 +0000 From: Tim Harvey To: Linus Walleij , Robert Richter , Lokesh Vutla Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Tim Harvey Subject: [PATCH] gpio: thunderx: fix irq_request_resources Date: Wed, 11 Mar 2020 08:43:53 -0700 Message-Id: <1583941433-15876-1-git-send-email-tharvey@gateworks.com> X-Mailer: git-send-email 2.7.4 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org If there are no parent resources do not call irq_chip_request_resources_parent at all as this will return an error. This resolves a regression where devices using a thunderx gpio as an interrupt would fail probing. Fixes: 0d04d0c ("gpio: thunderx: Use the default parent apis for {request,release}_resources") Signed-off-by: Tim Harvey Acked-by: Linus Walleij --- drivers/gpio/gpio-thunderx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c index 4627704..f84b9b1 100644 --- a/drivers/gpio/gpio-thunderx.c +++ b/drivers/gpio/gpio-thunderx.c @@ -366,15 +366,18 @@ static int thunderx_gpio_irq_request_resources(struct irq_data *data) { struct thunderx_line *txline = irq_data_get_irq_chip_data(data); struct thunderx_gpio *txgpio = txline->txgpio; + struct irq_data *parent_data = data->parent_data; int r; r = gpiochip_lock_as_irq(&txgpio->chip, txline->line); if (r) return r; - r = irq_chip_request_resources_parent(data); - if (r) - gpiochip_unlock_as_irq(&txgpio->chip, txline->line); + if (parent_data && parent_data->chip->irq_request_resources) { + r = irq_chip_request_resources_parent(data); + if (r) + gpiochip_unlock_as_irq(&txgpio->chip, txline->line); + } return r; }