From patchwork Mon Mar 10 00:01:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3800881 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 5FB9BBF540 for ; Mon, 10 Mar 2014 00:01:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8268120394 for ; Mon, 10 Mar 2014 00:01:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 99E8020395 for ; Mon, 10 Mar 2014 00:01:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752277AbaCJABv (ORCPT ); Sun, 9 Mar 2014 20:01:51 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:56679 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751833AbaCJABu (ORCPT ); Sun, 9 Mar 2014 20:01:50 -0400 Received: by mail-pa0-f49.google.com with SMTP id lj1so6455738pab.22 for ; Sun, 09 Mar 2014 17:01:50 -0700 (PDT) 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=pB/UxuXC7YL+z96ZbsfzBVBcgtzrbnt2nW6ojkJ5G+4=; b=MvOTEYBUHzAeupisDuX3QEMkjaR21cwfF6D3lyq6GZhNjv2TU03LVjWtmK5mjhhuoq plJHrPzg5dqJ6PgXayKCdYQrUrJYt4QI0MjhRA6PmX59ZQGXvbvw75MkcQvlmkfe9On1 6zLicroMHM7Wv4aSVFdZMNOAGAC5wFAwL8sLd1GgaCOiTIXqvHe+FFdpIqsDxUfypokL VoJkL0cNU5L09LD9MPrAWamg2AAtOotVaFjhrPnJwIzTcndS19H0ANkTZeCuQFUI1uG3 6zCK1AVCL4zl9ON9nKybBWwAsHJ1uHaNqPiiwd9cixcdUkrkjr7NfrLf1ogPTkVtow7G +Egg== X-Gm-Message-State: ALoCoQmAHXwxIc1D0o0Zin7YwKdIb0ztqAlBQVUJ51d+6FwqbbrWewb7Y6KNdHr3hdFEjrt5i8Sk X-Received: by 10.67.22.100 with SMTP id hr4mr36348234pad.112.1394409710080; Sun, 09 Mar 2014 17:01:50 -0700 (PDT) Received: from [192.168.0.102] (36-239-221-20.dynamic-ip.hinet.net. [36.239.221.20]) by mx.google.com with ESMTPSA id vx10sm67206492pac.17.2014.03.09.17.01.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 09 Mar 2014 17:01:49 -0700 (PDT) Message-ID: <1394409705.12514.2.camel@phoenix> Subject: [PATCH] spi: efm32: Clean up non-DT paths From: Axel Lin To: Mark Brown Cc: Uwe =?ISO-8859-1?Q?Kleine-K=F6nig?= , linux-spi@vger.kernel.org Date: Mon, 10 Mar 2014 08:01:45 +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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 This is a DT-only driver, so remove all non-DT paths. Signed-off-by: Axel Lin --- drivers/spi/spi-efm32.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/drivers/spi/spi-efm32.c b/drivers/spi/spi-efm32.c index f53bbea..26e0362 100644 --- a/drivers/spi/spi-efm32.c +++ b/drivers/spi/spi-efm32.c @@ -294,9 +294,6 @@ static int efm32_spi_probe_dt(struct platform_device *pdev, u32 location; int ret; - if (!np) - return 1; - ret = of_property_read_u32(np, "location", &location); if (!ret) { dev_dbg(&pdev->dev, "using location %u\n", location); @@ -318,9 +315,14 @@ static int efm32_spi_probe(struct platform_device *pdev) int ret; struct spi_master *master; struct device_node *np = pdev->dev.of_node; - unsigned int num_cs, i; + int num_cs, i; + + if (!np) + return -EINVAL; num_cs = of_gpio_named_count(np, "cs-gpios"); + if (num_cs < 0) + return num_cs; master = spi_alloc_master(&pdev->dev, sizeof(*ddata) + num_cs * sizeof(unsigned)); @@ -412,23 +414,7 @@ static int efm32_spi_probe(struct platform_device *pdev) goto err; } - ret = efm32_spi_probe_dt(pdev, master, ddata); - if (ret > 0) { - /* not created by device tree */ - const struct efm32_spi_pdata *pdata = - dev_get_platdata(&pdev->dev); - - if (pdata) - ddata->pdata = *pdata; - else - ddata->pdata.location = - efm32_spi_get_configured_location(ddata); - - master->bus_num = pdev->id; - - } else if (ret < 0) { - goto err_disable_clk; - } + efm32_spi_probe_dt(pdev, master, ddata); efm32_spi_write32(ddata, 0, REG_IEN); efm32_spi_write32(ddata, REG_ROUTE_TXPEN | REG_ROUTE_RXPEN |