From patchwork Sun Jan 12 07:33:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3470931 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8FDD4C02DC for ; Sun, 12 Jan 2014 07:33:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B43EE2012F for ; Sun, 12 Jan 2014 07:33:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D8F732012B for ; Sun, 12 Jan 2014 07:33:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751025AbaALHdr (ORCPT ); Sun, 12 Jan 2014 02:33:47 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:53983 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751003AbaALHdq (ORCPT ); Sun, 12 Jan 2014 02:33:46 -0500 Received: by mail-pa0-f43.google.com with SMTP id bj1so1906407pad.16 for ; Sat, 11 Jan 2014 23:33:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=LR1POGvq70V0on3cz1zEtEp4+RCYcayHSBPlJXkRIUQ=; b=cLCaVgTGIxmUDFwLrgiOmX653PXWUgyivKbHp1vFNXmHlah0ZYQd+pjGQpgiB9OxPv ZZvTUguQYgEfJZ2yYEep2dxPRn0lyXl4NiVrt+xbv6eeD768xMIcLJSkiN80LxugkUAN 2W7qtE0iYxUnoJynV3XLgW7NGzOWDycW5sj478CTFokhJf7Ey2WoJ2eCJ4mfaCNe4NEI eMHWrSyAiX155+W21o1LBhrZ6K1hbzUQGaaATw3bLJ+4oVBJK8LAVvyZruRs+MmZVi0p apKOcXc+MdDzeVc+038iikOeISw2qWFkoahCkvt0Q6o1VKkdf8fhG4ajmTEmnjes04YX /AMQ== X-Gm-Message-State: ALoCoQkFi238vtzyGN7Svjf0thL0MaNLBNtpfjEmidyY93GB9lcuizh7n9yrBs3OweCTYxXDJM3D X-Received: by 10.68.66.1 with SMTP id b1mr22238921pbt.43.1389512026237; Sat, 11 Jan 2014 23:33:46 -0800 (PST) Received: from [192.168.0.102] (218-164-139-128.dynamic.hinet.net. [218.164.139.128]) by mx.google.com with ESMTPSA id oa3sm29141442pbb.15.2014.01.11.23.33.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 11 Jan 2014 23:33:45 -0800 (PST) Message-ID: <1389512019.13361.6.camel@phoenix> Subject: [PATCH] spi: clps711x: Convert to devm_gpio_request() From: Axel Lin To: Mark Brown Cc: Alexander Shiyan , linux-spi@vger.kernel.org Date: Sun, 12 Jan 2014 15:33:39 +0800 X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Also drop unneeded gpio_is_valid() call, the checking is done in the implementation of gpio_request(). With this conversion, then we can also remove spi_clps711x_remove(). Signed-off-by: Axel Lin --- drivers/spi/spi-clps711x.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c index 6f03d7e..45a7619 100644 --- a/drivers/spi/spi-clps711x.c +++ b/drivers/spi/spi-clps711x.c @@ -193,12 +193,8 @@ static int spi_clps711x_probe(struct platform_device *pdev) for (i = 0; i < master->num_chipselect; i++) { hw->chipselect[i] = pdata->chipselect[i]; - if (!gpio_is_valid(hw->chipselect[i])) { - dev_err(&pdev->dev, "Invalid CS GPIO %i\n", i); - ret = -EINVAL; - goto err_out; - } - if (gpio_request(hw->chipselect[i], DRIVER_NAME)) { + if (devm_gpio_request(&pdev->dev, hw->chipselect[i], + DRIVER_NAME)) { dev_err(&pdev->dev, "Can't get CS GPIO %i\n", i); ret = -EINVAL; goto err_out; @@ -240,35 +236,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);