Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp454038pxv; Wed, 30 Jun 2021 09:18:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdDFXZl4N6xos6yaNGnrBQJdz70IKI+k/w4GO/pBARnHEChc9UIwt1555QwQy53bBp9FKR X-Received: by 2002:a05:6402:2898:: with SMTP id eg24mr47457906edb.155.1625069884373; Wed, 30 Jun 2021 09:18:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625069884; cv=none; d=google.com; s=arc-20160816; b=PlDec/WOKpB+Wn+LRjRGOHhwMbOniEnc60VEb7qFhaMPpNSVOw5LIMEHBJqEaNrqWr hzc1fqqETxbJwOcF/Fi6JBtj9K9VHAHQRo/t3pPuJEJxP7HGASlcc5pbgLte0ydcF9TO qHhAoe1v65x4LebIvNTd+iwbEX/F7oa2XFSkiGQADTODvnFt59sGqGQUfM4KK2GjOa0W TVMqEj9oecDzeCOer+ah5B3UKDAGXzYMtyByth4LqfH8ZyLh5e78bRTWAUi0aXLk54uF 0YNh7UuHS6ZFTZ4LfvV2KCofhHCegpAAK47hrxlgFmE5iN7IlXi6mmTnZwaQlsGQtE5L tNrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=QgAvMFP+qrxfjOSSdXRrrMLtbz84Nhwtu91bshNexkw=; b=0mV3ZbIf2TJT6pJxeYqZOXWFptmzQeJ3/vAw30NuOtGwmZAVsFElD81gmk8X3OpaeD t9mqxVrCROeQBYju/sfoO6d4Hds4kmnajfMeY0AJftRzIqzEdxm7h3H3zf87CHLGDPtU G8xMAlE1vBsF65Z9N1zmiPmq7cYCvoxZ4JK3dy4GAtM+vbW8IinEqblsYPB9IOWuXcBv NXxp6HdGHEZmMneeq6vlgItDqVE2P8pmLNveNvK/mkrryFf9+ehdneayzhvmhFtafD76 PzwUJGqX8iaxNSLe3HZl+uXH/b0GVwwhOu2uR2BERTazdqxtwQNcRLAt1ECa+lYg9rss 4e7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Mm3Fgkgh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ar12si19614361ejc.265.2021.06.30.09.17.35; Wed, 30 Jun 2021 09:18:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Mm3Fgkgh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbhF3QRR (ORCPT + 99 others); Wed, 30 Jun 2021 12:17:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbhF3QRR (ORCPT ); Wed, 30 Jun 2021 12:17:17 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6882DC061756; Wed, 30 Jun 2021 09:14:48 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id x16so2864207pfa.13; Wed, 30 Jun 2021 09:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QgAvMFP+qrxfjOSSdXRrrMLtbz84Nhwtu91bshNexkw=; b=Mm3FgkghzO+j1nGqCHtJiFFm3dZgDyQbN0FI5Hwgzq4XYxSBvsmCl9p5uigkj0/M7/ E67LJnfBWZNq69WoZjq8Mi/Fb7OZXZn3tXGdtsYMpOeciRWx8Bqhmrcc5WM9Dda0p0GE M/4I5Rmejm71VcN/4d8y9bP6LbgNGkzNzlj3Iy8dxlaPUeFD8l8bmy3iYvlC041ASauY zUhCsFg1L7ZBT7BO1vjt14LPUOyAnsHT7jxGIQveOaRXh8Lg657CwFp+LQW9I6eU/9O5 a3RBom3Qwn52WeO6skY8Qt8jMflDKyx73ApHX2BTtU4cqKH343yG7mqHtxzPB4qo8XTZ 4D3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QgAvMFP+qrxfjOSSdXRrrMLtbz84Nhwtu91bshNexkw=; b=a+SWvS6yXv18LW6/qMPXNvqm6MDGVu+VWDNSSO4iJN7SoPmpog0uHaHxlZfMFzobtr kwQAOzpFvY0z8MmWAOPbi3IJeb3NxzLbRdror2Sn/SGY4U6bgY7TjUT+sFEnSMjkuoyZ UrrRgSfZQQgmmrobcjwWfjfQMf617Fz8b26Oj+4+JAnA1Q6m5yqgtZoAQe99oftWlRNS kFri+K80IuqZ9YPivSPezp1Cic8+2qrC0Xe9YnqXBguk0XpCiQOrtPWNmCLfi7JHJIwl x2aUg02wKMkE6W36d92P+S/EvoIeU1G59ARIcxJqqOFeF5Te0U1TdcjyXlkWudC9xMQq H7Tg== X-Gm-Message-State: AOAM531uvpoHulgnCvc++HGt49xsealREQQf0xMHh4nbGBtyjtp4oOyM pzoo9SA1xcSPLJo1UJZoY3MlsCXlNbjyQsYTKyA= X-Received: by 2002:a05:6a00:2ad:b029:303:41fb:41d7 with SMTP id q13-20020a056a0002adb029030341fb41d7mr36321202pfs.7.1625069687894; Wed, 30 Jun 2021 09:14:47 -0700 (PDT) MIME-Version: 1.0 References: <1624288089-15278-1-git-send-email-akhilrajeev@nvidia.com> In-Reply-To: <1624288089-15278-1-git-send-email-akhilrajeev@nvidia.com> From: Andy Shevchenko Date: Wed, 30 Jun 2021 19:14:10 +0300 Message-ID: Subject: Re: [PATCH v2] gpio: tegra186: Add ACPI support To: Akhil R Cc: Bartosz Golaszewski , Jon Hunter , Krishna Yarlagadda , Laxman Dewangan , Linus Walleij , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , linux-tegra , Mikko Perttunen , Suresh Mangipudi , Thierry Reding Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 21, 2021 at 6:07 PM Akhil R wrote: > >What about doing like > > > gpio->secure = devm_platform_ioremap_resource_byname(pdev, "security"); > > if (IS_ERR(gpio->secure)) > > gpio->secure = devm_platform_ioremap_resource(pdev, 0); > > if (IS_ERR(gpio->secure)) > > return PTR_ERR(gpio->secure); > > > >and similar for gpio->base? > > Wouldn't this cause a redundant check if it had already succeeded in getting > the resource by name? Also, could it happen that if the device tree is > incorrect, then one of the resource is fetched by name and other by the index, > which I guess, would mess things up. Just my random thoughts, not sure if it > is valid enough. > > >Wouldn't the following be enough? > > > >- gpio->intc.name = pdev->dev.of_node->name; > >+ gpio->intc.name = devm_kasprintf(&pdev->dev, "%pfw", > >dev_fwnode(&pdev->dev)); > >+ if (!gpio->intc.name) > >+ > > How about this way? I feel it would be right to add the OF functions conditionally. Looks okay, although I have a question here. > + if (pdev->dev.of_node) { Do we really need this check at all? If the OF-node is NULL then it doesn't matter if other fields are filled or not, correct? What you need is #ifdef CONFIG_OF_GPIO (IIRC the name correctly). > + gpio->gpio.of_node = pdev->dev.of_node; > + gpio->gpio.of_gpio_n_cells = 2; > + gpio->gpio.of_xlate = tegra186_gpio_of_xlate; > + } > > + gpio->intc.name = gpio->soc->name; -- With Best Regards, Andy Shevchenko