From mboxrd@z Thu Jan 1 00:00:00 1970 From: mkl0301@gmail.com (mkl0301 at gmail.com) Date: Fri, 7 Jan 2011 01:53:12 +0800 Subject: [PATCH v3 1/2] ahci_platform: switch to module device table matching In-Reply-To: <1294336393-920-1-git-send-email-mkl0301@gmail.com> References: <1294336393-920-1-git-send-email-mkl0301@gmail.com> Message-ID: <1294336393-920-2-git-send-email-mkl0301@gmail.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org From: Mac Lin Switch the driver to use module device table matching mechanism to add SoC-specific parts to the generic driver. Signed-off-by: Mac Lin --- drivers/ata/ahci_platform.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 6fef1fa..25d98c8 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include "ahci.h" @@ -29,6 +30,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 +48,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 +176,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 +206,3 @@ module_exit(ahci_exit); MODULE_DESCRIPTION("AHCI SATA platform driver"); MODULE_AUTHOR("Anton Vorontsov "); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:ahci"); -- 1.7.3