From: Nate Watterson <nwatters@codeaurora.org>
To: Tejun Heo <tj@kernel.org>,
linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Nate Watterson <nwatters@codeaurora.org>
Subject: [PATCH 1/2] libata: Introduce ata_platform_shutdown_one()
Date: Mon, 3 Jul 2017 14:02:41 -0400 [thread overview]
Message-ID: <1499104962-17498-1-git-send-email-nwatters@codeaurora.org> (raw)
In similar fashion to how ata_platform_remove_one() is used, this
newly introduced method can be used by platform ata drivers to get
basic shutdown functionality (stopping host DMA and interrupts).
Signed-off-by: Nate Watterson <nwatters@codeaurora.org>
---
drivers/ata/libata-core.c | 20 ++++++++++++++++++++
include/linux/libata.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index e157a0e..537932e 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6702,6 +6702,25 @@ int ata_platform_remove_one(struct platform_device *pdev)
return 0;
}
+/**
+ * ata_platform_shutdown_one - Platform layer callback for device shutdown
+ * @pdev: Platform device being shutdown
+ *
+ * Platform layer indicates to libata via this hook that shutdown is
+ * in progress and the input device should be quiesced. Functionally this
+ * is equivalent to ata_platform_remove_one(), however devres_release_all()
+ * is not called on the shutdown path as it is for remove so releasing the
+ * resources associated with the device must instead be initiated directly.
+ */
+void ata_platform_shutdown_one(struct platform_device *pdev)
+{
+ struct ata_host *host = platform_get_drvdata(pdev);
+
+ ata_host_detach(host);
+ devres_release(&pdev->dev, ata_host_stop, NULL, NULL);
+ devres_release(&pdev->dev, ata_host_release, NULL, NULL);
+}
+
static int __init ata_parse_force_one(char **cur,
struct ata_force_ent *force_ent,
const char **reason)
@@ -7222,6 +7241,7 @@ void ata_print_version(const struct device *dev, const char *version)
#endif /* CONFIG_PCI */
EXPORT_SYMBOL_GPL(ata_platform_remove_one);
+EXPORT_SYMBOL_GPL(ata_platform_shutdown_one);
EXPORT_SYMBOL_GPL(__ata_ehi_push_desc);
EXPORT_SYMBOL_GPL(ata_ehi_push_desc);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index c9a69fc..6c01f23f 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1240,6 +1240,7 @@ struct pci_bits {
struct platform_device;
extern int ata_platform_remove_one(struct platform_device *pdev);
+extern void ata_platform_shutdown_one(struct platform_device *pdev);
/*
* ACPI - drivers/ata/libata-acpi.c
--
Qualcomm Datacenter Technologies, Inc. on behalf of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux
Foundation Collaborative Project.
next reply other threads:[~2017-07-03 18:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-03 18:02 Nate Watterson [this message]
2017-07-03 18:02 ` [PATCH 2/2] ata: ahci_platform: Handle shutdown with ata_platform_shutdown_one() Nate Watterson
2017-07-05 14:51 ` Tejun Heo
2017-07-05 14:50 ` [PATCH 1/2] libata: Introduce ata_platform_shutdown_one() 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=1499104962-17498-1-git-send-email-nwatters@codeaurora.org \
--to=nwatters@codeaurora.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.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
Powered by JetHome