1
0

065-v4.13-0005-mtd-partitions-rename-master-to-the-parent-where-app.patch 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. From 0a9d72b69da6d8dae1abd7990c6c4c749846ef3e Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  3. Date: Wed, 21 Jun 2017 08:26:44 +0200
  4. Subject: [PATCH] mtd: partitions: rename "master" to the "parent" where
  5. appropriate
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. This prepares mtd subsystem for the new feature: subpartitions. In some
  10. cases flash device partition can be a container with extra subpartitions
  11. (volumes).
  12. So far there was a flat structure implemented. One master (flash device)
  13. could be partitioned into few partitions. Every partition got its master
  14. and it was enough to get things running.
  15. To support subpartitions we need to store pointer to the parent for each
  16. partition. This is required to implement more natural tree structure and
  17. handle all recursion and offsets calculation.
  18. To make code consistent this patch renamed "master" to the "parent" in
  19. places where we can be dealing with subpartitions.
  20. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  21. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
  22. ---
  23. drivers/mtd/mtdpart.c | 204 ++++++++++++++++++++++++++------------------------
  24. 1 file changed, 105 insertions(+), 99 deletions(-)
  25. --- a/drivers/mtd/mtdpart.c
  26. +++ b/drivers/mtd/mtdpart.c
  27. @@ -37,10 +37,16 @@
  28. static LIST_HEAD(mtd_partitions);
  29. static DEFINE_MUTEX(mtd_partitions_mutex);
  30. -/* Our partition node structure */
  31. +/**
  32. + * struct mtd_part - our partition node structure
  33. + *
  34. + * @mtd: struct holding partition details
  35. + * @parent: parent mtd - flash device or another partition
  36. + * @offset: partition offset relative to the *flash device*
  37. + */
  38. struct mtd_part {
  39. struct mtd_info mtd;
  40. - struct mtd_info *master;
  41. + struct mtd_info *parent;
  42. uint64_t offset;
  43. struct list_head list;
  44. };
  45. @@ -67,15 +73,15 @@ static int part_read(struct mtd_info *mt
  46. struct mtd_ecc_stats stats;
  47. int res;
  48. - stats = part->master->ecc_stats;
  49. - res = part->master->_read(part->master, from + part->offset, len,
  50. + stats = part->parent->ecc_stats;
  51. + res = part->parent->_read(part->parent, from + part->offset, len,
  52. retlen, buf);
  53. if (unlikely(mtd_is_eccerr(res)))
  54. mtd->ecc_stats.failed +=
  55. - part->master->ecc_stats.failed - stats.failed;
  56. + part->parent->ecc_stats.failed - stats.failed;
  57. else
  58. mtd->ecc_stats.corrected +=
  59. - part->master->ecc_stats.corrected - stats.corrected;
  60. + part->parent->ecc_stats.corrected - stats.corrected;
  61. return res;
  62. }
  63. @@ -84,7 +90,7 @@ static int part_point(struct mtd_info *m
  64. {
  65. struct mtd_part *part = mtd_to_part(mtd);
  66. - return part->master->_point(part->master, from + part->offset, len,
  67. + return part->parent->_point(part->parent, from + part->offset, len,
  68. retlen, virt, phys);
  69. }
  70. @@ -92,7 +98,7 @@ static int part_unpoint(struct mtd_info
  71. {
  72. struct mtd_part *part = mtd_to_part(mtd);
  73. - return part->master->_unpoint(part->master, from + part->offset, len);
  74. + return part->parent->_unpoint(part->parent, from + part->offset, len);
  75. }
  76. static unsigned long part_get_unmapped_area(struct mtd_info *mtd,
  77. @@ -103,7 +109,7 @@ static unsigned long part_get_unmapped_a
  78. struct mtd_part *part = mtd_to_part(mtd);
  79. offset += part->offset;
  80. - return part->master->_get_unmapped_area(part->master, len, offset,
  81. + return part->parent->_get_unmapped_area(part->parent, len, offset,
  82. flags);
  83. }
  84. @@ -132,7 +138,7 @@ static int part_read_oob(struct mtd_info
  85. return -EINVAL;
  86. }
  87. - res = part->master->_read_oob(part->master, from + part->offset, ops);
  88. + res = part->parent->_read_oob(part->parent, from + part->offset, ops);
  89. if (unlikely(res)) {
  90. if (mtd_is_bitflip(res))
  91. mtd->ecc_stats.corrected++;
  92. @@ -146,7 +152,7 @@ static int part_read_user_prot_reg(struc
  93. size_t len, size_t *retlen, u_char *buf)
  94. {
  95. struct mtd_part *part = mtd_to_part(mtd);
  96. - return part->master->_read_user_prot_reg(part->master, from, len,
  97. + return part->parent->_read_user_prot_reg(part->parent, from, len,
  98. retlen, buf);
  99. }
  100. @@ -154,7 +160,7 @@ static int part_get_user_prot_info(struc
  101. size_t *retlen, struct otp_info *buf)
  102. {
  103. struct mtd_part *part = mtd_to_part(mtd);
  104. - return part->master->_get_user_prot_info(part->master, len, retlen,
  105. + return part->parent->_get_user_prot_info(part->parent, len, retlen,
  106. buf);
  107. }
  108. @@ -162,7 +168,7 @@ static int part_read_fact_prot_reg(struc
  109. size_t len, size_t *retlen, u_char *buf)
  110. {
  111. struct mtd_part *part = mtd_to_part(mtd);
  112. - return part->master->_read_fact_prot_reg(part->master, from, len,
  113. + return part->parent->_read_fact_prot_reg(part->parent, from, len,
  114. retlen, buf);
  115. }
  116. @@ -170,7 +176,7 @@ static int part_get_fact_prot_info(struc
  117. size_t *retlen, struct otp_info *buf)
  118. {
  119. struct mtd_part *part = mtd_to_part(mtd);
  120. - return part->master->_get_fact_prot_info(part->master, len, retlen,
  121. + return part->parent->_get_fact_prot_info(part->parent, len, retlen,
  122. buf);
  123. }
  124. @@ -178,7 +184,7 @@ static int part_write(struct mtd_info *m
  125. size_t *retlen, const u_char *buf)
  126. {
  127. struct mtd_part *part = mtd_to_part(mtd);
  128. - return part->master->_write(part->master, to + part->offset, len,
  129. + return part->parent->_write(part->parent, to + part->offset, len,
  130. retlen, buf);
  131. }
  132. @@ -186,7 +192,7 @@ static int part_panic_write(struct mtd_i
  133. size_t *retlen, const u_char *buf)
  134. {
  135. struct mtd_part *part = mtd_to_part(mtd);
  136. - return part->master->_panic_write(part->master, to + part->offset, len,
  137. + return part->parent->_panic_write(part->parent, to + part->offset, len,
  138. retlen, buf);
  139. }
  140. @@ -199,14 +205,14 @@ static int part_write_oob(struct mtd_inf
  141. return -EINVAL;
  142. if (ops->datbuf && to + ops->len > mtd->size)
  143. return -EINVAL;
  144. - return part->master->_write_oob(part->master, to + part->offset, ops);
  145. + return part->parent->_write_oob(part->parent, to + part->offset, ops);
  146. }
  147. static int part_write_user_prot_reg(struct mtd_info *mtd, loff_t from,
  148. size_t len, size_t *retlen, u_char *buf)
  149. {
  150. struct mtd_part *part = mtd_to_part(mtd);
  151. - return part->master->_write_user_prot_reg(part->master, from, len,
  152. + return part->parent->_write_user_prot_reg(part->parent, from, len,
  153. retlen, buf);
  154. }
  155. @@ -214,14 +220,14 @@ static int part_lock_user_prot_reg(struc
  156. size_t len)
  157. {
  158. struct mtd_part *part = mtd_to_part(mtd);
  159. - return part->master->_lock_user_prot_reg(part->master, from, len);
  160. + return part->parent->_lock_user_prot_reg(part->parent, from, len);
  161. }
  162. static int part_writev(struct mtd_info *mtd, const struct kvec *vecs,
  163. unsigned long count, loff_t to, size_t *retlen)
  164. {
  165. struct mtd_part *part = mtd_to_part(mtd);
  166. - return part->master->_writev(part->master, vecs, count,
  167. + return part->parent->_writev(part->parent, vecs, count,
  168. to + part->offset, retlen);
  169. }
  170. @@ -231,7 +237,7 @@ static int part_erase(struct mtd_info *m
  171. int ret;
  172. instr->addr += part->offset;
  173. - ret = part->master->_erase(part->master, instr);
  174. + ret = part->parent->_erase(part->parent, instr);
  175. if (ret) {
  176. if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
  177. instr->fail_addr -= part->offset;
  178. @@ -257,51 +263,51 @@ EXPORT_SYMBOL_GPL(mtd_erase_callback);
  179. static int part_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
  180. {
  181. struct mtd_part *part = mtd_to_part(mtd);
  182. - return part->master->_lock(part->master, ofs + part->offset, len);
  183. + return part->parent->_lock(part->parent, ofs + part->offset, len);
  184. }
  185. static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
  186. {
  187. struct mtd_part *part = mtd_to_part(mtd);
  188. - return part->master->_unlock(part->master, ofs + part->offset, len);
  189. + return part->parent->_unlock(part->parent, ofs + part->offset, len);
  190. }
  191. static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
  192. {
  193. struct mtd_part *part = mtd_to_part(mtd);
  194. - return part->master->_is_locked(part->master, ofs + part->offset, len);
  195. + return part->parent->_is_locked(part->parent, ofs + part->offset, len);
  196. }
  197. static void part_sync(struct mtd_info *mtd)
  198. {
  199. struct mtd_part *part = mtd_to_part(mtd);
  200. - part->master->_sync(part->master);
  201. + part->parent->_sync(part->parent);
  202. }
  203. static int part_suspend(struct mtd_info *mtd)
  204. {
  205. struct mtd_part *part = mtd_to_part(mtd);
  206. - return part->master->_suspend(part->master);
  207. + return part->parent->_suspend(part->parent);
  208. }
  209. static void part_resume(struct mtd_info *mtd)
  210. {
  211. struct mtd_part *part = mtd_to_part(mtd);
  212. - part->master->_resume(part->master);
  213. + part->parent->_resume(part->parent);
  214. }
  215. static int part_block_isreserved(struct mtd_info *mtd, loff_t ofs)
  216. {
  217. struct mtd_part *part = mtd_to_part(mtd);
  218. ofs += part->offset;
  219. - return part->master->_block_isreserved(part->master, ofs);
  220. + return part->parent->_block_isreserved(part->parent, ofs);
  221. }
  222. static int part_block_isbad(struct mtd_info *mtd, loff_t ofs)
  223. {
  224. struct mtd_part *part = mtd_to_part(mtd);
  225. ofs += part->offset;
  226. - return part->master->_block_isbad(part->master, ofs);
  227. + return part->parent->_block_isbad(part->parent, ofs);
  228. }
  229. static int part_block_markbad(struct mtd_info *mtd, loff_t ofs)
  230. @@ -310,7 +316,7 @@ static int part_block_markbad(struct mtd
  231. int res;
  232. ofs += part->offset;
  233. - res = part->master->_block_markbad(part->master, ofs);
  234. + res = part->parent->_block_markbad(part->parent, ofs);
  235. if (!res)
  236. mtd->ecc_stats.badblocks++;
  237. return res;
  238. @@ -319,13 +325,13 @@ static int part_block_markbad(struct mtd
  239. static int part_get_device(struct mtd_info *mtd)
  240. {
  241. struct mtd_part *part = mtd_to_part(mtd);
  242. - return part->master->_get_device(part->master);
  243. + return part->parent->_get_device(part->parent);
  244. }
  245. static void part_put_device(struct mtd_info *mtd)
  246. {
  247. struct mtd_part *part = mtd_to_part(mtd);
  248. - part->master->_put_device(part->master);
  249. + part->parent->_put_device(part->parent);
  250. }
  251. static int part_ooblayout_ecc(struct mtd_info *mtd, int section,
  252. @@ -333,7 +339,7 @@ static int part_ooblayout_ecc(struct mtd
  253. {
  254. struct mtd_part *part = mtd_to_part(mtd);
  255. - return mtd_ooblayout_ecc(part->master, section, oobregion);
  256. + return mtd_ooblayout_ecc(part->parent, section, oobregion);
  257. }
  258. static int part_ooblayout_free(struct mtd_info *mtd, int section,
  259. @@ -341,7 +347,7 @@ static int part_ooblayout_free(struct mt
  260. {
  261. struct mtd_part *part = mtd_to_part(mtd);
  262. - return mtd_ooblayout_free(part->master, section, oobregion);
  263. + return mtd_ooblayout_free(part->parent, section, oobregion);
  264. }
  265. static const struct mtd_ooblayout_ops part_ooblayout_ops = {
  266. @@ -353,7 +359,7 @@ static int part_max_bad_blocks(struct mt
  267. {
  268. struct mtd_part *part = mtd_to_part(mtd);
  269. - return part->master->_max_bad_blocks(part->master,
  270. + return part->parent->_max_bad_blocks(part->parent,
  271. ofs + part->offset, len);
  272. }
  273. @@ -363,12 +369,12 @@ static inline void free_partition(struct
  274. kfree(p);
  275. }
  276. -static struct mtd_part *allocate_partition(struct mtd_info *master,
  277. +static struct mtd_part *allocate_partition(struct mtd_info *parent,
  278. const struct mtd_partition *part, int partno,
  279. uint64_t cur_offset)
  280. {
  281. - int wr_alignment = (master->flags & MTD_NO_ERASE) ? master->writesize:
  282. - master->erasesize;
  283. + int wr_alignment = (parent->flags & MTD_NO_ERASE) ? parent->writesize:
  284. + parent->erasesize;
  285. struct mtd_part *slave;
  286. u32 remainder;
  287. char *name;
  288. @@ -379,25 +385,25 @@ static struct mtd_part *allocate_partiti
  289. name = kstrdup(part->name, GFP_KERNEL);
  290. if (!name || !slave) {
  291. printk(KERN_ERR"memory allocation error while creating partitions for \"%s\"\n",
  292. - master->name);
  293. + parent->name);
  294. kfree(name);
  295. kfree(slave);
  296. return ERR_PTR(-ENOMEM);
  297. }
  298. /* set up the MTD object for this partition */
  299. - slave->mtd.type = master->type;
  300. - slave->mtd.flags = master->flags & ~part->mask_flags;
  301. + slave->mtd.type = parent->type;
  302. + slave->mtd.flags = parent->flags & ~part->mask_flags;
  303. slave->mtd.size = part->size;
  304. - slave->mtd.writesize = master->writesize;
  305. - slave->mtd.writebufsize = master->writebufsize;
  306. - slave->mtd.oobsize = master->oobsize;
  307. - slave->mtd.oobavail = master->oobavail;
  308. - slave->mtd.subpage_sft = master->subpage_sft;
  309. - slave->mtd.pairing = master->pairing;
  310. + slave->mtd.writesize = parent->writesize;
  311. + slave->mtd.writebufsize = parent->writebufsize;
  312. + slave->mtd.oobsize = parent->oobsize;
  313. + slave->mtd.oobavail = parent->oobavail;
  314. + slave->mtd.subpage_sft = parent->subpage_sft;
  315. + slave->mtd.pairing = parent->pairing;
  316. slave->mtd.name = name;
  317. - slave->mtd.owner = master->owner;
  318. + slave->mtd.owner = parent->owner;
  319. /* NOTE: Historically, we didn't arrange MTDs as a tree out of
  320. * concern for showing the same data in multiple partitions.
  321. @@ -408,70 +414,70 @@ static struct mtd_part *allocate_partiti
  322. * distinguish between the master and the partition in sysfs.
  323. */
  324. slave->mtd.dev.parent = IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER) ?
  325. - &master->dev :
  326. - master->dev.parent;
  327. + &parent->dev :
  328. + parent->dev.parent;
  329. slave->mtd.dev.of_node = part->of_node;
  330. slave->mtd._read = part_read;
  331. slave->mtd._write = part_write;
  332. - if (master->_panic_write)
  333. + if (parent->_panic_write)
  334. slave->mtd._panic_write = part_panic_write;
  335. - if (master->_point && master->_unpoint) {
  336. + if (parent->_point && parent->_unpoint) {
  337. slave->mtd._point = part_point;
  338. slave->mtd._unpoint = part_unpoint;
  339. }
  340. - if (master->_get_unmapped_area)
  341. + if (parent->_get_unmapped_area)
  342. slave->mtd._get_unmapped_area = part_get_unmapped_area;
  343. - if (master->_read_oob)
  344. + if (parent->_read_oob)
  345. slave->mtd._read_oob = part_read_oob;
  346. - if (master->_write_oob)
  347. + if (parent->_write_oob)
  348. slave->mtd._write_oob = part_write_oob;
  349. - if (master->_read_user_prot_reg)
  350. + if (parent->_read_user_prot_reg)
  351. slave->mtd._read_user_prot_reg = part_read_user_prot_reg;
  352. - if (master->_read_fact_prot_reg)
  353. + if (parent->_read_fact_prot_reg)
  354. slave->mtd._read_fact_prot_reg = part_read_fact_prot_reg;
  355. - if (master->_write_user_prot_reg)
  356. + if (parent->_write_user_prot_reg)
  357. slave->mtd._write_user_prot_reg = part_write_user_prot_reg;
  358. - if (master->_lock_user_prot_reg)
  359. + if (parent->_lock_user_prot_reg)
  360. slave->mtd._lock_user_prot_reg = part_lock_user_prot_reg;
  361. - if (master->_get_user_prot_info)
  362. + if (parent->_get_user_prot_info)
  363. slave->mtd._get_user_prot_info = part_get_user_prot_info;
  364. - if (master->_get_fact_prot_info)
  365. + if (parent->_get_fact_prot_info)
  366. slave->mtd._get_fact_prot_info = part_get_fact_prot_info;
  367. - if (master->_sync)
  368. + if (parent->_sync)
  369. slave->mtd._sync = part_sync;
  370. - if (!partno && !master->dev.class && master->_suspend &&
  371. - master->_resume) {
  372. + if (!partno && !parent->dev.class && parent->_suspend &&
  373. + parent->_resume) {
  374. slave->mtd._suspend = part_suspend;
  375. slave->mtd._resume = part_resume;
  376. }
  377. - if (master->_writev)
  378. + if (parent->_writev)
  379. slave->mtd._writev = part_writev;
  380. - if (master->_lock)
  381. + if (parent->_lock)
  382. slave->mtd._lock = part_lock;
  383. - if (master->_unlock)
  384. + if (parent->_unlock)
  385. slave->mtd._unlock = part_unlock;
  386. - if (master->_is_locked)
  387. + if (parent->_is_locked)
  388. slave->mtd._is_locked = part_is_locked;
  389. - if (master->_block_isreserved)
  390. + if (parent->_block_isreserved)
  391. slave->mtd._block_isreserved = part_block_isreserved;
  392. - if (master->_block_isbad)
  393. + if (parent->_block_isbad)
  394. slave->mtd._block_isbad = part_block_isbad;
  395. - if (master->_block_markbad)
  396. + if (parent->_block_markbad)
  397. slave->mtd._block_markbad = part_block_markbad;
  398. - if (master->_max_bad_blocks)
  399. + if (parent->_max_bad_blocks)
  400. slave->mtd._max_bad_blocks = part_max_bad_blocks;
  401. - if (master->_get_device)
  402. + if (parent->_get_device)
  403. slave->mtd._get_device = part_get_device;
  404. - if (master->_put_device)
  405. + if (parent->_put_device)
  406. slave->mtd._put_device = part_put_device;
  407. slave->mtd._erase = part_erase;
  408. - slave->master = master;
  409. + slave->parent = parent;
  410. slave->offset = part->offset;
  411. if (slave->offset == MTDPART_OFS_APPEND)
  412. @@ -489,25 +495,25 @@ static struct mtd_part *allocate_partiti
  413. }
  414. if (slave->offset == MTDPART_OFS_RETAIN) {
  415. slave->offset = cur_offset;
  416. - if (master->size - slave->offset >= slave->mtd.size) {
  417. - slave->mtd.size = master->size - slave->offset
  418. + if (parent->size - slave->offset >= slave->mtd.size) {
  419. + slave->mtd.size = parent->size - slave->offset
  420. - slave->mtd.size;
  421. } else {
  422. printk(KERN_ERR "mtd partition \"%s\" doesn't have enough space: %#llx < %#llx, disabled\n",
  423. - part->name, master->size - slave->offset,
  424. + part->name, parent->size - slave->offset,
  425. slave->mtd.size);
  426. /* register to preserve ordering */
  427. goto out_register;
  428. }
  429. }
  430. if (slave->mtd.size == MTDPART_SIZ_FULL)
  431. - slave->mtd.size = master->size - slave->offset;
  432. + slave->mtd.size = parent->size - slave->offset;
  433. printk(KERN_NOTICE "0x%012llx-0x%012llx : \"%s\"\n", (unsigned long long)slave->offset,
  434. (unsigned long long)(slave->offset + slave->mtd.size), slave->mtd.name);
  435. /* let's do some sanity checks */
  436. - if (slave->offset >= master->size) {
  437. + if (slave->offset >= parent->size) {
  438. /* let's register it anyway to preserve ordering */
  439. slave->offset = 0;
  440. slave->mtd.size = 0;
  441. @@ -515,16 +521,16 @@ static struct mtd_part *allocate_partiti
  442. part->name);
  443. goto out_register;
  444. }
  445. - if (slave->offset + slave->mtd.size > master->size) {
  446. - slave->mtd.size = master->size - slave->offset;
  447. + if (slave->offset + slave->mtd.size > parent->size) {
  448. + slave->mtd.size = parent->size - slave->offset;
  449. printk(KERN_WARNING"mtd: partition \"%s\" extends beyond the end of device \"%s\" -- size truncated to %#llx\n",
  450. - part->name, master->name, (unsigned long long)slave->mtd.size);
  451. + part->name, parent->name, (unsigned long long)slave->mtd.size);
  452. }
  453. - if (master->numeraseregions > 1) {
  454. + if (parent->numeraseregions > 1) {
  455. /* Deal with variable erase size stuff */
  456. - int i, max = master->numeraseregions;
  457. + int i, max = parent->numeraseregions;
  458. u64 end = slave->offset + slave->mtd.size;
  459. - struct mtd_erase_region_info *regions = master->eraseregions;
  460. + struct mtd_erase_region_info *regions = parent->eraseregions;
  461. /* Find the first erase regions which is part of this
  462. * partition. */
  463. @@ -543,7 +549,7 @@ static struct mtd_part *allocate_partiti
  464. BUG_ON(slave->mtd.erasesize == 0);
  465. } else {
  466. /* Single erase size */
  467. - slave->mtd.erasesize = master->erasesize;
  468. + slave->mtd.erasesize = parent->erasesize;
  469. }
  470. tmp = slave->offset;
  471. @@ -566,17 +572,17 @@ static struct mtd_part *allocate_partiti
  472. }
  473. mtd_set_ooblayout(&slave->mtd, &part_ooblayout_ops);
  474. - slave->mtd.ecc_step_size = master->ecc_step_size;
  475. - slave->mtd.ecc_strength = master->ecc_strength;
  476. - slave->mtd.bitflip_threshold = master->bitflip_threshold;
  477. + slave->mtd.ecc_step_size = parent->ecc_step_size;
  478. + slave->mtd.ecc_strength = parent->ecc_strength;
  479. + slave->mtd.bitflip_threshold = parent->bitflip_threshold;
  480. - if (master->_block_isbad) {
  481. + if (parent->_block_isbad) {
  482. uint64_t offs = 0;
  483. while (offs < slave->mtd.size) {
  484. - if (mtd_block_isreserved(master, offs + slave->offset))
  485. + if (mtd_block_isreserved(parent, offs + slave->offset))
  486. slave->mtd.ecc_stats.bbtblocks++;
  487. - else if (mtd_block_isbad(master, offs + slave->offset))
  488. + else if (mtd_block_isbad(parent, offs + slave->offset))
  489. slave->mtd.ecc_stats.badblocks++;
  490. offs += slave->mtd.erasesize;
  491. }
  492. @@ -610,7 +616,7 @@ static int mtd_add_partition_attrs(struc
  493. return ret;
  494. }
  495. -int mtd_add_partition(struct mtd_info *master, const char *name,
  496. +int mtd_add_partition(struct mtd_info *parent, const char *name,
  497. long long offset, long long length)
  498. {
  499. struct mtd_partition part;
  500. @@ -623,7 +629,7 @@ int mtd_add_partition(struct mtd_info *m
  501. return -EINVAL;
  502. if (length == MTDPART_SIZ_FULL)
  503. - length = master->size - offset;
  504. + length = parent->size - offset;
  505. if (length <= 0)
  506. return -EINVAL;
  507. @@ -633,7 +639,7 @@ int mtd_add_partition(struct mtd_info *m
  508. part.size = length;
  509. part.offset = offset;
  510. - new = allocate_partition(master, &part, -1, offset);
  511. + new = allocate_partition(parent, &part, -1, offset);
  512. if (IS_ERR(new))
  513. return PTR_ERR(new);
  514. @@ -683,7 +689,7 @@ int del_mtd_partitions(struct mtd_info *
  515. mutex_lock(&mtd_partitions_mutex);
  516. list_for_each_entry_safe(slave, next, &mtd_partitions, list)
  517. - if (slave->master == master) {
  518. + if (slave->parent == master) {
  519. ret = __mtd_del_partition(slave);
  520. if (ret < 0)
  521. err = ret;
  522. @@ -700,7 +706,7 @@ int mtd_del_partition(struct mtd_info *m
  523. mutex_lock(&mtd_partitions_mutex);
  524. list_for_each_entry_safe(slave, next, &mtd_partitions, list)
  525. - if ((slave->master == master) &&
  526. + if ((slave->parent == master) &&
  527. (slave->mtd.index == partno)) {
  528. ret = __mtd_del_partition(slave);
  529. break;
  530. @@ -933,6 +939,6 @@ uint64_t mtd_get_device_size(const struc
  531. if (!mtd_is_partition(mtd))
  532. return mtd->size;
  533. - return mtd_to_part(mtd)->master->size;
  534. + return mtd_to_part(mtd)->parent->size;
  535. }
  536. EXPORT_SYMBOL_GPL(mtd_get_device_size);