Skip to content

Commit 515033f

Browse files
Anton Vorontsovtorvalds
authored andcommitted
sdhci-pltfm: switch to module device table matching
Sometimes want to place SoC-specific parts alongside with the generic driver, and to do so, we have to switch the driver over to the module device table matching. Note that drivers/mmc/host/sdhci-pltfm.h is so far empty, but it'll hold SoC-specific driver data handlers soon. Signed-off-by: Anton Vorontsov <[email protected]> Cc: Ben Dooks <[email protected]> Cc: Richard R?jfors <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 27151dc commit 515033f

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

drivers/mmc/host/sdhci-pltfm.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include <linux/delay.h>
2626
#include <linux/highmem.h>
27+
#include <linux/mod_devicetable.h>
2728
#include <linux/platform_device.h>
2829

2930
#include <linux/mmc/host.h>
@@ -32,6 +33,7 @@
3233
#include <linux/sdhci-pltfm.h>
3334

3435
#include "sdhci.h"
36+
#include "sdhci-pltfm.h"
3537

3638
/*****************************************************************************\
3739
* *
@@ -51,10 +53,14 @@ static struct sdhci_ops sdhci_pltfm_ops = {
5153
static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)
5254
{
5355
struct sdhci_pltfm_data *pdata = pdev->dev.platform_data;
56+
const struct platform_device_id *platid = platform_get_device_id(pdev);
5457
struct sdhci_host *host;
5558
struct resource *iomem;
5659
int ret;
5760

61+
if (!pdata && platid && platid->driver_data)
62+
pdata = (void *)platid->driver_data;
63+
5864
iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
5965
if (!iomem) {
6066
ret = -ENOMEM;
@@ -150,13 +156,20 @@ static int __devexit sdhci_pltfm_remove(struct platform_device *pdev)
150156
return 0;
151157
}
152158

159+
static const struct platform_device_id sdhci_pltfm_ids[] = {
160+
{ "sdhci", },
161+
{ },
162+
};
163+
MODULE_DEVICE_TABLE(platform, sdhci_pltfm_ids);
164+
153165
static struct platform_driver sdhci_pltfm_driver = {
154166
.driver = {
155167
.name = "sdhci",
156168
.owner = THIS_MODULE,
157169
},
158170
.probe = sdhci_pltfm_probe,
159171
.remove = __devexit_p(sdhci_pltfm_remove),
172+
.id_table = sdhci_pltfm_ids,
160173
};
161174

162175
/*****************************************************************************\
@@ -181,4 +194,3 @@ module_exit(sdhci_drv_exit);
181194
MODULE_DESCRIPTION("Secure Digital Host Controller Interface platform driver");
182195
MODULE_AUTHOR("Mocean Laboratories <[email protected]>");
183196
MODULE_LICENSE("GPL v2");
184-
MODULE_ALIAS("platform:sdhci");

drivers/mmc/host/sdhci-pltfm.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright 2010 MontaVista Software, LLC.
3+
*
4+
* Author: Anton Vorontsov <[email protected]>
5+
*
6+
* This program is free software; you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License version 2 as
8+
* published by the Free Software Foundation.
9+
*/
10+
11+
#ifndef _DRIVERS_MMC_SDHCI_PLTFM_H
12+
#define _DRIVERS_MMC_SDHCI_PLTFM_H
13+
14+
#endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */

0 commit comments

Comments
 (0)