@@ -113,7 +113,6 @@ struct goldfish_mmc_host {
113
113
struct mmc_request * mrq ;
114
114
struct mmc_command * cmd ;
115
115
struct mmc_data * data ;
116
- struct mmc_host * mmc ;
117
116
struct device * dev ;
118
117
unsigned char id ; /* 16xx chips have 2 MMC blocks */
119
118
void * virt_base ;
@@ -175,7 +174,7 @@ goldfish_mmc_start_command(struct goldfish_mmc_host *host, struct mmc_command *c
175
174
resptype = 3 ;
176
175
break ;
177
176
default :
178
- dev_err (mmc_dev (host -> mmc ),
177
+ dev_err (mmc_dev (mmc_from_priv ( host ) ),
179
178
"Invalid response type: %04x\n" , mmc_resp_type (cmd ));
180
179
break ;
181
180
}
@@ -221,8 +220,8 @@ static void goldfish_mmc_xfer_done(struct goldfish_mmc_host *host,
221
220
data -> sg -> length );
222
221
}
223
222
host -> data -> bytes_xfered += data -> sg -> length ;
224
- dma_unmap_sg (mmc_dev (host -> mmc ) , data -> sg , host -> sg_len ,
225
- dma_data_dir );
223
+ dma_unmap_sg (mmc_dev (mmc_from_priv ( host )) , data -> sg ,
224
+ host -> sg_len , dma_data_dir );
226
225
}
227
226
228
227
host -> data = NULL ;
@@ -236,7 +235,7 @@ static void goldfish_mmc_xfer_done(struct goldfish_mmc_host *host,
236
235
237
236
if (!data -> stop ) {
238
237
host -> mrq = NULL ;
239
- mmc_request_done (host -> mmc , data -> mrq );
238
+ mmc_request_done (mmc_from_priv ( host ) , data -> mrq );
240
239
return ;
241
240
}
242
241
@@ -278,7 +277,7 @@ static void goldfish_mmc_cmd_done(struct goldfish_mmc_host *host,
278
277
279
278
if (host -> data == NULL || cmd -> error ) {
280
279
host -> mrq = NULL ;
281
- mmc_request_done (host -> mmc , cmd -> mrq );
280
+ mmc_request_done (mmc_from_priv ( host ) , cmd -> mrq );
282
281
}
283
282
}
284
283
@@ -313,7 +312,7 @@ static irqreturn_t goldfish_mmc_irq(int irq, void *dev_id)
313
312
struct mmc_request * mrq = host -> mrq ;
314
313
mrq -> cmd -> error = - ETIMEDOUT ;
315
314
host -> mrq = NULL ;
316
- mmc_request_done (host -> mmc , mrq );
315
+ mmc_request_done (mmc_from_priv ( host ) , mrq );
317
316
}
318
317
319
318
if (end_command )
@@ -339,12 +338,13 @@ static irqreturn_t goldfish_mmc_irq(int irq, void *dev_id)
339
338
u32 state = GOLDFISH_MMC_READ (host , MMC_STATE );
340
339
pr_info ("%s: Card detect now %d\n" , __func__ ,
341
340
(state & MMC_STATE_INSERTED ));
342
- mmc_detect_change (host -> mmc , 0 );
341
+ mmc_detect_change (mmc_from_priv ( host ) , 0 );
343
342
}
344
343
345
344
if (!end_command && !end_transfer && !state_changed && !cmd_timeout ) {
346
345
status = GOLDFISH_MMC_READ (host , MMC_INT_STATUS );
347
- dev_info (mmc_dev (host -> mmc ),"spurious irq 0x%04x\n" , status );
346
+ dev_info (mmc_dev (mmc_from_priv (host )), "spurious irq 0x%04x\n" ,
347
+ status );
348
348
if (status != 0 ) {
349
349
GOLDFISH_MMC_WRITE (host , MMC_INT_STATUS , status );
350
350
GOLDFISH_MMC_WRITE (host , MMC_INT_ENABLE , 0 );
@@ -383,7 +383,7 @@ static void goldfish_mmc_prepare_data(struct goldfish_mmc_host *host,
383
383
384
384
dma_data_dir = mmc_get_dma_dir (data );
385
385
386
- host -> sg_len = dma_map_sg (mmc_dev (host -> mmc ), data -> sg ,
386
+ host -> sg_len = dma_map_sg (mmc_dev (mmc_from_priv ( host ) ), data -> sg ,
387
387
sg_len , dma_data_dir );
388
388
host -> dma_done = 0 ;
389
389
host -> dma_in_use = 1 ;
@@ -461,7 +461,6 @@ static int goldfish_mmc_probe(struct platform_device *pdev)
461
461
}
462
462
463
463
host = mmc_priv (mmc );
464
- host -> mmc = mmc ;
465
464
466
465
pr_err ("mmc: Mapping %lX to %lX\n" , (long )res -> start , (long )res -> end );
467
466
host -> reg_base = ioremap (res -> start , resource_size (res ));
@@ -508,8 +507,7 @@ static int goldfish_mmc_probe(struct platform_device *pdev)
508
507
509
508
ret = device_create_file (& pdev -> dev , & dev_attr_cover_switch );
510
509
if (ret )
511
- dev_warn (mmc_dev (host -> mmc ),
512
- "Unable to create sysfs attributes\n" );
510
+ dev_warn (mmc_dev (mmc ), "Unable to create sysfs attributes\n" );
513
511
514
512
GOLDFISH_MMC_WRITE (host , MMC_SET_BUFFER , host -> phys_base );
515
513
GOLDFISH_MMC_WRITE (host , MMC_INT_ENABLE ,
@@ -525,22 +523,23 @@ static int goldfish_mmc_probe(struct platform_device *pdev)
525
523
dma_alloc_failed :
526
524
iounmap (host -> reg_base );
527
525
ioremap_failed :
528
- mmc_free_host (host -> mmc );
526
+ mmc_free_host (mmc );
529
527
err_alloc_host_failed :
530
528
return ret ;
531
529
}
532
530
533
531
static int goldfish_mmc_remove (struct platform_device * pdev )
534
532
{
535
533
struct goldfish_mmc_host * host = platform_get_drvdata (pdev );
534
+ struct mmc_host * mmc = mmc_from_priv (host );
536
535
537
536
BUG_ON (host == NULL );
538
537
539
- mmc_remove_host (host -> mmc );
538
+ mmc_remove_host (mmc );
540
539
free_irq (host -> irq , host );
541
540
dma_free_coherent (& pdev -> dev , BUFFER_SIZE , host -> virt_base , host -> phys_base );
542
541
iounmap (host -> reg_base );
543
- mmc_free_host (host -> mmc );
542
+ mmc_free_host (mmc );
544
543
return 0 ;
545
544
}
546
545
0 commit comments