Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

memstick: convert struct class_device to struct device

struct class_device is going away, struct device should be used instead.

Signed-off-by: Tony Jones <tonyj@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

+27 -28
+16 -17
drivers/memstick/core/memstick.c
··· 177 177 .resume = memstick_device_resume 178 178 }; 179 179 180 - static void memstick_free(struct class_device *cdev) 180 + static void memstick_free(struct device *dev) 181 181 { 182 - struct memstick_host *host = container_of(cdev, struct memstick_host, 183 - cdev); 182 + struct memstick_host *host = container_of(dev, struct memstick_host, 183 + dev); 184 184 kfree(host); 185 185 } 186 186 187 187 static struct class memstick_host_class = { 188 188 .name = "memstick_host", 189 - .release = memstick_free 189 + .dev_release = memstick_free 190 190 }; 191 191 192 192 static void memstick_free_card(struct device *dev) ··· 383 383 if (card) { 384 384 card->host = host; 385 385 snprintf(card->dev.bus_id, sizeof(card->dev.bus_id), 386 - "%s", host->cdev.class_id); 387 - card->dev.parent = host->cdev.dev; 386 + "%s", host->dev.bus_id); 387 + card->dev.parent = &host->dev; 388 388 card->dev.bus = &memstick_bus_type; 389 389 card->dev.release = memstick_free_card; 390 390 card->check = memstick_dummy_check; ··· 427 427 media_checker); 428 428 struct memstick_dev *card; 429 429 430 - dev_dbg(host->cdev.dev, "memstick_check started\n"); 430 + dev_dbg(&host->dev, "memstick_check started\n"); 431 431 mutex_lock(&host->lock); 432 432 if (!host->card) 433 433 memstick_power_on(host); ··· 440 440 host->card = NULL; 441 441 } 442 442 } else { 443 - dev_dbg(host->cdev.dev, "new card %02x, %02x, %02x\n", 443 + dev_dbg(&host->dev, "new card %02x, %02x, %02x\n", 444 444 card->id.type, card->id.category, card->id.class); 445 445 if (host->card) { 446 446 if (memstick_set_rw_addr(host->card) ··· 465 465 host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); 466 466 467 467 mutex_unlock(&host->lock); 468 - dev_dbg(host->cdev.dev, "memstick_check finished\n"); 468 + dev_dbg(&host->dev, "memstick_check finished\n"); 469 469 } 470 470 471 471 /** ··· 482 482 if (host) { 483 483 mutex_init(&host->lock); 484 484 INIT_WORK(&host->media_checker, memstick_check); 485 - host->cdev.class = &memstick_host_class; 486 - host->cdev.dev = dev; 487 - class_device_initialize(&host->cdev); 485 + host->dev.class = &memstick_host_class; 486 + host->dev.parent = dev; 487 + device_initialize(&host->dev); 488 488 } 489 489 return host; 490 490 } ··· 507 507 if (rc) 508 508 return rc; 509 509 510 - snprintf(host->cdev.class_id, BUS_ID_SIZE, 511 - "memstick%u", host->id); 510 + snprintf(host->dev.bus_id, BUS_ID_SIZE, "memstick%u", host->id); 512 511 513 - rc = class_device_add(&host->cdev); 512 + rc = device_add(&host->dev); 514 513 if (rc) { 515 514 spin_lock(&memstick_host_lock); 516 515 idr_remove(&memstick_host_idr, host->id); ··· 540 541 spin_lock(&memstick_host_lock); 541 542 idr_remove(&memstick_host_idr, host->id); 542 543 spin_unlock(&memstick_host_lock); 543 - class_device_del(&host->cdev); 544 + device_del(&host->dev); 544 545 } 545 546 EXPORT_SYMBOL(memstick_remove_host); 546 547 ··· 551 552 void memstick_free_host(struct memstick_host *host) 552 553 { 553 554 mutex_destroy(&host->lock); 554 - class_device_put(&host->cdev); 555 + put_device(&host->dev); 555 556 } 556 557 EXPORT_SYMBOL(memstick_free_host); 557 558
+2 -2
drivers/memstick/core/mspro_block.c
··· 1127 1127 u64 limit = BLK_BOUNCE_HIGH; 1128 1128 unsigned long capacity; 1129 1129 1130 - if (host->cdev.dev->dma_mask && *(host->cdev.dev->dma_mask)) 1131 - limit = *(host->cdev.dev->dma_mask); 1130 + if (host->dev.dma_mask && *(host->dev.dma_mask)) 1131 + limit = *(host->dev.dma_mask); 1132 1132 1133 1133 for (rc = 0; msb->attr_group.attrs[rc]; ++rc) { 1134 1134 s_attr = mspro_from_sysfs_attr(msb->attr_group.attrs[rc]);
+8 -8
drivers/memstick/host/jmb38x_ms.c
··· 361 361 unsigned int data_len, cmd, t_val; 362 362 363 363 if (!(STATUS_HAS_MEDIA & readl(host->addr + STATUS))) { 364 - dev_dbg(msh->cdev.dev, "no media status\n"); 364 + dev_dbg(&msh->dev, "no media status\n"); 365 365 host->req->error = -ETIME; 366 366 return host->req->error; 367 367 } 368 368 369 - dev_dbg(msh->cdev.dev, "control %08x\n", 369 + dev_dbg(&msh->dev, "control %08x\n", 370 370 readl(host->addr + HOST_CONTROL)); 371 - dev_dbg(msh->cdev.dev, "status %08x\n", readl(host->addr + INT_STATUS)); 372 - dev_dbg(msh->cdev.dev, "hstatus %08x\n", readl(host->addr + STATUS)); 371 + dev_dbg(&msh->dev, "status %08x\n", readl(host->addr + INT_STATUS)); 372 + dev_dbg(&msh->dev, "hstatus %08x\n", readl(host->addr + STATUS)); 373 373 374 374 host->cmd_flags = 0; 375 375 host->block_pos = 0; ··· 448 448 host->req->error = 0; 449 449 450 450 writel(cmd, host->addr + TPC); 451 - dev_dbg(msh->cdev.dev, "executing TPC %08x, len %x\n", cmd, data_len); 451 + dev_dbg(&msh->dev, "executing TPC %08x, len %x\n", cmd, data_len); 452 452 453 453 return 0; 454 454 } ··· 461 461 462 462 del_timer(&host->timer); 463 463 464 - dev_dbg(msh->cdev.dev, "c control %08x\n", 464 + dev_dbg(&msh->dev, "c control %08x\n", 465 465 readl(host->addr + HOST_CONTROL)); 466 - dev_dbg(msh->cdev.dev, "c status %08x\n", 466 + dev_dbg(&msh->dev, "c status %08x\n", 467 467 readl(host->addr + INT_STATUS)); 468 - dev_dbg(msh->cdev.dev, "c hstatus %08x\n", readl(host->addr + STATUS)); 468 + dev_dbg(&msh->dev, "c hstatus %08x\n", readl(host->addr + STATUS)); 469 469 470 470 host->req->int_reg = readl(host->addr + STATUS) & 0xff; 471 471
+1 -1
include/linux/memstick.h
··· 276 276 #define MEMSTICK_CAP_PAR8 4 277 277 278 278 struct work_struct media_checker; 279 - struct class_device cdev; 279 + struct device dev; 280 280 281 281 struct memstick_dev *card; 282 282 unsigned int retries;