Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp598126imm; Wed, 23 May 2018 02:18:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrYQ+3fnViPr3FBaZBUu73RLWsbj3wrAg1GcDvmJDjeJ23XDyeKQjHCGqGA1+oqPZbtybFd X-Received: by 2002:a17:902:70c9:: with SMTP id l9-v6mr2132352plt.382.1527067125711; Wed, 23 May 2018 02:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527067125; cv=none; d=google.com; s=arc-20160816; b=z6PgArQ6hTALSrsvJHIhRv/PfSY7o9AtK3ugpHrdr2txzZMKFtEtK2pwc7q51PaGbY I4f7beHBQsKPTOxhQD+P6zY8UNl7pOxLLl6ZgcgLo16SSRVXJPw9AkmPUsDHRQyp+wMr /ViNFfwi61DnwrnEgAnxPt3y2hmKWyFUpCvn/kpt0UzW4iCaU4At6h/qxgmnz2grTmhY tHMzVxUCHAflzW9vCre+8PsJ9DU9zT3m1ja8otbtf/s6jFe34KEcFXHsP4fhaO04QTyB oOwmIl3nzA2TQlSEEPIW+XTO1DIHdk1fAjgzhl+1WRcq7Ovr6he5/GX/JUvnEYSI6/lf TweQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=v022/BI6osfxLde1AyxROyDh2LytvQNLfHXAJAPN7q4=; b=VjLHfCEa89l58c3/Nsl06DPaAY+0A/pHXoRX/E4QQfLaxbD9eLXs4Xtwde3Rm5FmiK wNtI+sjAaSxU3GSIvrDQDuB/HHd8W39xJb65EZO7O9QTuwEwn5ho8mKq5Www4v8mJphD iGo+6XISzOcugIlQzbPMFp4k3tUWNn2RHuL4FBfw7a+WdQCrEY2/PNTA//CJVzeNvoit JvRUcJ0fWKt8SJxv1VgoJ6A3UztpinFb++NWLOGUubPxyfB8VfpsQskyM1TBlE2CFnTq cSY5JvXZe5cDMMRjREX3ymXuuoM1oWT6NSw7CB0CsMrQ+Y5hJrgAWn37K/fAmiDE2IDe EyDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@renesasgroup.onmicrosoft.com header.s=selector1-renesas-com header.b=KZti6XVw; 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 b84-v6si20001676pfb.189.2018.05.23.02.18.30; Wed, 23 May 2018 02:18:45 -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; dkim=pass header.i=@renesasgroup.onmicrosoft.com header.s=selector1-renesas-com header.b=KZti6XVw; 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 S1754545AbeEWJSW (ORCPT + 99 others); Wed, 23 May 2018 05:18:22 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:39272 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754395AbeEWJSS (ORCPT ); Wed, 23 May 2018 05:18:18 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 23 May 2018 18:18:17 +0900 Received: from relmlii1.idc.renesas.com (relmlii1.idc.renesas.com [10.200.68.65]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 3CB797060D; Wed, 23 May 2018 18:18:17 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.49,432,1520866800"; d="scan'208";a="280367652" Received: from mail-os2jpn01lp0144.outbound.protection.outlook.com (HELO JPN01-OS2-obe.outbound.protection.outlook.com) ([23.103.139.144]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 23 May 2018 18:18:17 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v022/BI6osfxLde1AyxROyDh2LytvQNLfHXAJAPN7q4=; b=KZti6XVw4t8YsNmTfeT6NVXpQJYk8nmIrwM6YztQN2I0NzS9KM6CzkRGXnbhhOUGnN8CQz8xa+WJkjHkP9D37lSwYbjM5ZEaeoRIbwYfIj5qvXHEzN+SC2e+mP+oY2kjiKNMmMyW0KDiiokRbW3XzGOpiTytbjPkMfyCkXkFuu4= Received: from TY1PR01MB1769.jpnprd01.prod.outlook.com (52.133.163.146) by TY1PR01MB1818.jpnprd01.prod.outlook.com (52.133.163.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Wed, 23 May 2018 09:18:11 +0000 Received: from TY1PR01MB1769.jpnprd01.prod.outlook.com ([fe80::40cb:cf0a:7ab6:349f]) by TY1PR01MB1769.jpnprd01.prod.outlook.com ([fe80::40cb:cf0a:7ab6:349f%13]) with mapi id 15.20.0776.015; Wed, 23 May 2018 09:18:11 +0000 From: Phil Edworthy To: Simon Horman CC: Andy Shevchenko , Hoan Tran , Linus Walleij , Lee Jones , Michel Pollet , "linux-gpio@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] gpio: dwapb: Rework support for 1 interrupt per port A GPIO Thread-Topic: [PATCH] gpio: dwapb: Rework support for 1 interrupt per port A GPIO Thread-Index: AQHT8nNx6PyEFcyp+E6A5mI/qUmV+aQ9B2cAgAAAYBA= Date: Wed, 23 May 2018 09:18:11 +0000 Message-ID: References: <1527065564-9127-1-git-send-email-phil.edworthy@renesas.com> <20180523091220.jfguqui75rup5qpl@verge.net.au> In-Reply-To: <20180523091220.jfguqui75rup5qpl@verge.net.au> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=phil.edworthy@renesas.com; x-originating-ip: [193.141.220.21] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;TY1PR01MB1818;7:AvT3+a+RR1NtNiZB+4MQjbZbpyFPnWoxAY6beVQxbZZ2jGIRxJyPDPr6eqeLweUs9fM5mq8uYK78/uTH3QVqHPP08scTkCBpyswYfDE8oqj5TDsPd7Uvd8NaXgFKcefjRQ/UvSG1MHW98nXo9F+kzBnIGQp1/z79ieUNUP1i12Gfo7uAVsGoR7mvpyi+5ebq8/3pRs21XCtv2M6E7ATvRLFI3Sls4B1M9SczjEZzkecgFQA0Z71ZnlPvSlZ9O7N5;20:OxmYHg44aOTse7wJxUTkSmHDe/DeTEWXLMT/ewbhTRBH5Pap7Rygcn6GY/FMs8AVknRJaPjE1WANi2/Il27a5NEJDTeJjX1Vle5XqbQhy5LDIdnap80U06I65+Dbk/Hp7+XPfMCiCxffugeGkPAa327bzWbvN7nY8QCnfYB3pgY= x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:TY1PR01MB1818; x-ms-traffictypediagnostic: TY1PR01MB1818: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:TY1PR01MB1818;BCL:0;PCL:0;RULEID:;SRVR:TY1PR01MB1818; x-forefront-prvs: 06818431B9 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(376002)(366004)(396003)(39380400002)(189003)(199004)(478600001)(25786009)(186003)(229853002)(26005)(53936002)(6506007)(8936002)(68736007)(102836004)(53546011)(3660700001)(8676002)(39060400002)(81156014)(2906002)(81166006)(6916009)(6246003)(7736002)(5660300001)(305945005)(3280700002)(2900100001)(86362001)(66066001)(74316002)(33656002)(97736004)(316002)(99286004)(5250100002)(55016002)(44832011)(486006)(7696005)(11346002)(446003)(6116002)(3846002)(6436002)(76176011)(14454004)(9686003)(106356001)(105586002)(476003)(4326008)(54906003);DIR:OUT;SFP:1102;SCL:1;SRVR:TY1PR01MB1818;H:TY1PR01MB1769.jpnprd01.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: bP51CIA07X7sr1J3SkZ3mHFcs5xuODdPER4SSSpgC4fiZKX0K+IPxnjSVhY/fI/c/UXDHMr0BdHBqehtXXQYYCDqVZ2/T1WYDy8ZBnxr8NwqDxnPMgIK9HHBC/W7K93yx5WZjNEOULCs5UmHp42KbsgJbMFBpF/4V1Mh1U0x5OBjDRjKgpV7dDlGvm0Fc209 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 3ae5d2b9-b788-4757-255c-08d5c08e1b2d X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ae5d2b9-b788-4757-255c-08d5c08e1b2d X-MS-Exchange-CrossTenant-originalarrivaltime: 23 May 2018 09:18:11.4438 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1PR01MB1818 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Simon, On 23 May 2018 10:12 Simon Horman wrote: > On Wed, May 23, 2018 at 09:52:44AM +0100, Phil Edworthy wrote: > > Treat DT and ACPI the same as much as possible. Note that we can't use > > platform_get_irq() to get the DT interrupts as they are in the port > > sub-node and hence do not have an associated platform device. > > > > This also fixes a problem introduced with error checking when calling > > platform_get_irq(). >=20 > What is the problem? In general I think fixes should be in separate patch= es. The ACPI code would ignore errors returned by platform_get_irq(), instead treating the error as an interrupt number. Andy Shevchenko provided some late feedback to the v5 patch, but v5 was=20 already applied by Linus W. This patch just has the incremental changes tha= t were made in v6 of the patch. BR Phil > > > > Signed-off-by: Phil Edworthy > > --- > > drivers/gpio/gpio-dwapb.c | 53 > > ++++++++++++++++++++--------------------------- > > 1 file changed, 22 insertions(+), 31 deletions(-) > > > > diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c > > index 7dcd06b..15b4154 100644 > > --- a/drivers/gpio/gpio-dwapb.c > > +++ b/drivers/gpio/gpio-dwapb.c > > @@ -444,7 +444,7 @@ static void dwapb_configure_irqs(struct > dwapb_gpio *gpio, > > int i; > > > > for (i =3D 0; i < pp->ngpio; i++) { > > - if (pp->irq[i]) > > + if (pp->irq[i] >=3D 0) > > irq_set_chained_handler_and_data(pp- > >irq[i], > > dwapb_irq_handler, gpio); > > } > > @@ -562,7 +562,7 @@ dwapb_gpio_get_pdata(struct device *dev) > > struct dwapb_platform_data *pdata; > > struct dwapb_port_property *pp; > > int nports; > > - int i; > > + int i, j; > > > > nports =3D device_get_child_node_count(dev); > > if (nports =3D=3D 0) > > @@ -580,6 +580,8 @@ dwapb_gpio_get_pdata(struct device *dev) > > > > i =3D 0; > > device_for_each_child_node(dev, fwnode) { > > + struct device_node *np =3D NULL; > > + > > pp =3D &pdata->properties[i++]; > > pp->fwnode =3D fwnode; > > > > @@ -599,46 +601,35 @@ dwapb_gpio_get_pdata(struct device *dev) > > pp->ngpio =3D 32; > > } > > > > + pp->irq_shared =3D false; > > + pp->gpio_base =3D -1; > > + > > /* > > * Only port A can provide interrupts in all configurations of > > * the IP. > > */ > > - if (dev->of_node && pp->idx =3D=3D 0 && > > - fwnode_property_read_bool(fwnode, > > - "interrupt-controller")) { > > - struct device_node *np =3D to_of_node(fwnode); > > - unsigned int j; > > - > > - /* > > - * The IP has configuration options to allow a single > > - * combined interrupt or one per gpio. If one per > gpio, > > - * some might not be used. > > - */ > > - for (j =3D 0; j < pp->ngpio; j++) { > > - int irq =3D of_irq_get(np, j); > > - if (irq < 0) > > - continue; > > - > > - pp->irq[j] =3D irq; > > - pp->has_irq =3D true; > > - } > > + if (pp->idx !=3D 0) > > + continue; > > > > - if (!pp->has_irq) > > - dev_warn(dev, "no irq for port%d\n", pp- > >idx); > > + if (dev->of_node && fwnode_property_read_bool(fwnode, > > + "interrupt-controller")) { > > + np =3D to_of_node(fwnode); > > } > > > > - if (has_acpi_companion(dev) && pp->idx =3D=3D 0) { > > - unsigned int j; > > + for (j =3D 0; j < pp->ngpio; j++) { > > + pp->irq[j] =3D -ENXIO; > > > > - for (j =3D 0; j < pp->ngpio; j++) { > > + if (np) > > + pp->irq[j] =3D of_irq_get(np, j); > > + else if (has_acpi_companion(dev)) > > pp->irq[j] =3D > platform_get_irq(to_platform_device(dev), j); > > - if (pp->irq[j]) > > - pp->has_irq =3D true; > > - } > > + > > + if (pp->irq[j] >=3D 0) > > + pp->has_irq =3D true; > > } > > > > - pp->irq_shared =3D false; > > - pp->gpio_base =3D -1; > > + if (!pp->has_irq) > > + dev_warn(dev, "no irq for port%d\n", pp->idx); > > } > > > > return pdata; > > -- > > 2.7.4 > >