From patchwork Fri Jan 10 13:02:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 3466081 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 213299F382 for ; Fri, 10 Jan 2014 13:03:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D8B812012B for ; Fri, 10 Jan 2014 13:03:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F0EAA20127 for ; Fri, 10 Jan 2014 13:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751618AbaAJNDI (ORCPT ); Fri, 10 Jan 2014 08:03:08 -0500 Received: from fallback5.mail.ru ([94.100.176.59]:58126 "EHLO fallback5.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751303AbaAJNDH (ORCPT ); Fri, 10 Jan 2014 08:03:07 -0500 Received: from smtp20.mail.ru (smtp20.mail.ru [94.100.176.173]) by fallback5.mail.ru (mPOP.Fallback_MX) with ESMTP id 20715108D115C for ; Fri, 10 Jan 2014 17:02:22 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Message-Id:Date:Subject:Cc:To:From; bh=1V3tCqq2WGO8Gwz7u1Wp4DZ6KVLWXr3deb+GJ4AwSIY=; b=qwL4zT+QRBCjwvkcvivah90Iw86702drZ4SDcoPKFtwmFzl6wvsz8ln26LK36dmTbAQ3HFvT+1e1xpFMYI8rjzrL+iytkkFu41inbnUYPKzVFdC3VqJP3n2IDqCEcswUoX1fS4bnL+OOOpwcNonoKxKu6KO8l7rpWcLDqODzPHU=; Received: from [188.134.40.128] (port=24315 helo=shc.zet) by smtp20.mail.ru with esmtpa (envelope-from ) id 1W1biz-0007t7-M6; Fri, 10 Jan 2014 17:02:09 +0400 From: Alexander Shiyan To: linux-spi@vger.kernel.org Cc: Mark Brown , Alexander Shiyan Subject: [PATCH] spi: clps711x: Use devm_gpio_request() Date: Fri, 10 Jan 2014 17:02:05 +0400 Message-Id: <1389358925-466-1-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.3.2 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Mras: Ok Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RDNS_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch replaces gpio_request() with devm_ API. As a result this simplifies error path and eliminates "remove" function. Signed-off-by: Alexander Shiyan --- drivers/spi/spi-clps711x.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c index 6f03d7e..dafb243 100644 --- a/drivers/spi/spi-clps711x.c +++ b/drivers/spi/spi-clps711x.c @@ -1,7 +1,7 @@ /* * CLPS711X SPI bus driver * - * Copyright (C) 2012 Alexander Shiyan + * Copyright (C) 2012-2014 Alexander Shiyan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -198,7 +198,7 @@ static int spi_clps711x_probe(struct platform_device *pdev) ret = -EINVAL; goto err_out; } - if (gpio_request(hw->chipselect[i], DRIVER_NAME)) { + if (devm_gpio_request(&pdev->dev, hw->chipselect[i], NULL)) { dev_err(&pdev->dev, "Can't get CS GPIO %i\n", i); ret = -EINVAL; goto err_out; @@ -240,35 +240,17 @@ static int spi_clps711x_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Failed to register master\n"); err_out: - while (--i >= 0) - if (gpio_is_valid(hw->chipselect[i])) - gpio_free(hw->chipselect[i]); - spi_master_put(master); return ret; } -static int spi_clps711x_remove(struct platform_device *pdev) -{ - int i; - struct spi_master *master = platform_get_drvdata(pdev); - struct spi_clps711x_data *hw = spi_master_get_devdata(master); - - for (i = 0; i < master->num_chipselect; i++) - if (gpio_is_valid(hw->chipselect[i])) - gpio_free(hw->chipselect[i]); - - return 0; -} - static struct platform_driver clps711x_spi_driver = { .driver = { .name = DRIVER_NAME, .owner = THIS_MODULE, }, .probe = spi_clps711x_probe, - .remove = spi_clps711x_remove, }; module_platform_driver(clps711x_spi_driver);