block.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. /*
  2. * Block driver for media (i.e., flash cards)
  3. *
  4. * Copyright 2002 Hewlett-Packard Company
  5. * Copyright 2005-2008 Pierre Ossman
  6. *
  7. * Use consistent with the GNU GPL is permitted,
  8. * provided that this copyright notice is
  9. * preserved in its entirety in all copies and derived works.
  10. *
  11. * HEWLETT-PACKARD COMPANY MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
  12. * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
  13. * FITNESS FOR ANY PARTICULAR PURPOSE.
  14. *
  15. * Many thanks to Alessandro Rubini and Jonathan Corbet!
  16. *
  17. * Author: Andrew Christian
  18. * 28 May 2002
  19. */
  20. #include <linux/moduleparam.h>
  21. #include <linux/module.h>
  22. #include <linux/init.h>
  23. #include <linux/kernel.h>
  24. #include <linux/fs.h>
  25. #include <linux/errno.h>
  26. #include <linux/hdreg.h>
  27. #include <linux/kdev_t.h>
  28. #include <linux/blkdev.h>
  29. #include <linux/mutex.h>
  30. #include <linux/scatterlist.h>
  31. #include <linux/string_helpers.h>
  32. #include <linux/mmc/card.h>
  33. #include <linux/mmc/host.h>
  34. #include <linux/mmc/mmc.h>
  35. #include <linux/mmc/sd.h>
  36. #include <asm/system.h>
  37. #include <asm/uaccess.h>
  38. #include "queue.h"
  39. MODULE_ALIAS("mmc:block");
  40. /*
  41. * max 8 partitions per card
  42. */
  43. #define MMC_SHIFT 3
  44. #define MMC_NUM_MINORS (256 >> MMC_SHIFT)
  45. static DECLARE_BITMAP(dev_use, MMC_NUM_MINORS);
  46. /*
  47. * There is one mmc_blk_data per slot.
  48. */
  49. struct mmc_blk_data {
  50. spinlock_t lock;
  51. struct gendisk *disk;
  52. struct mmc_queue queue;
  53. unsigned int usage;
  54. unsigned int read_only;
  55. };
  56. static DEFINE_MUTEX(open_lock);
  57. static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk)
  58. {
  59. struct mmc_blk_data *md;
  60. mutex_lock(&open_lock);
  61. md = disk->private_data;
  62. if (md && md->usage == 0)
  63. md = NULL;
  64. if (md)
  65. md->usage++;
  66. mutex_unlock(&open_lock);
  67. return md;
  68. }
  69. static void mmc_blk_put(struct mmc_blk_data *md)
  70. {
  71. mutex_lock(&open_lock);
  72. md->usage--;
  73. if (md->usage == 0) {
  74. int devidx = MINOR(disk_devt(md->disk)) >> MMC_SHIFT;
  75. __clear_bit(devidx, dev_use);
  76. put_disk(md->disk);
  77. kfree(md);
  78. }
  79. mutex_unlock(&open_lock);
  80. }
  81. static int mmc_blk_open(struct block_device *bdev, fmode_t mode)
  82. {
  83. struct mmc_blk_data *md = mmc_blk_get(bdev->bd_disk);
  84. int ret = -ENXIO;
  85. if (md) {
  86. if (md->usage == 2)
  87. check_disk_change(bdev);
  88. ret = 0;
  89. if ((mode & FMODE_WRITE) && md->read_only) {
  90. mmc_blk_put(md);
  91. ret = -EROFS;
  92. }
  93. }
  94. return ret;
  95. }
  96. static int mmc_blk_release(struct gendisk *disk, fmode_t mode)
  97. {
  98. struct mmc_blk_data *md = disk->private_data;
  99. mmc_blk_put(md);
  100. return 0;
  101. }
  102. static int
  103. mmc_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
  104. {
  105. geo->cylinders = get_capacity(bdev->bd_disk) / (4 * 16);
  106. geo->heads = 4;
  107. geo->sectors = 16;
  108. return 0;
  109. }
  110. static struct block_device_operations mmc_bdops = {
  111. .open = mmc_blk_open,
  112. .release = mmc_blk_release,
  113. .getgeo = mmc_blk_getgeo,
  114. .owner = THIS_MODULE,
  115. };
  116. struct mmc_blk_request {
  117. struct mmc_request mrq;
  118. struct mmc_command cmd;
  119. struct mmc_command stop;
  120. struct mmc_data data;
  121. };
  122. static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
  123. {
  124. int err;
  125. u32 result;
  126. __be32 *blocks;
  127. struct mmc_request mrq;
  128. struct mmc_command cmd;
  129. struct mmc_data data;
  130. unsigned int timeout_us;
  131. struct scatterlist sg;
  132. memset(&cmd, 0, sizeof(struct mmc_command));
  133. cmd.opcode = MMC_APP_CMD;
  134. cmd.arg = card->rca << 16;
  135. cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
  136. err = mmc_wait_for_cmd(card->host, &cmd, 0);
  137. if (err)
  138. return (u32)-1;
  139. if (!mmc_host_is_spi(card->host) && !(cmd.resp[0] & R1_APP_CMD))
  140. return (u32)-1;
  141. memset(&cmd, 0, sizeof(struct mmc_command));
  142. cmd.opcode = SD_APP_SEND_NUM_WR_BLKS;
  143. cmd.arg = 0;
  144. cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
  145. memset(&data, 0, sizeof(struct mmc_data));
  146. data.timeout_ns = card->csd.tacc_ns * 100;
  147. data.timeout_clks = card->csd.tacc_clks * 100;
  148. timeout_us = data.timeout_ns / 1000;
  149. timeout_us += data.timeout_clks * 1000 /
  150. (card->host->ios.clock / 1000);
  151. if (timeout_us > 100000) {
  152. data.timeout_ns = 100000000;
  153. data.timeout_clks = 0;
  154. }
  155. data.blksz = 4;
  156. data.blocks = 1;
  157. data.flags = MMC_DATA_READ;
  158. data.sg = &sg;
  159. data.sg_len = 1;
  160. memset(&mrq, 0, sizeof(struct mmc_request));
  161. mrq.cmd = &cmd;
  162. mrq.data = &data;
  163. blocks = kmalloc(4, GFP_KERNEL);
  164. if (!blocks)
  165. return (u32)-1;
  166. sg_init_one(&sg, blocks, 4);
  167. mmc_wait_for_req(card->host, &mrq);
  168. result = ntohl(*blocks);
  169. kfree(blocks);
  170. if (cmd.error || data.error)
  171. result = (u32)-1;
  172. return result;
  173. }
  174. static u32 get_card_status(struct mmc_card *card, struct request *req)
  175. {
  176. struct mmc_command cmd;
  177. int err;
  178. memset(&cmd, 0, sizeof(struct mmc_command));
  179. cmd.opcode = MMC_SEND_STATUS;
  180. if (!mmc_host_is_spi(card->host))
  181. cmd.arg = card->rca << 16;
  182. cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC;
  183. err = mmc_wait_for_cmd(card->host, &cmd, 0);
  184. if (err)
  185. printk(KERN_ERR "%s: error %d sending status comand",
  186. req->rq_disk->disk_name, err);
  187. return cmd.resp[0];
  188. }
  189. static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
  190. {
  191. struct mmc_blk_data *md = mq->data;
  192. struct mmc_card *card = md->queue.card;
  193. struct mmc_blk_request brq;
  194. int ret = 1, disable_multi = 0;
  195. mmc_claim_host(card->host);
  196. do {
  197. struct mmc_command cmd;
  198. u32 readcmd, writecmd, status = 0;
  199. memset(&brq, 0, sizeof(struct mmc_blk_request));
  200. brq.mrq.cmd = &brq.cmd;
  201. brq.mrq.data = &brq.data;
  202. brq.cmd.arg = blk_rq_pos(req);
  203. if (!mmc_card_blockaddr(card))
  204. brq.cmd.arg <<= 9;
  205. brq.cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
  206. brq.data.blksz = 512;
  207. brq.stop.opcode = MMC_STOP_TRANSMISSION;
  208. brq.stop.arg = 0;
  209. brq.stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
  210. brq.data.blocks = blk_rq_sectors(req);
  211. /*
  212. * The block layer doesn't support all sector count
  213. * restrictions, so we need to be prepared for too big
  214. * requests.
  215. */
  216. if (brq.data.blocks > card->host->max_blk_count)
  217. brq.data.blocks = card->host->max_blk_count;
  218. /*
  219. * After a read error, we redo the request one sector at a time
  220. * in order to accurately determine which sectors can be read
  221. * successfully.
  222. */
  223. if (disable_multi && brq.data.blocks > 1)
  224. brq.data.blocks = 1;
  225. if (brq.data.blocks > 1) {
  226. /* SPI multiblock writes terminate using a special
  227. * token, not a STOP_TRANSMISSION request.
  228. */
  229. if (!mmc_host_is_spi(card->host)
  230. || rq_data_dir(req) == READ)
  231. brq.mrq.stop = &brq.stop;
  232. readcmd = MMC_READ_MULTIPLE_BLOCK;
  233. writecmd = MMC_WRITE_MULTIPLE_BLOCK;
  234. } else {
  235. brq.mrq.stop = NULL;
  236. readcmd = MMC_READ_SINGLE_BLOCK;
  237. writecmd = MMC_WRITE_BLOCK;
  238. }
  239. if (rq_data_dir(req) == READ) {
  240. brq.cmd.opcode = readcmd;
  241. brq.data.flags |= MMC_DATA_READ;
  242. } else {
  243. brq.cmd.opcode = writecmd;
  244. brq.data.flags |= MMC_DATA_WRITE;
  245. }
  246. mmc_set_data_timeout(&brq.data, card);
  247. brq.data.sg = mq->sg;
  248. brq.data.sg_len = mmc_queue_map_sg(mq);
  249. /*
  250. * Adjust the sg list so it is the same size as the
  251. * request.
  252. */
  253. if (brq.data.blocks != blk_rq_sectors(req)) {
  254. int i, data_size = brq.data.blocks << 9;
  255. struct scatterlist *sg;
  256. for_each_sg(brq.data.sg, sg, brq.data.sg_len, i) {
  257. data_size -= sg->length;
  258. if (data_size <= 0) {
  259. sg->length += data_size;
  260. i++;
  261. break;
  262. }
  263. }
  264. brq.data.sg_len = i;
  265. }
  266. mmc_queue_bounce_pre(mq);
  267. mmc_wait_for_req(card->host, &brq.mrq);
  268. mmc_queue_bounce_post(mq);
  269. /*
  270. * Check for errors here, but don't jump to cmd_err
  271. * until later as we need to wait for the card to leave
  272. * programming mode even when things go wrong.
  273. */
  274. if (brq.cmd.error || brq.data.error || brq.stop.error) {
  275. if (brq.data.blocks > 1 && rq_data_dir(req) == READ) {
  276. /* Redo read one sector at a time */
  277. printk(KERN_WARNING "%s: retrying using single "
  278. "block read\n", req->rq_disk->disk_name);
  279. disable_multi = 1;
  280. continue;
  281. }
  282. status = get_card_status(card, req);
  283. }
  284. if (brq.cmd.error) {
  285. printk(KERN_ERR "%s: error %d sending read/write "
  286. "command, response %#x, card status %#x\n",
  287. req->rq_disk->disk_name, brq.cmd.error,
  288. brq.cmd.resp[0], status);
  289. }
  290. if (brq.data.error) {
  291. if (brq.data.error == -ETIMEDOUT && brq.mrq.stop)
  292. /* 'Stop' response contains card status */
  293. status = brq.mrq.stop->resp[0];
  294. printk(KERN_ERR "%s: error %d transferring data,"
  295. " sector %u, nr %u, card status %#x\n",
  296. req->rq_disk->disk_name, brq.data.error,
  297. (unsigned)blk_rq_pos(req),
  298. (unsigned)blk_rq_sectors(req), status);
  299. }
  300. if (brq.stop.error) {
  301. printk(KERN_ERR "%s: error %d sending stop command, "
  302. "response %#x, card status %#x\n",
  303. req->rq_disk->disk_name, brq.stop.error,
  304. brq.stop.resp[0], status);
  305. }
  306. if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) {
  307. do {
  308. int err;
  309. cmd.opcode = MMC_SEND_STATUS;
  310. cmd.arg = card->rca << 16;
  311. cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
  312. err = mmc_wait_for_cmd(card->host, &cmd, 5);
  313. if (err) {
  314. printk(KERN_ERR "%s: error %d requesting status\n",
  315. req->rq_disk->disk_name, err);
  316. goto cmd_err;
  317. }
  318. /*
  319. * Some cards mishandle the status bits,
  320. * so make sure to check both the busy
  321. * indication and the card state.
  322. */
  323. } while (!(cmd.resp[0] & R1_READY_FOR_DATA) ||
  324. (R1_CURRENT_STATE(cmd.resp[0]) == 7));
  325. #if 0
  326. if (cmd.resp[0] & ~0x00000900)
  327. printk(KERN_ERR "%s: status = %08x\n",
  328. req->rq_disk->disk_name, cmd.resp[0]);
  329. if (mmc_decode_status(cmd.resp))
  330. goto cmd_err;
  331. #endif
  332. }
  333. if (brq.cmd.error || brq.stop.error || brq.data.error) {
  334. if (rq_data_dir(req) == READ) {
  335. /*
  336. * After an error, we redo I/O one sector at a
  337. * time, so we only reach here after trying to
  338. * read a single sector.
  339. */
  340. spin_lock_irq(&md->lock);
  341. ret = __blk_end_request(req, -EIO, brq.data.blksz);
  342. spin_unlock_irq(&md->lock);
  343. continue;
  344. }
  345. goto cmd_err;
  346. }
  347. /*
  348. * A block was successfully transferred.
  349. */
  350. spin_lock_irq(&md->lock);
  351. ret = __blk_end_request(req, 0, brq.data.bytes_xfered);
  352. spin_unlock_irq(&md->lock);
  353. } while (ret);
  354. mmc_release_host(card->host);
  355. return 1;
  356. cmd_err:
  357. /*
  358. * If this is an SD card and we're writing, we can first
  359. * mark the known good sectors as ok.
  360. *
  361. * If the card is not SD, we can still ok written sectors
  362. * as reported by the controller (which might be less than
  363. * the real number of written sectors, but never more).
  364. */
  365. if (mmc_card_sd(card)) {
  366. u32 blocks;
  367. blocks = mmc_sd_num_wr_blocks(card);
  368. if (blocks != (u32)-1) {
  369. spin_lock_irq(&md->lock);
  370. ret = __blk_end_request(req, 0, blocks << 9);
  371. spin_unlock_irq(&md->lock);
  372. }
  373. } else {
  374. spin_lock_irq(&md->lock);
  375. ret = __blk_end_request(req, 0, brq.data.bytes_xfered);
  376. spin_unlock_irq(&md->lock);
  377. }
  378. mmc_release_host(card->host);
  379. spin_lock_irq(&md->lock);
  380. while (ret)
  381. ret = __blk_end_request(req, -EIO, blk_rq_cur_bytes(req));
  382. spin_unlock_irq(&md->lock);
  383. return 0;
  384. }
  385. static inline int mmc_blk_readonly(struct mmc_card *card)
  386. {
  387. return mmc_card_readonly(card) ||
  388. !(card->csd.cmdclass & CCC_BLOCK_WRITE);
  389. }
  390. static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
  391. {
  392. struct mmc_blk_data *md;
  393. int devidx, ret;
  394. devidx = find_first_zero_bit(dev_use, MMC_NUM_MINORS);
  395. if (devidx >= MMC_NUM_MINORS)
  396. return ERR_PTR(-ENOSPC);
  397. __set_bit(devidx, dev_use);
  398. md = kzalloc(sizeof(struct mmc_blk_data), GFP_KERNEL);
  399. if (!md) {
  400. ret = -ENOMEM;
  401. goto out;
  402. }
  403. /*
  404. * Set the read-only status based on the supported commands
  405. * and the write protect switch.
  406. */
  407. md->read_only = mmc_blk_readonly(card);
  408. md->disk = alloc_disk(1 << MMC_SHIFT);
  409. if (md->disk == NULL) {
  410. ret = -ENOMEM;
  411. goto err_kfree;
  412. }
  413. spin_lock_init(&md->lock);
  414. md->usage = 1;
  415. ret = mmc_init_queue(&md->queue, card, &md->lock);
  416. if (ret)
  417. goto err_putdisk;
  418. md->queue.issue_fn = mmc_blk_issue_rq;
  419. md->queue.data = md;
  420. md->disk->major = MMC_BLOCK_MAJOR;
  421. md->disk->first_minor = devidx << MMC_SHIFT;
  422. md->disk->fops = &mmc_bdops;
  423. md->disk->private_data = md;
  424. md->disk->queue = md->queue.queue;
  425. md->disk->driverfs_dev = &card->dev;
  426. /*
  427. * As discussed on lkml, GENHD_FL_REMOVABLE should:
  428. *
  429. * - be set for removable media with permanent block devices
  430. * - be unset for removable block devices with permanent media
  431. *
  432. * Since MMC block devices clearly fall under the second
  433. * case, we do not set GENHD_FL_REMOVABLE. Userspace
  434. * should use the block device creation/destruction hotplug
  435. * messages to tell when the card is present.
  436. */
  437. sprintf(md->disk->disk_name, "mmcblk%d", devidx);
  438. blk_queue_logical_block_size(md->queue.queue, 512);
  439. if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) {
  440. /*
  441. * The EXT_CSD sector count is in number or 512 byte
  442. * sectors.
  443. */
  444. set_capacity(md->disk, card->ext_csd.sectors);
  445. } else {
  446. /*
  447. * The CSD capacity field is in units of read_blkbits.
  448. * set_capacity takes units of 512 bytes.
  449. */
  450. set_capacity(md->disk,
  451. card->csd.capacity << (card->csd.read_blkbits - 9));
  452. }
  453. return md;
  454. err_putdisk:
  455. put_disk(md->disk);
  456. err_kfree:
  457. kfree(md);
  458. out:
  459. return ERR_PTR(ret);
  460. }
  461. static int
  462. mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
  463. {
  464. struct mmc_command cmd;
  465. int err;
  466. /* Block-addressed cards ignore MMC_SET_BLOCKLEN. */
  467. if (mmc_card_blockaddr(card))
  468. return 0;
  469. mmc_claim_host(card->host);
  470. cmd.opcode = MMC_SET_BLOCKLEN;
  471. cmd.arg = 512;
  472. cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
  473. err = mmc_wait_for_cmd(card->host, &cmd, 5);
  474. mmc_release_host(card->host);
  475. if (err) {
  476. printk(KERN_ERR "%s: unable to set block size to %d: %d\n",
  477. md->disk->disk_name, cmd.arg, err);
  478. return -EINVAL;
  479. }
  480. return 0;
  481. }
  482. static int mmc_blk_probe(struct mmc_card *card)
  483. {
  484. struct mmc_blk_data *md;
  485. int err;
  486. char cap_str[10];
  487. /*
  488. * Check that the card supports the command class(es) we need.
  489. */
  490. if (!(card->csd.cmdclass & CCC_BLOCK_READ))
  491. return -ENODEV;
  492. md = mmc_blk_alloc(card);
  493. if (IS_ERR(md))
  494. return PTR_ERR(md);
  495. err = mmc_blk_set_blksize(md, card);
  496. if (err)
  497. goto out;
  498. string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2,
  499. cap_str, sizeof(cap_str));
  500. printk(KERN_INFO "%s: %s %s %s %s\n",
  501. md->disk->disk_name, mmc_card_id(card), mmc_card_name(card),
  502. cap_str, md->read_only ? "(ro)" : "");
  503. mmc_set_drvdata(card, md);
  504. add_disk(md->disk);
  505. return 0;
  506. out:
  507. mmc_blk_put(md);
  508. return err;
  509. }
  510. static void mmc_blk_remove(struct mmc_card *card)
  511. {
  512. struct mmc_blk_data *md = mmc_get_drvdata(card);
  513. if (md) {
  514. /* Stop new requests from getting into the queue */
  515. del_gendisk(md->disk);
  516. /* Then flush out any already in there */
  517. mmc_cleanup_queue(&md->queue);
  518. mmc_blk_put(md);
  519. }
  520. mmc_set_drvdata(card, NULL);
  521. }
  522. #ifdef CONFIG_PM
  523. static int mmc_blk_suspend(struct mmc_card *card, pm_message_t state)
  524. {
  525. struct mmc_blk_data *md = mmc_get_drvdata(card);
  526. if (md) {
  527. mmc_queue_suspend(&md->queue);
  528. }
  529. return 0;
  530. }
  531. static int mmc_blk_resume(struct mmc_card *card)
  532. {
  533. struct mmc_blk_data *md = mmc_get_drvdata(card);
  534. if (md) {
  535. mmc_blk_set_blksize(md, card);
  536. mmc_queue_resume(&md->queue);
  537. }
  538. return 0;
  539. }
  540. #else
  541. #define mmc_blk_suspend NULL
  542. #define mmc_blk_resume NULL
  543. #endif
  544. static struct mmc_driver mmc_driver = {
  545. .drv = {
  546. .name = "mmcblk",
  547. },
  548. .probe = mmc_blk_probe,
  549. .remove = mmc_blk_remove,
  550. .suspend = mmc_blk_suspend,
  551. .resume = mmc_blk_resume,
  552. };
  553. static int __init mmc_blk_init(void)
  554. {
  555. int res;
  556. res = register_blkdev(MMC_BLOCK_MAJOR, "mmc");
  557. if (res)
  558. goto out;
  559. res = mmc_register_driver(&mmc_driver);
  560. if (res)
  561. goto out2;
  562. return 0;
  563. out2:
  564. unregister_blkdev(MMC_BLOCK_MAJOR, "mmc");
  565. out:
  566. return res;
  567. }
  568. static void __exit mmc_blk_exit(void)
  569. {
  570. mmc_unregister_driver(&mmc_driver);
  571. unregister_blkdev(MMC_BLOCK_MAJOR, "mmc");
  572. }
  573. module_init(mmc_blk_init);
  574. module_exit(mmc_blk_exit);
  575. MODULE_LICENSE("GPL");
  576. MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");