Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp937808ybl; Mon, 2 Dec 2019 21:43:31 -0800 (PST) X-Google-Smtp-Source: APXvYqwyxQVrHvEGc3D1qPtJKMeQ6sz1R6TwpDGXP6t9SQeyI25jQ5i6r8/s/2Owk/4E5gZRKWrr X-Received: by 2002:a9d:1b3:: with SMTP id e48mr2061664ote.341.1575351810903; Mon, 02 Dec 2019 21:43:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575351810; cv=none; d=google.com; s=arc-20160816; b=ZaAH23C3kgWfmRkdrzYhEtq5zzcaFkgEsbRkUG/FY+bz+2VZz9+K5e6Agq1FRIJD6p oWW4dZERmr5q/13rxb6cCZQE2VNV7mT1aSjFUhi2T4IqSc/mrTihpJf9FXS7qkqZ3AVB +IkD+5fV7IlaxMgQTDy6+D0vQJbLSnEyzvc7ejxYPLzwvswTPzz3daDHOZhdK8VWDGyM btekd08cgAQg4yZWo3RSHjg2okMwfh21EnrbEyUpdcwmQc38bODIjPKTPrQ6ciYyoczn pmEB/R9TGyGpNTWg6FjFlIvbyaC1EIv0bjXLzkWsQ6nIURHYlOOSHg3YGDzro4IF2/zr 6YvQ== 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=eYFM9X8yjBpeiu3387AOAF9+DGVaq+qbGnMrNvkS/UM=; b=px/NG3Mkzwl8K4KFKikVfKnWvuMOXdvjvOGMmsTNgsFvjOONN5B7EdVYN5+1vy2WET MbPHoaQzJxC1zVrAAYjJ78PT7agSOdymFD7PrrtZWCJKMIJUG2xzHy52maXbGviQaEkH b6X5u54TCAd3vCBAdJF+VvsXGCsh6OiD+WtfpiDzv5PG5he+TEAz8m+aik7Ahp0qymQr /o928Bs4FTRN+iADukORuIcnKp3MDEMTP3GB2c8Cdkz5o5raSqeVTRufB/2Rv+NYZUBi ducW8fbOOdbkxzZ6VcKtUD/oMDbcUL2QNUjAnLTLhvQZrLlkzPy04suXdNH43aazRhfM fP7A== 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 t142si790787oih.242.2019.12.02.21.43.18; Mon, 02 Dec 2019 21:43:30 -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 S1726991AbfLCFmv (ORCPT + 99 others); Tue, 3 Dec 2019 00:42:51 -0500 Received: from esa1.mentor.iphmx.com ([68.232.129.153]:55187 "EHLO esa1.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725907AbfLCFmu (ORCPT ); Tue, 3 Dec 2019 00:42:50 -0500 IronPort-SDR: 1d3cbX4jmGzyde8PjnivFnq6fHbKai6sEc2kaYive6h0RWkvQ9drIjeWjGmvYIS4gVLu+D52Pt +VI56eTKrIhDRNQIZWo3o+GjrnShHDSZy+DLArkSlkFA3JQmurvLnvMKyv9EK1EweKjyav/4Lj 8WSSo3b/Vv9QQM0ZMJuQ0P3Vcq1cvwcSXLOWUxweHnwpl4EJ+GLaUPURonYjl83Ysy5YEpAkRn 5niHbKsU2PiUqGbla+ej3PYmfz0hPgFw7+mp8m4s46N6dQ3TGTi3TScTUpnXcLRWk8/nNc706n aTM= X-IronPort-AV: E=Sophos;i="5.69,272,1571731200"; d="scan'208";a="45589576" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 02 Dec 2019 21:42:50 -0800 IronPort-SDR: 6qW7kvfV2RJQ+o/o5f2nDujbmBSwumb85KO+OiaQHueozhtxi3wK5lBcFsz8N2dtJn1QT92VPT Qgv43tx44fcY6bo6t1sgDkAQ2/TB6bY50B/bcNaNCkLbDDm0xne8hal71H0BF7iCi91KHq8gYV l4H+1KNiIKYYMMtq23CtXeCb0XUbkF3MqlcarsOUStxXqUmileh72a7vzHfPC790pHde63/MTs gsV2+TivzEA3wls2h/41pYkDHtbxnyvWVV/rC52Hep9lVTvn/oImikOQ6lqgMEgARN2n4oTAx6 phw= Subject: Re: [PATCH v3 5/7] gpio: Add GPIO Aggregator/Repeater driver To: Geert Uytterhoeven , Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Rob Herring , Mark Rutland , Eugeniu Rosca CC: Alexander Graf , Peter Maydell , Paolo Bonzini , Phil Reid , Marc Zyngier , Christoffer Dall , Magnus Damm , , , , , , References: <20191127084253.16356-1-geert+renesas@glider.be> <20191127084253.16356-6-geert+renesas@glider.be> From: Harish Jenny K N Message-ID: <585c4ad9-31fc-e87e-07c4-b8d6aa09c7e4@mentor.com> Date: Tue, 3 Dec 2019 11:12:38 +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: <20191127084253.16356-6-geert+renesas@glider.be> 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-08.mgc.mentorg.com (139.181.222.8) 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 > +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; > + if (IS_ERR(descs[i])) > + return PTR_ERR(descs[i]); > + } > + > + fwd = gpiochip_fwd_create(dev, n, descs); > + if (IS_ERR(fwd)) > + return PTR_ERR(fwd); > + > + platform_set_drvdata(pdev, fwd); > + return 0; > +} > + > +#ifdef CONFIG_OF > +static const struct of_device_id gpio_aggregator_dt_ids[] = { > + { .compatible = "gpio-repeater" }, > + /* > + * Add GPIO-operated devices controlled from userspace below, > + * or use "driver_override" in sysfs > + */ > + {}, > +}; > +MODULE_DEVICE_TABLE(of, gpio_aggregator_dt_ids); > +#endif > + > +static struct platform_driver gpio_aggregator_driver = { > + .probe = gpio_aggregator_probe, > + .driver = { > + .name = DRV_NAME, > + .groups = gpio_aggregator_groups, > + .of_match_table = of_match_ptr(gpio_aggregator_dt_ids), > + }, > +}; > + > +static int __init gpio_aggregator_init(void) > +{ > + return platform_driver_register(&gpio_aggregator_driver); > +} > +module_init(gpio_aggregator_init); > + > +static void __exit gpio_aggregator_exit(void) > +{ > + gpio_aggregator_remove_all(); > + platform_driver_unregister(&gpio_aggregator_driver); > +} > +module_exit(gpio_aggregator_exit); > + > +MODULE_AUTHOR("Geert Uytterhoeven "); > +MODULE_DESCRIPTION("GPIO Aggregator/Repeater"); > +MODULE_LICENSE("GPL v2");