Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1068026ybl; Tue, 3 Dec 2019 00:52:25 -0800 (PST) X-Google-Smtp-Source: APXvYqxjkKLpEA7vFZElRHawImSNR1BagIM3qEkGQ1VHL7xm5Xe036KRIWYcmwIq+itoBGgXMV+/ X-Received: by 2002:a05:6808:b2d:: with SMTP id t13mr2712518oij.83.1575363145830; Tue, 03 Dec 2019 00:52:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575363145; cv=none; d=google.com; s=arc-20160816; b=ZNno1bmV7u++gSi4gYvM0BvfwvyHlnda/+6Ys5bbKPoOuPNrld5kTJ80jGLGzrJgxE 4x4wFNgzR8Ig9pELHG9icHXOxkyxfECh/3EtTut8cjy8gAmC3ednFkZ5Z7B626mij4wF mpkS2W5G+jNc11oWr8Is8YW8LsgubjxMjH1Oo73Svpce/VBFc6PYnUB9GFc4HhZS/5zx +/vP5Ze4h9oKF74M+DqOp+jzImiaLi0JSxPQ5C/fJeQdQwYLHOYHbxtfxalP7mdgOY1w xfvlYFpoWsZlsRhV0Kzrbgm/aqS5EIObkYAOnOQ7R2LXcjdbXRH/PpE9ryfzY8Cwrn2y +MwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=CfX7T2SHGMmVcLnHD7mwiN5pyr9gJZOfxGyVxxAOZL0=; b=zuZJjSVXmLxbY/Si/k8tGQ2hIgNGnxlyq9gXNGk3jBRoZjXwqwh7mCLBZRTELZuA4g 4vcLPVlNNHE0yBd2vjcgNZ9mK8uKUNrPCLOYWd/qmBPEDUk6/4tTCJ7CnelhecDxTW/D DBZCu9rSOJucxF32ZCebdff12hoTaxic9bd8CuZ6HIC3SsZPSPOeQbr1nyK7qoJwuQI1 f8GsXuAI2CP4V62IBBZ5NRJnsoSIEwFSSnOYIWS6iwtMeIZSTGtwkKfF68n8cBSeuVVV dLtFdq25LnkoArkMkr8fm9ZuRr31UptSAfGuA0R2agKNwGMVWxe/ZWylgnMBv8l6YKTW 69Dg== 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 e134si954280oib.216.2019.12.03.00.52.13; Tue, 03 Dec 2019 00:52:25 -0800 (PST) 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 S1726066AbfLCIvf (ORCPT + 99 others); Tue, 3 Dec 2019 03:51:35 -0500 Received: from esa1.mentor.iphmx.com ([68.232.129.153]:63297 "EHLO esa1.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725773AbfLCIve (ORCPT ); Tue, 3 Dec 2019 03:51:34 -0500 IronPort-SDR: dsSR1wFM82w41QEe91uCLCS3a93jGz8SCMS1FIQofYoPqq9j2vabdlMnkkUnO85HGlOE3JlEWx hxZzpZh/lfzIdFDWw1Li1pvIT8RCb1JqeuWvpdSjEtjz06NWapo6dAdKmHkbsCB09eUqGJrEEW 5dDpCEyM5CAwO8OxKNrGBjQGqSC2WDdqJPOVcL1IwxvsYX7a9svPcg0UwfrgXWpCB6LFjHu6fZ HEHTIKV5Mabg+/ydxLFir7TdQp1aPxfB5g6X0OGItiVvdrVchRx3M1Nq5MB0RwkDJWk4BCtyVp 7+w= X-IronPort-AV: E=Sophos;i="5.69,272,1571731200"; d="scan'208";a="45593533" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 03 Dec 2019 00:51:33 -0800 IronPort-SDR: V31aPAlTL4Jd77N/4vFkI/ULg0cF5PBYkzlUKlSwB5TqW2oengXeZXGIIUezjAPeS45uGXetRj k8fdcbh6lAth0z2rEc/o8A8Yjx1Gs9FJcj8ClHn/v7e9trEbTEqyktunDgxc+NGMNzDE3uUt+H tVPkPMHeGKWmqIn4OYYFVSQrHux/WyXhsdu22AjmEmoi5aXIBAP1OBiJIM2OD+5+c39ZCXjbpa 5nlSWx1IxowCPCDsJce0jzoNxMJv4XdCFGcMxbpF2S+x4ddCnnoky/Je4mZZIOCotBY7rKE4oJ 6+w= Subject: Re: [PATCH v3 5/7] gpio: Add GPIO Aggregator/Repeater driver To: Geert Uytterhoeven CC: Geert Uytterhoeven , Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Rob Herring , Mark Rutland , Eugeniu Rosca , Alexander Graf , Peter Maydell , Paolo Bonzini , Phil Reid , Marc Zyngier , Christoffer Dall , Magnus Damm , "open list:GPIO SUBSYSTEM" , "open list:DOCUMENTATION" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux-Renesas , Linux Kernel Mailing List , QEMU Developers References: <20191127084253.16356-1-geert+renesas@glider.be> <20191127084253.16356-6-geert+renesas@glider.be> <585c4ad9-31fc-e87e-07c4-b8d6aa09c7e4@mentor.com> From: Harish Jenny K N Message-ID: Date: Tue, 3 Dec 2019 14:21:21 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-05.mgc.mentorg.com (139.181.222.5) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/12/19 1:47 PM, Geert Uytterhoeven wrote: > Hi Harish, > > On Tue, Dec 3, 2019 at 6:42 AM Harish Jenny K N > wrote: >>> +static int gpio_aggregator_probe(struct platform_device *pdev) >>> +{ >>> + struct device *dev = &pdev->dev; >>> + struct gpio_desc **descs; >>> + struct gpiochip_fwd *fwd; >>> + int i, n; >>> + >>> + n = gpiod_count(dev, NULL); >>> + if (n < 0) >>> + return n; >>> + >>> + descs = devm_kmalloc_array(dev, n, sizeof(*descs), GFP_KERNEL); >>> + if (!descs) >>> + return -ENOMEM; >>> + >>> + for (i = 0; i < n; i++) { >>> + descs[i] = devm_gpiod_get_index(dev, NULL, i, GPIOD_ASIS); >> can you please add this check as well as we need to return EPROBE_DEFER. >> >> if (desc[i] == ERR_PTR(-ENOENT)) >> < return -EPROBE_DEFER; > So gpiod_get_index() nevers return -EPROBE_DEFER, but returns -ENOENT > instead? > How can a driver distinguish between "GPIO not found" and "gpiochip driver > not yet initialized"? > Worse, so the *_optional() variants will return NULL in both cases, too, so > the caller will always fall back to optional GPIO not present? > > Or am I missing something? > > Gr{oetje,eeting}s, > > Geert We had earlier tested our changes on 4.14 kernel and the explicit return of -EPROBE_DEFER was needed in the inverter driver. probably the commit 6662ae6af82df10259a70c7569b4c12ea7f3ba93 ( gpiolib: Keep returning EPROBE_DEFER when we should) has fixed the issue and now it returns -EPROBE_DEFER.  you can ignore this comment as of now. I will test and let you know if needed. Thanks, Harish