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

Merge tag 'mmc-4.1-rc1' of git://git.linaro.org/people/ulf.hansson/mmc

Pull MMC fixes from Ulf Hansson:
"Here is two mmc core fixes for v.4.1 rc1:

- fix error code propagation in mmc_pwrseq_simple_alloc()

- revert 'mmc: core: Convert mmc_driver to device_driver'"

* tag 'mmc-4.1-rc1' of git://git.linaro.org/people/ulf.hansson/mmc:
Revert "mmc: core: Convert mmc_driver to device_driver"
mmc: pwrseq: Fix error code propagation in mmc_pwrseq_simple_alloc()

+70 -39
+17 -17
drivers/mmc/card/block.c
··· 2418 2418 END_FIXUP 2419 2419 }; 2420 2420 2421 - static int mmc_blk_probe(struct device *dev) 2421 + static int mmc_blk_probe(struct mmc_card *card) 2422 2422 { 2423 - struct mmc_card *card = mmc_dev_to_card(dev); 2424 2423 struct mmc_blk_data *md, *part_md; 2425 2424 char cap_str[10]; 2426 2425 ··· 2444 2445 if (mmc_blk_alloc_parts(card, md)) 2445 2446 goto out; 2446 2447 2447 - dev_set_drvdata(dev, md); 2448 + dev_set_drvdata(&card->dev, md); 2448 2449 2449 2450 if (mmc_add_disk(md)) 2450 2451 goto out; ··· 2474 2475 return 0; 2475 2476 } 2476 2477 2477 - static int mmc_blk_remove(struct device *dev) 2478 + static void mmc_blk_remove(struct mmc_card *card) 2478 2479 { 2479 - struct mmc_card *card = mmc_dev_to_card(dev); 2480 - struct mmc_blk_data *md = dev_get_drvdata(dev); 2480 + struct mmc_blk_data *md = dev_get_drvdata(&card->dev); 2481 2481 2482 2482 mmc_blk_remove_parts(card, md); 2483 2483 pm_runtime_get_sync(&card->dev); ··· 2487 2489 pm_runtime_disable(&card->dev); 2488 2490 pm_runtime_put_noidle(&card->dev); 2489 2491 mmc_blk_remove_req(md); 2490 - dev_set_drvdata(dev, NULL); 2491 - 2492 - return 0; 2492 + dev_set_drvdata(&card->dev, NULL); 2493 2493 } 2494 2494 2495 - static int _mmc_blk_suspend(struct device *dev) 2495 + static int _mmc_blk_suspend(struct mmc_card *card) 2496 2496 { 2497 2497 struct mmc_blk_data *part_md; 2498 - struct mmc_blk_data *md = dev_get_drvdata(dev); 2498 + struct mmc_blk_data *md = dev_get_drvdata(&card->dev); 2499 2499 2500 2500 if (md) { 2501 2501 mmc_queue_suspend(&md->queue); ··· 2504 2508 return 0; 2505 2509 } 2506 2510 2507 - static void mmc_blk_shutdown(struct device *dev) 2511 + static void mmc_blk_shutdown(struct mmc_card *card) 2508 2512 { 2509 - _mmc_blk_suspend(dev); 2513 + _mmc_blk_suspend(card); 2510 2514 } 2511 2515 2512 2516 #ifdef CONFIG_PM_SLEEP 2513 2517 static int mmc_blk_suspend(struct device *dev) 2514 2518 { 2515 - return _mmc_blk_suspend(dev); 2519 + struct mmc_card *card = mmc_dev_to_card(dev); 2520 + 2521 + return _mmc_blk_suspend(card); 2516 2522 } 2517 2523 2518 2524 static int mmc_blk_resume(struct device *dev) ··· 2539 2541 2540 2542 static SIMPLE_DEV_PM_OPS(mmc_blk_pm_ops, mmc_blk_suspend, mmc_blk_resume); 2541 2543 2542 - static struct device_driver mmc_driver = { 2543 - .name = "mmcblk", 2544 - .pm = &mmc_blk_pm_ops, 2544 + static struct mmc_driver mmc_driver = { 2545 + .drv = { 2546 + .name = "mmcblk", 2547 + .pm = &mmc_blk_pm_ops, 2548 + }, 2545 2549 .probe = mmc_blk_probe, 2546 2550 .remove = mmc_blk_remove, 2547 2551 .shutdown = mmc_blk_shutdown,
+7 -11
drivers/mmc/card/mmc_test.c
··· 14 14 #include <linux/mmc/host.h> 15 15 #include <linux/mmc/mmc.h> 16 16 #include <linux/slab.h> 17 - #include <linux/device.h> 18 17 19 18 #include <linux/scatterlist.h> 20 19 #include <linux/swap.h> /* For nr_free_buffer_pages() */ ··· 2995 2996 return ret; 2996 2997 } 2997 2998 2998 - static int mmc_test_probe(struct device *dev) 2999 + static int mmc_test_probe(struct mmc_card *card) 2999 3000 { 3000 - struct mmc_card *card = mmc_dev_to_card(dev); 3001 3001 int ret; 3002 3002 3003 3003 if (!mmc_card_mmc(card) && !mmc_card_sd(card)) ··· 3011 3013 return 0; 3012 3014 } 3013 3015 3014 - static int mmc_test_remove(struct device *dev) 3016 + static void mmc_test_remove(struct mmc_card *card) 3015 3017 { 3016 - struct mmc_card *card = mmc_dev_to_card(dev); 3017 - 3018 3018 mmc_test_free_result(card); 3019 3019 mmc_test_free_dbgfs_file(card); 3020 - 3021 - return 0; 3022 3020 } 3023 3021 3024 - static void mmc_test_shutdown(struct device *dev) 3022 + static void mmc_test_shutdown(struct mmc_card *card) 3025 3023 { 3026 3024 } 3027 3025 3028 - static struct device_driver mmc_driver = { 3029 - .name = "mmc_test", 3026 + static struct mmc_driver mmc_driver = { 3027 + .drv = { 3028 + .name = "mmc_test", 3029 + }, 3030 3030 .probe = mmc_test_probe, 3031 3031 .remove = mmc_test_remove, 3032 3032 .shutdown = mmc_test_shutdown,
+33 -8
drivers/mmc/core/bus.c
··· 26 26 #include "sdio_cis.h" 27 27 #include "bus.h" 28 28 29 + #define to_mmc_driver(d) container_of(d, struct mmc_driver, drv) 30 + 29 31 static ssize_t type_show(struct device *dev, 30 32 struct device_attribute *attr, char *buf) 31 33 { ··· 107 105 return retval; 108 106 } 109 107 108 + static int mmc_bus_probe(struct device *dev) 109 + { 110 + struct mmc_driver *drv = to_mmc_driver(dev->driver); 111 + struct mmc_card *card = mmc_dev_to_card(dev); 112 + 113 + return drv->probe(card); 114 + } 115 + 116 + static int mmc_bus_remove(struct device *dev) 117 + { 118 + struct mmc_driver *drv = to_mmc_driver(dev->driver); 119 + struct mmc_card *card = mmc_dev_to_card(dev); 120 + 121 + drv->remove(card); 122 + 123 + return 0; 124 + } 125 + 110 126 static void mmc_bus_shutdown(struct device *dev) 111 127 { 128 + struct mmc_driver *drv = to_mmc_driver(dev->driver); 112 129 struct mmc_card *card = mmc_dev_to_card(dev); 113 130 struct mmc_host *host = card->host; 114 131 int ret; 115 132 116 - if (dev->driver && dev->driver->shutdown) 117 - dev->driver->shutdown(dev); 133 + if (dev->driver && drv->shutdown) 134 + drv->shutdown(card); 118 135 119 136 if (host->bus_ops->shutdown) { 120 137 ret = host->bus_ops->shutdown(host); ··· 202 181 .dev_groups = mmc_dev_groups, 203 182 .match = mmc_bus_match, 204 183 .uevent = mmc_bus_uevent, 184 + .probe = mmc_bus_probe, 185 + .remove = mmc_bus_remove, 205 186 .shutdown = mmc_bus_shutdown, 206 187 .pm = &mmc_bus_pm_ops, 207 188 }; ··· 222 199 * mmc_register_driver - register a media driver 223 200 * @drv: MMC media driver 224 201 */ 225 - int mmc_register_driver(struct device_driver *drv) 202 + int mmc_register_driver(struct mmc_driver *drv) 226 203 { 227 - drv->bus = &mmc_bus_type; 228 - return driver_register(drv); 204 + drv->drv.bus = &mmc_bus_type; 205 + return driver_register(&drv->drv); 229 206 } 207 + 230 208 EXPORT_SYMBOL(mmc_register_driver); 231 209 232 210 /** 233 211 * mmc_unregister_driver - unregister a media driver 234 212 * @drv: MMC media driver 235 213 */ 236 - void mmc_unregister_driver(struct device_driver *drv) 214 + void mmc_unregister_driver(struct mmc_driver *drv) 237 215 { 238 - drv->bus = &mmc_bus_type; 239 - driver_unregister(drv); 216 + drv->drv.bus = &mmc_bus_type; 217 + driver_unregister(&drv->drv); 240 218 } 219 + 241 220 EXPORT_SYMBOL(mmc_unregister_driver); 242 221 243 222 static void mmc_release_card(struct device *dev)
+1 -1
drivers/mmc/core/pwrseq.c
··· 73 73 74 74 pwrseq = match->alloc(host, &pdev->dev); 75 75 if (IS_ERR(pwrseq)) { 76 - ret = PTR_ERR(host->pwrseq); 76 + ret = PTR_ERR(pwrseq); 77 77 goto err; 78 78 } 79 79
+12 -2
include/linux/mmc/card.h
··· 512 512 513 513 #define mmc_dev_to_card(d) container_of(d, struct mmc_card, dev) 514 514 515 - extern int mmc_register_driver(struct device_driver *); 516 - extern void mmc_unregister_driver(struct device_driver *); 515 + /* 516 + * MMC device driver (e.g., Flash card, I/O card...) 517 + */ 518 + struct mmc_driver { 519 + struct device_driver drv; 520 + int (*probe)(struct mmc_card *); 521 + void (*remove)(struct mmc_card *); 522 + void (*shutdown)(struct mmc_card *); 523 + }; 524 + 525 + extern int mmc_register_driver(struct mmc_driver *); 526 + extern void mmc_unregister_driver(struct mmc_driver *); 517 527 518 528 extern void mmc_fixup_device(struct mmc_card *card, 519 529 const struct mmc_fixup *table);