From patchwork Sun Aug 23 12:21:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7057621 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C032E9F373 for ; Sun, 23 Aug 2015 12:23:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DDFC420416 for ; Sun, 23 Aug 2015 12:22:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E90DA203ED for ; Sun, 23 Aug 2015 12:22:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752428AbbHWMW5 (ORCPT ); Sun, 23 Aug 2015 08:22:57 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:34282 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752432AbbHWMWz (ORCPT ); Sun, 23 Aug 2015 08:22:55 -0400 Received: by widdq5 with SMTP id dq5so26612940wid.1 for ; Sun, 23 Aug 2015 05:22:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=LyzbuvdMv2x2H9qyC80gwMNm1d1DZDf47/PqH9EnANg=; b=ECV6To/lfbSJCH/PMVuBlHzbT7ms0yIoS6km6qVLrQpTusg01LVDXGCXf5wOnwSzR9 WXikckD1mB0YqqDRrWXhiqtnYa/hiFUVgIga9/nmBu1j9IOIIXh5lu9hdhxpDakWepcL GWf2Tu2rKd6RL5xBblK5WK3scb4Yi4bbbwpswg60mwb+cJvcAjXv15mqa0yR5B6/8OxK cOjcf/qLkQcU1OBvk8s7lWDS0FZmg/M1vuD0i1mdEyrRu0pCuc6p79ZiefGP7RjqE1wp lUI+7Msl6CInbyzKJWH4sKSWKmD+IrEsmsnG0LmP9SQxKNhPgfTriHAeFbyo8eYYf4TI YkSA== X-Received: by 10.194.63.42 with SMTP id d10mr33493553wjs.92.1440332574059; Sun, 23 Aug 2015 05:22:54 -0700 (PDT) Received: from ?IPv6:2003:62:5f33:d300:2820:d22e:6dc:c1e4? (p200300625F33D3002820D22E06DCC1E4.dip0.t-ipconnect.de. [2003:62:5f33:d300:2820:d22e:6dc:c1e4]) by smtp.googlemail.com with ESMTPSA id vl1sm18512546wjc.0.2015.08.23.05.22.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Aug 2015 05:22:53 -0700 (PDT) Message-ID: <55D9BAE1.1030306@gmail.com> Date: Sun, 23 Aug 2015 14:21:53 +0200 From: Heiner Kallweit User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Mark Brown CC: "linux-spi@vger.kernel.org" Subject: [PATCH 2/3] spi: fsl-(e)spi: simplify cleanup code Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 Now that most cleanup is done automatically the remove functions can be significantly simplified. Signed-off-by: Heiner Kallweit --- drivers/spi/spi-fsl-espi.c | 7 +------ drivers/spi/spi-fsl-lib.c | 15 --------------- drivers/spi/spi-fsl-lib.h | 3 --- drivers/spi/spi-fsl-spi.c | 18 +++++++----------- 4 files changed, 8 insertions(+), 35 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index bfd6259..fdd85be 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -604,10 +604,6 @@ static irqreturn_t fsl_espi_irq(s32 irq, void *context_data) return ret; } -static void fsl_espi_remove(struct mpc8xxx_spi *mspi) -{ -} - static int fsl_espi_suspend(struct spi_master *master) { struct mpc8xxx_spi *mpc8xxx_spi; @@ -670,7 +666,6 @@ static struct spi_master * fsl_espi_probe(struct device *dev, master->unprepare_transfer_hardware = fsl_espi_suspend; mpc8xxx_spi = spi_master_get_devdata(master); - mpc8xxx_spi->spi_remove = fsl_espi_remove; mpc8xxx_spi->reg_base = devm_ioremap(dev, mem->start, resource_size(mem)); @@ -805,7 +800,7 @@ err: static int of_fsl_espi_remove(struct platform_device *dev) { - return mpc8xxx_spi_remove(&dev->dev); + return 0; } #ifdef CONFIG_PM_SLEEP diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c index e50fd06..1e43412 100644 --- a/drivers/spi/spi-fsl-lib.c +++ b/drivers/spi/spi-fsl-lib.c @@ -114,21 +114,6 @@ void mpc8xxx_spi_probe(struct device *dev, struct resource *mem, } EXPORT_SYMBOL_GPL(mpc8xxx_spi_probe); -int mpc8xxx_spi_remove(struct device *dev) -{ - struct mpc8xxx_spi *mpc8xxx_spi; - struct spi_master *master; - - master = dev_get_drvdata(dev); - mpc8xxx_spi = spi_master_get_devdata(master); - - if (mpc8xxx_spi->spi_remove) - mpc8xxx_spi->spi_remove(mpc8xxx_spi); - - return 0; -} -EXPORT_SYMBOL_GPL(mpc8xxx_spi_remove); - int of_mpc8xxx_spi_probe(struct platform_device *ofdev) { struct device *dev = &ofdev->dev; diff --git a/drivers/spi/spi-fsl-lib.h b/drivers/spi/spi-fsl-lib.h index 1326a39..84f5dcb 100644 --- a/drivers/spi/spi-fsl-lib.h +++ b/drivers/spi/spi-fsl-lib.h @@ -54,9 +54,6 @@ struct mpc8xxx_spi { void (*get_rx) (u32 rx_data, struct mpc8xxx_spi *); u32(*get_tx) (struct mpc8xxx_spi *); - /* hooks for different controller driver */ - void (*spi_remove) (struct mpc8xxx_spi *mspi); - unsigned int count; unsigned int irq; diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index fbbab60..b487dab 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -559,11 +559,6 @@ static irqreturn_t fsl_spi_irq(s32 irq, void *context_data) return ret; } -static void fsl_spi_remove(struct mpc8xxx_spi *mspi) -{ - fsl_spi_cpm_free(mspi); -} - static void fsl_spi_grlib_cs_control(struct spi_device *spi, bool on) { struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); @@ -630,7 +625,6 @@ static struct spi_master * fsl_spi_probe(struct device *dev, master->transfer_one_message = fsl_spi_do_one_msg; mpc8xxx_spi = spi_master_get_devdata(master); - mpc8xxx_spi->spi_remove = fsl_spi_remove; mpc8xxx_spi->max_bits_per_word = 32; mpc8xxx_spi->type = fsl_spi_get_type(dev); @@ -862,11 +856,8 @@ static int of_fsl_spi_remove(struct platform_device *ofdev) { struct spi_master *master = platform_get_drvdata(ofdev); struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master); - int ret; - ret = mpc8xxx_spi_remove(&ofdev->dev); - if (ret) - return ret; + fsl_spi_cpm_free(mpc8xxx_spi); if (mpc8xxx_spi->type == TYPE_FSL) of_fsl_spi_free_chipselects(&ofdev->dev); return 0; @@ -912,7 +903,12 @@ static int plat_mpc8xxx_spi_probe(struct platform_device *pdev) static int plat_mpc8xxx_spi_remove(struct platform_device *pdev) { - return mpc8xxx_spi_remove(&pdev->dev); + struct spi_master *master = platform_get_drvdata(pdev); + struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master); + + fsl_spi_cpm_free(mpc8xxx_spi); + + return 0; } MODULE_ALIAS("platform:mpc8xxx_spi");