Skip to content

Commit fcaf71f

Browse files
committed
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>
1 parent 04880ed commit fcaf71f

4 files changed

Lines changed: 19 additions & 19 deletions

File tree

‎drivers/mmc/mmc_queue.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
130130
u64 limit = BLK_BOUNCE_HIGH;
131131
int ret;
132132

133-
if (host->dev->dma_mask && *host->dev->dma_mask)
134-
limit = *host->dev->dma_mask;
133+
if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
134+
limit = *mmc_dev(host)->dma_mask;
135135

136136
mq->card = card;
137137
mq->queue = blk_init_queue(mmc_request, lock);

‎drivers/mmc/mmc_sysfs.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void mmc_init_card(struct mmc_card *card, struct mmc_host *host)
199199
memset(card, 0, sizeof(struct mmc_card));
200200
card->host = host;
201201
device_initialize(&card->dev);
202-
card->dev.parent = card->host->dev;
202+
card->dev.parent = mmc_dev(host);
203203
card->dev.bus = &mmc_bus_type;
204204
card->dev.release = mmc_release_card;
205205
}
@@ -242,15 +242,15 @@ void mmc_remove_card(struct mmc_card *card)
242242
}
243243

244244

245-
static void mmc_host_classdev_release(struct class_device *dev)
245+
static void mmc_host_classdev_release(struct device *dev)
246246
{
247247
struct mmc_host *host = cls_dev_to_mmc_host(dev);
248248
kfree(host);
249249
}
250250

251251
static struct class mmc_host_class = {
252252
.name = "mmc_host",
253-
.release = mmc_host_classdev_release,
253+
.dev_release = mmc_host_classdev_release,
254254
};
255255

256256
static DEFINE_IDR(mmc_host_idr);
@@ -267,10 +267,10 @@ struct mmc_host *mmc_alloc_host_sysfs(int extra, struct device *dev)
267267
if (host) {
268268
memset(host, 0, sizeof(struct mmc_host) + extra);
269269

270-
host->dev = dev;
271-
host->class_dev.dev = host->dev;
270+
host->parent = dev;
271+
host->class_dev.parent = dev;
272272
host->class_dev.class = &mmc_host_class;
273-
class_device_initialize(&host->class_dev);
273+
device_initialize(&host->class_dev);
274274
}
275275

276276
return host;
@@ -292,18 +292,18 @@ int mmc_add_host_sysfs(struct mmc_host *host)
292292
if (err)
293293
return err;
294294

295-
snprintf(host->class_dev.class_id, BUS_ID_SIZE,
295+
snprintf(host->class_dev.bus_id, BUS_ID_SIZE,
296296
"mmc%d", host->index);
297297

298-
return class_device_add(&host->class_dev);
298+
return device_add(&host->class_dev);
299299
}
300300

301301
/*
302302
* Internal function. Unregister a MMC host with the MMC class.
303303
*/
304304
void mmc_remove_host_sysfs(struct mmc_host *host)
305305
{
306-
class_device_del(&host->class_dev);
306+
device_del(&host->class_dev);
307307

308308
spin_lock(&mmc_host_lock);
309309
idr_remove(&mmc_host_idr, host->index);
@@ -315,7 +315,7 @@ void mmc_remove_host_sysfs(struct mmc_host *host)
315315
*/
316316
void mmc_free_host_sysfs(struct mmc_host *host)
317317
{
318-
class_device_put(&host->class_dev);
318+
put_device(&host->class_dev);
319319
}
320320

321321
static struct workqueue_struct *workqueue;

‎drivers/mmc/wbsd.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ static void __devinit wbsd_request_dma(struct wbsd_host *host, int dma)
14881488
/*
14891489
* Translate the address to a physical address.
14901490
*/
1491-
host->dma_addr = dma_map_single(host->mmc->dev, host->dma_buffer,
1491+
host->dma_addr = dma_map_single(mmc_dev(host->mmc), host->dma_buffer,
14921492
WBSD_DMA_SIZE, DMA_BIDIRECTIONAL);
14931493

14941494
/*
@@ -1512,7 +1512,7 @@ static void __devinit wbsd_request_dma(struct wbsd_host *host, int dma)
15121512
*/
15131513
BUG_ON(1);
15141514

1515-
dma_unmap_single(host->mmc->dev, host->dma_addr,
1515+
dma_unmap_single(mmc_dev(host->mmc), host->dma_addr,
15161516
WBSD_DMA_SIZE, DMA_BIDIRECTIONAL);
15171517
host->dma_addr = (dma_addr_t)NULL;
15181518

@@ -1530,7 +1530,7 @@ static void __devinit wbsd_request_dma(struct wbsd_host *host, int dma)
15301530
static void __devexit wbsd_release_dma(struct wbsd_host *host)
15311531
{
15321532
if (host->dma_addr) {
1533-
dma_unmap_single(host->mmc->dev, host->dma_addr,
1533+
dma_unmap_single(mmc_dev(host->mmc), host->dma_addr,
15341534
WBSD_DMA_SIZE, DMA_BIDIRECTIONAL);
15351535
}
15361536
kfree(host->dma_buffer);

‎include/linux/mmc/host.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ struct mmc_card;
7474
struct device;
7575

7676
struct mmc_host {
77-
struct device *dev;
78-
struct class_device class_dev;
77+
struct device *parent;
78+
struct device class_dev;
7979
int index;
8080
const struct mmc_host_ops *ops;
8181
unsigned int f_min;
@@ -125,8 +125,8 @@ static inline void *mmc_priv(struct mmc_host *host)
125125
return (void *)host->private;
126126
}
127127

128-
#define mmc_dev(x) ((x)->dev)
129-
#define mmc_hostname(x) ((x)->class_dev.class_id)
128+
#define mmc_dev(x) ((x)->parent)
129+
#define mmc_hostname(x) ((x)->class_dev.bus_id)
130130

131131
extern int mmc_suspend_host(struct mmc_host *, pm_message_t);
132132
extern int mmc_resume_host(struct mmc_host *);

0 commit comments

Comments
 (0)