From: mkl0301@gmail.com (mkl0301 at gmail.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/3] ahci_pltfm: switch to module device table matching
Date: Wed, 5 Jan 2011 13:43:06 +0800 [thread overview]
Message-ID: <1294206187-11487-3-git-send-email-mkl0301@gmail.com> (raw)
In-Reply-To: <1294206187-11487-1-git-send-email-mkl0301@gmail.com>
From: Mac Lin <mkl0301@gmail.com>
Switch the driver to use module device table matching mechanism to add SoC-specific parts to the generic driver.
Signed-off-by: Mac Lin <mkl0301@gmail.com>
---
drivers/ata/ahci_pltfm.c | 14 +++++++++++++-
drivers/ata/ahci_pltfm.h | 17 +++++++++++++++++
2 files changed, 30 insertions(+), 1 deletions(-)
create mode 100644 drivers/ata/ahci_pltfm.h
diff --git a/drivers/ata/ahci_pltfm.c b/drivers/ata/ahci_pltfm.c
index 6fef1fa..6579d55 100644
--- a/drivers/ata/ahci_pltfm.c
+++ b/drivers/ata/ahci_pltfm.c
@@ -19,9 +19,11 @@
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/platform_device.h>
+#include <linux/mod_devicetable.h>
#include <linux/libata.h>
#include <linux/ahci_platform.h>
#include "ahci.h"
+#include "ahci_pltfm.h"
static struct scsi_host_template ahci_platform_sht = {
AHCI_SHT("ahci_platform"),
@@ -29,6 +31,7 @@ static struct scsi_host_template ahci_platform_sht = {
static int __init ahci_probe(struct platform_device *pdev)
{
+ const struct platform_device_id *platid = platform_get_device_id(pdev);
struct device *dev = &pdev->dev;
struct ahci_platform_data *pdata = dev->platform_data;
struct ata_port_info pi = {
@@ -46,6 +49,9 @@ static int __init ahci_probe(struct platform_device *pdev)
int i;
int rc;
+ if (!pdata && platid && platid->driver_data)
+ pdata = (void *)platid->driver_data;
+
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem) {
dev_err(dev, "no mmio space\n");
@@ -171,12 +177,19 @@ static int __devexit ahci_remove(struct platform_device *pdev)
return 0;
}
+static const struct platform_device_id ahci_pltfm_ids[] = {
+ { "ahci", },
+ { },
+};
+MODULE_DEVICE_TABLE(platform, ahci_pltfm_ids);
+
static struct platform_driver ahci_driver = {
.remove = __devexit_p(ahci_remove),
.driver = {
.name = "ahci",
.owner = THIS_MODULE,
},
+ .id_table = ahci_pltfm_ids,
};
static int __init ahci_init(void)
@@ -194,4 +207,3 @@ module_exit(ahci_exit);
MODULE_DESCRIPTION("AHCI SATA platform driver");
MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>");
MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:ahci");
diff --git a/drivers/ata/ahci_pltfm.h b/drivers/ata/ahci_pltfm.h
new file mode 100644
index 0000000..b66390c
--- /dev/null
+++ b/drivers/ata/ahci_pltfm.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2010 MontaVista Software, LLC.
+ * Copyright 2010 Cavium Networks
+ *
+ * Authors: Anton Vorontsov <avorontsov@mvista.com>
+ * Mac Lin <mkl0301@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _DRIVERS_SATA_AHCI_PLTFM_H
+#define _DRIVERS_SATA_AHCI_PLTFM_H
+
+#endif /* _DRIVERS_SATA_AHCI_PLTFM_H */
+
--
1.7.3
next prev parent reply other threads:[~2011-01-05 5:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-05 5:43 [PATCH v2 0/3] add CNS3xxx AHCI support mkl0301 at gmail.com
2011-01-05 5:43 ` [PATCH v2 1/3] ahci_platform: rename to ahci_pltfm, but keep the original module name mkl0301 at gmail.com
2011-01-05 5:43 ` mkl0301 at gmail.com [this message]
2011-01-06 10:53 ` [PATCH v2 2/3] ahci_pltfm: switch to module device table matching Anton Vorontsov
2011-01-05 5:43 ` [PATCH v2 3/3] ahci_platform: add support for CNS3xxx SoC devices mkl0301 at gmail.com
2011-01-06 11:02 ` Anton Vorontsov
2011-01-05 18:15 ` [PATCH v2 0/3] add CNS3xxx AHCI support Jeff Garzik
2011-01-06 6:43 ` Lin Mac
2011-01-06 10:51 ` Anton Vorontsov
2011-01-06 16:18 ` Lin Mac
2011-01-06 23:17 ` Jeff Garzik
2011-01-07 15:47 ` Anton Vorontsov
2011-01-07 23:44 ` Lin Mac
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=1294206187-11487-3-git-send-email-mkl0301@gmail.com \
--to=mkl0301@gmail.com \
--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).