From patchwork Wed Mar 12 12:39:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 26085 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 339CC203AB for ; Wed, 12 Mar 2014 12:40:25 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id b6sf8199802yha.8 for ; Wed, 12 Mar 2014 05:40:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=nM/1I1aOQ9+AWlcGdNEXPOrHSnDj+ZhBHrYhYpTRVAw=; b=F8kYo1Blcw6vfL6+QnbbYFBdgNpQQKk04VE1UiAzLehHyN2JevLM/SFqBTRaVmFhpO gd//poNdYnqacEtSJTFkNkS26Kgkwzq7HK9R6ZALya+kB90Rp/wIf7hGEymUQw9lXMio cJSlYl8Hsgc8B3Nx6VoXHGqEyUC+fmc4cw1N2z4KAjXW73i6pH1yP8t+/cfA26z+I5rE /Mq3Z7UWMIQhdojq3HS5MAYVTl485S1XsmlWcJlxXuLlZ6fPxd5SrLRd/q1UmI0GhNnW AepjLJncw7aqYqC3ueZBwQQX2eyOnF3ot/crpMw8E9jnHhOFKdCuHftUuL7DqrEKtxEq 5RAA== X-Gm-Message-State: ALoCoQkaBgtYwGxSQEDDZ0IqZGq7jtFU5uTpA9o6z/xFWc/SFBl/CRjZ4YjicDyx6fcBqLxp7fr4 X-Received: by 10.58.58.41 with SMTP id n9mr16085151veq.23.1394628024885; Wed, 12 Mar 2014 05:40:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.115 with SMTP id r106ls1463433qga.73.gmail; Wed, 12 Mar 2014 05:40:24 -0700 (PDT) X-Received: by 10.58.248.228 with SMTP id yp4mr130927vec.35.1394628024702; Wed, 12 Mar 2014 05:40:24 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id 16si6742102vce.12.2014.03.12.05.40.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Mar 2014 05:40:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id lf12so4184780vcb.25 for ; Wed, 12 Mar 2014 05:40:24 -0700 (PDT) X-Received: by 10.52.15.132 with SMTP id x4mr753827vdc.31.1394628024602; Wed, 12 Mar 2014 05:40:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp285285vck; Wed, 12 Mar 2014 05:40:24 -0700 (PDT) X-Received: by 10.66.119.172 with SMTP id kv12mr4678474pab.34.1394628023695; Wed, 12 Mar 2014 05:40:23 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qe9si2252964pbb.192.2014.03.12.05.40.23; Wed, 12 Mar 2014 05:40:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753332AbaCLMkN (ORCPT + 26 others); Wed, 12 Mar 2014 08:40:13 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:52451 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752875AbaCLMkL (ORCPT ); Wed, 12 Mar 2014 08:40:11 -0400 Received: by mail-wi0-f174.google.com with SMTP id d1so2312368wiv.7 for ; Wed, 12 Mar 2014 05:40:10 -0700 (PDT) X-Received: by 10.180.188.66 with SMTP id fy2mr7381394wic.45.1394628009977; Wed, 12 Mar 2014 05:40:09 -0700 (PDT) Received: from lee--X1.home (host109-148-116-196.range109-148.btcentralplus.com. [109.148.116.196]) by mx.google.com with ESMTPSA id di9sm15692752wid.6.2014.03.12.05.40.08 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Mar 2014 05:40:09 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, tj@kernel.org Cc: lee.jones@linaro.org, kernel@stlinux.com, b.zolnierkie@samsung.com, linux-ide@vger.kernel.org Subject: [PATCH 3/5] ahci: st: Utilise ata_platform_remove_one() call Date: Wed, 12 Mar 2014 12:39:40 +0000 Message-Id: <1394627982-23726-4-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1394627982-23726-1-git-send-email-lee.jones@linaro.org> References: <1394627982-23726-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , ata_platform_remove_one() allows us to specify our own exit function via platform data then goes off and removes ATA Host and Port in preparation for device removal. Suggested-by: Bartlomiej Zolnierkiewicz Signed-off-by: Lee Jones --- drivers/ata/ahci_st.c | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/drivers/ata/ahci_st.c b/drivers/ata/ahci_st.c index a28532a..3edec5d 100644 --- a/drivers/ata/ahci_st.c +++ b/drivers/ata/ahci_st.c @@ -87,6 +87,23 @@ static int st_ahci_deassert_resets(struct device *dev) return 0; } +static int st_ahci_exit(struct device *dev) +{ + struct st_ahci_drv_data *drv_data = dev_get_drvdata(dev); + struct ahci_host_priv *hpriv = drv_data->hpriv; + int err; + + if (drv_data->pwr) { + err = reset_control_assert(drv_data->pwr); + if (err) + dev_err(&pdev->dev, "unable to pwrdwn\n"); + } + + ahci_platform_disable_resources(hpriv); + + return 0; +} + static int st_ahci_probe_resets(struct platform_device *pdev) { struct st_ahci_drv_data *drv_data = platform_get_drvdata(pdev); @@ -122,6 +139,7 @@ static const struct ata_port_info st_ahci_port_info = { static int st_ahci_probe(struct platform_device *pdev) { struct st_ahci_drv_data *drv_data; + struct ahci_platform_data *pdata; struct ahci_host_priv *hpriv; int err; @@ -131,6 +149,13 @@ static int st_ahci_probe(struct platform_device *pdev) platform_set_drvdata(pdev, drv_data); + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; + + pdata->exit = st_ahci_exit; + pdev->dev.platform_data = pdata; + hpriv = ahci_platform_get_resources(pdev); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); @@ -154,23 +179,6 @@ static int st_ahci_probe(struct platform_device *pdev) return 0; } -static int st_ahci_remove(struct platform_device *pdev) -{ - struct st_ahci_drv_data *drv_data = platform_get_drvdata(pdev); - struct ahci_host_priv *hpriv = drv_data->hpriv; - int err; - - if (drv_data->pwr) { - err = reset_control_assert(drv_data->pwr); - if (err) - dev_err(&pdev->dev, "unable to pwrdwn\n"); - } - - ahci_platform_disable_resources(hpriv); - - return 0; -} - #ifdef CONFIG_PM_SLEEP static int st_ahci_suspend(struct device *dev) { @@ -227,7 +235,7 @@ static struct platform_driver st_ahci_driver = { .of_match_table = of_match_ptr(st_ahci_match), }, .probe = st_ahci_probe, - .remove = st_ahci_remove, + .remove = ata_platform_remove_one, }; module_platform_driver(st_ahci_driver);