From patchwork Tue Jul 18 10:57:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J, KEERTHY" X-Patchwork-Id: 9847861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BE5CB602A7 for ; Tue, 18 Jul 2017 10:57:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C62742854A for ; Tue, 18 Jul 2017 10:57:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAFF128573; Tue, 18 Jul 2017 10:57:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BA63E2854A for ; Tue, 18 Jul 2017 10:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PaBgM2G35nTEgNm61vOTZg0hC/l6doB3dby3eQTacDE=; b=BS0z5OT/BBbcGC OXSZQJuvDrQ3Xm+9BWiMexuBO93zTmAHK6VTNMtDMnd7+yf38X4ONTOzcojFaWlqlXG6uLlnmDFIL Tup1GkNcsE1aZTKNGH15HPEC791q/GIrKwQ/IENCR+ky1tr/Shey23WGHkocBE70hNvK/dGUAKEcU hEe1VOgj6U0VDy1+fVauUv0FaCi569TuUgEj+oMmC78Y8oJa63CXz63+7qgr/DXymuXNHZH0Hjbn1 sebbb9D+qtH/ZoOVXUDany1yOJTsYNBp/x04zLvZd9A7QtIDT6Sf3Qrkq1f3nsZo42rS36oHEtUv1 pzHYusi3RKGmymnahQNQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dXQCP-000795-Ph; Tue, 18 Jul 2017 10:57:53 +0000 Received: from lelnx194.ext.ti.com ([198.47.27.80]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dXQCN-00075y-6e for linux-arm-kernel@lists.infradead.org; Tue, 18 Jul 2017 10:57:52 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v6IAvP71017685; Tue, 18 Jul 2017 05:57:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1500375445; bh=4CVYV70HFwToPR6VIdCVHkWEJWRYPIEEQOCor85ioXE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=C5kEobECWAP1jWwSiO/2sHurJmY0IzXNyF5vssu3ckIwcy0HFIqXKmMcDORp4P1Sa lo9i+i4ZF9+v77xrgqCEwhSsbP63PydbG0PpiHnMtH/EKY3sgJAVY2eWf003VoQMIA n5vaOXIAnlfLPRtHxnE/Ms0ECwJuV1vgpOkttgNU= Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v6IAvPqw024108; Tue, 18 Jul 2017 05:57:25 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.294.0; Tue, 18 Jul 2017 05:57:24 -0500 Received: from ula0393675.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v6IAvGEE010100; Tue, 18 Jul 2017 05:57:21 -0500 From: Keerthy To: , Subject: [PATCH 1/4] gpio: davinci: Use devm_gpiochip_add_data in place of gpiochip_add_data Date: Tue, 18 Jul 2017 16:27:13 +0530 Message-ID: <1500375436-9435-2-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1500375436-9435-1-git-send-email-j-keerthy@ti.com> References: <1500375436-9435-1-git-send-email-j-keerthy@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170718_035751_340740_4A55E0E4 X-CRM114-Status: UNSURE ( 9.43 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, j-keerthy@ti.com, nsekhar@ti.com, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, fcooper@ti.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use the devm version of gpiochip_add_data and pass on the return value. Reset the static variables to 0 before returning. Signed-off-by: Keerthy --- drivers/gpio/gpio-davinci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c index 65cb359..2c88054 100644 --- a/drivers/gpio/gpio-davinci.c +++ b/drivers/gpio/gpio-davinci.c @@ -166,7 +166,7 @@ static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset) static int davinci_gpio_probe(struct platform_device *pdev) { static int ctrl_num, bank_base; - int gpio, bank; + int gpio, bank, ret = 0; unsigned ngpio, nbank; struct davinci_gpio_controller *chips; struct davinci_gpio_platform_data *pdata; @@ -232,7 +232,13 @@ static int davinci_gpio_probe(struct platform_device *pdev) for (gpio = 0, bank = 0; gpio < ngpio; gpio += 32, bank++) chips->regs[bank] = gpio_base + offset_array[bank]; - gpiochip_add_data(&chips->chip, chips); + ret = devm_gpiochip_add_data(dev, &chips->chip, chips); + if (ret) { + ctrl_num = 0; + bank_base = 0; + return ret; + } + platform_set_drvdata(pdev, chips); davinci_gpio_irq_setup(pdev); return 0;