From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] ahci: st: Utilise ata_platform_remove_one() call
Date: Wed, 12 Mar 2014 12:39:40 +0000 [thread overview]
Message-ID: <1394627982-23726-4-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1394627982-23726-1-git-send-email-lee.jones@linaro.org>
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 <b.zolnierkie@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
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);
--
1.8.3.2
next prev parent reply other threads:[~2014-03-12 12:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-12 12:39 [PATCH 0/5] ahci: st: Apply Bartlomiej's suggestions Lee Jones
2014-03-12 12:39 ` [PATCH 1/5] ahci: st: Standardise naming conventions Lee Jones
2014-03-12 12:39 ` [PATCH 2/5] ahci: st: Remove legacy dependencies on PHY Lee Jones
2014-03-12 12:39 ` Lee Jones [this message]
2014-03-12 12:39 ` [PATCH 4/5] ahci: st: Only build for ST-Micro h/w Lee Jones
2014-03-12 12:39 ` [PATCH 5/5] ahci: st: Invoke AHCI Platform Suspend/Resume Lee Jones
2014-03-14 13:22 ` [PATCH 0/5] ahci: st: Apply Bartlomiej's suggestions Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394627982-23726-4-git-send-email-lee.jones@linaro.org \
--to=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).