From patchwork Wed Aug 26 19: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: 7079671 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5A9D8BEEC1 for ; Wed, 26 Aug 2015 19:23:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 016A720967 for ; Wed, 26 Aug 2015 19:23:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD91E2096A for ; Wed, 26 Aug 2015 19:23:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752268AbbHZTXG (ORCPT ); Wed, 26 Aug 2015 15:23:06 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:37853 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751895AbbHZTXF (ORCPT ); Wed, 26 Aug 2015 15:23:05 -0400 Received: by widdq5 with SMTP id dq5so24535273wid.0 for ; Wed, 26 Aug 2015 12:23:04 -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=uU9SD3PxiV4cI/tvrZ5WlDt3UileFKTH0BBI8xyj1ys=; b=iMCnvLuUtY4P/HmpoC84c13bdrIhvvg7N9iyNIHy+m0XtIpatB3J4PnKVueBx0gVnY +O7BR7fxUqP3+LrG8TkcQ6/qgdLfLv4V2Ek7YMzzKbo7bXoGtGXOkXEL4l9gAiW1d0QU I5UHL8ODVtOcnOW5mS/qIvWn7nVwveLyZNP849TagfO3Cihm45ZKvw2qgyoy9erZppx+ KtBniVtaW1OKN1f29PCe+6RcXII0miggAgOX3+DH+mSYK2NGytzX9C51UrBaXkiIqzlH n4MqvfJuhgJAiapj4Qu4CgJ9un8vIcKw1/vWPLelL6h8JQlUIAh4sh7+WQTsCcDvFCC/ GCxQ== X-Received: by 10.180.83.137 with SMTP id q9mr15303538wiy.68.1440616984357; Wed, 26 Aug 2015 12:23:04 -0700 (PDT) Received: from ?IPv6:2003:62:5f33:d300:d9f5:3632:9aad:8006? (p200300625F33D300D9F536329AAD8006.dip0.t-ipconnect.de. [2003:62:5f33:d300:d9f5:3632:9aad:8006]) by smtp.googlemail.com with ESMTPSA id fq15sm5291311wjc.12.2015.08.26.12.23.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2015 12:23:03 -0700 (PDT) Message-ID: <55DE11D1.50309@gmail.com> Date: Wed, 26 Aug 2015 21: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 v2 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.2 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 --- v2: - of_fsl_espi_remove would be temporarily empty after this patch, therefore remove it drivers/spi/spi-fsl-espi.c | 6 ------ drivers/spi/spi-fsl-lib.c | 15 --------------- drivers/spi/spi-fsl-lib.h | 3 --- drivers/spi/spi-fsl-spi.c | 18 +++++++----------- 4 files changed, 7 insertions(+), 35 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index f35eb2c..fe54e57 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -797,11 +797,6 @@ err: return ret; } -static int of_fsl_espi_remove(struct platform_device *dev) -{ - return mpc8xxx_spi_remove(&dev->dev); -} - #ifdef CONFIG_PM_SLEEP static int of_fsl_espi_suspend(struct device *dev) { @@ -865,7 +860,6 @@ static struct platform_driver fsl_espi_driver = { .pm = &espi_pm, }, .probe = of_fsl_espi_probe, - .remove = of_fsl_espi_remove, }; module_platform_driver(fsl_espi_driver); 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 8bfbe9e..17a9a87 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); @@ -861,11 +855,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; @@ -911,7 +902,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");