Driver core: convert mmc code to use struct device

Converts from using struct "class_device" to "struct device" making
everything show up properly in /sys/devices/ with symlinks from the
/sys/class directory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Greg Kroah-Hartman 2006-09-12 17:00:10 +02:00
parent 04880edae5
commit fcaf71fd51
4 changed files with 19 additions and 19 deletions

View file

@ -130,8 +130,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
u64 limit = BLK_BOUNCE_HIGH;
int ret;
if (host->dev->dma_mask && *host->dev->dma_mask)
limit = *host->dev->dma_mask;
if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
limit = *mmc_dev(host)->dma_mask;
mq->card = card;
mq->queue = blk_init_queue(mmc_request, lock);

View file

@ -199,7 +199,7 @@ void mmc_init_card(struct mmc_card *card, struct mmc_host *host)
memset(card, 0, sizeof(struct mmc_card));
card->host = host;
device_initialize(&card->dev);
card->dev.parent = card->host->dev;
card->dev.parent = mmc_dev(host);
card->dev.bus = &mmc_bus_type;
card->dev.release = mmc_release_card;
}
@ -242,7 +242,7 @@ void mmc_remove_card(struct mmc_card *card)
}
static void mmc_host_classdev_release(struct class_device *dev)
static void mmc_host_classdev_release(struct device *dev)
{
struct mmc_host *host = cls_dev_to_mmc_host(dev);
kfree(host);
@ -250,7 +250,7 @@ static void mmc_host_classdev_release(struct class_device *dev)
static struct class mmc_host_class = {
.name = "mmc_host",
.release = mmc_host_classdev_release,
.dev_release = mmc_host_classdev_release,
};
static DEFINE_IDR(mmc_host_idr);
@ -267,10 +267,10 @@ struct mmc_host *mmc_alloc_host_sysfs(int extra, struct device *dev)
if (host) {
memset(host, 0, sizeof(struct mmc_host) + extra);
host->dev = dev;
host->class_dev.dev = host->dev;
host->parent = dev;
host->class_dev.parent = dev;
host->class_dev.class = &mmc_host_class;
class_device_initialize(&host->class_dev);
device_initialize(&host->class_dev);
}
return host;
@ -292,10 +292,10 @@ int mmc_add_host_sysfs(struct mmc_host *host)
if (err)
return err;
snprintf(host->class_dev.class_id, BUS_ID_SIZE,
snprintf(host->class_dev.bus_id, BUS_ID_SIZE,
"mmc%d", host->index);
return class_device_add(&host->class_dev);
return device_add(&host->class_dev);
}
/*
@ -303,7 +303,7 @@ int mmc_add_host_sysfs(struct mmc_host *host)
*/
void mmc_remove_host_sysfs(struct mmc_host *host)
{
class_device_del(&host->class_dev);
device_del(&host->class_dev);
spin_lock(&mmc_host_lock);
idr_remove(&mmc_host_idr, host->index);
@ -315,7 +315,7 @@ void mmc_remove_host_sysfs(struct mmc_host *host)
*/
void mmc_free_host_sysfs(struct mmc_host *host)
{
class_device_put(&host->class_dev);
put_device(&host->class_dev);
}
static struct workqueue_struct *workqueue;

View file

@ -1488,7 +1488,7 @@ static void __devinit wbsd_request_dma(struct wbsd_host *host, int dma)
/*
* Translate the address to a physical address.
*/
host->dma_addr = dma_map_single(host->mmc->dev, host->dma_buffer,
host->dma_addr = dma_map_single(mmc_dev(host->mmc), host->dma_buffer,
WBSD_DMA_SIZE, DMA_BIDIRECTIONAL);
/*
@ -1512,7 +1512,7 @@ static void __devinit wbsd_request_dma(struct wbsd_host *host, int dma)
*/
BUG_ON(1);
dma_unmap_single(host->mmc->dev, host->dma_addr,
dma_unmap_single(mmc_dev(host->mmc), host->dma_addr,
WBSD_DMA_SIZE, DMA_BIDIRECTIONAL);
host->dma_addr = (dma_addr_t)NULL;
@ -1530,7 +1530,7 @@ static void __devinit wbsd_request_dma(struct wbsd_host *host, int dma)
static void __devexit wbsd_release_dma(struct wbsd_host *host)
{
if (host->dma_addr) {
dma_unmap_single(host->mmc->dev, host->dma_addr,
dma_unmap_single(mmc_dev(host->mmc), host->dma_addr,
WBSD_DMA_SIZE, DMA_BIDIRECTIONAL);
}
kfree(host->dma_buffer);

View file

@ -74,8 +74,8 @@ struct mmc_card;
struct device;
struct mmc_host {
struct device *dev;
struct class_device class_dev;
struct device *parent;
struct device class_dev;
int index;
const struct mmc_host_ops *ops;
unsigned int f_min;
@ -125,8 +125,8 @@ static inline void *mmc_priv(struct mmc_host *host)
return (void *)host->private;
}
#define mmc_dev(x) ((x)->dev)
#define mmc_hostname(x) ((x)->class_dev.class_id)
#define mmc_dev(x) ((x)->parent)
#define mmc_hostname(x) ((x)->class_dev.bus_id)
extern int mmc_suspend_host(struct mmc_host *, pm_message_t);
extern int mmc_resume_host(struct mmc_host *);