Skip to content

Commit 3c3c10b

Browse files
dedekindDavid Woodhouse
authored andcommitted
mtd: add leading underscore to all mtd functions
This patch renames all MTD functions by adding a "_" prefix: mtd->erase -> mtd->_erase mtd->read_oob -> mtd->_read_oob ... The reason is that we are re-working the MTD API and from now on it is an error to use MTD function pointers directly - we have a corresponding API call for every pointer. By adding a leading "_" we achieve the following: 1. Make sure we convert every direct pointer users 2. A leading "_" suggests that this interface is internal and it becomes less likely that people will use them directly 3. Make sure all the out-of-tree modules stop compiling and the owners spot the big API change and amend them. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent a6c2285 commit 3c3c10b

36 files changed

Lines changed: 350 additions & 349 deletions

‎drivers/mtd/chips/cfi_cmdset_0001.c‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ static void fixup_st_m28w320cb(struct mtd_info *mtd)
262262
static void fixup_use_point(struct mtd_info *mtd)
263263
{
264264
struct map_info *map = mtd->priv;
265-
if (!mtd->point && map_is_linear(map)) {
266-
mtd->point = cfi_intelext_point;
267-
mtd->unpoint = cfi_intelext_unpoint;
265+
if (!mtd->_point && map_is_linear(map)) {
266+
mtd->_point = cfi_intelext_point;
267+
mtd->_unpoint = cfi_intelext_unpoint;
268268
}
269269
}
270270

@@ -274,8 +274,8 @@ static void fixup_use_write_buffers(struct mtd_info *mtd)
274274
struct cfi_private *cfi = map->fldrv_priv;
275275
if (cfi->cfiq->BufWriteTimeoutTyp) {
276276
printk(KERN_INFO "Using buffer write method\n" );
277-
mtd->write = cfi_intelext_write_buffers;
278-
mtd->writev = cfi_intelext_writev;
277+
mtd->_write = cfi_intelext_write_buffers;
278+
mtd->_writev = cfi_intelext_writev;
279279
}
280280
}
281281

@@ -443,15 +443,15 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
443443
mtd->type = MTD_NORFLASH;
444444

445445
/* Fill in the default mtd operations */
446-
mtd->erase = cfi_intelext_erase_varsize;
447-
mtd->read = cfi_intelext_read;
448-
mtd->write = cfi_intelext_write_words;
449-
mtd->sync = cfi_intelext_sync;
450-
mtd->lock = cfi_intelext_lock;
451-
mtd->unlock = cfi_intelext_unlock;
452-
mtd->is_locked = cfi_intelext_is_locked;
453-
mtd->suspend = cfi_intelext_suspend;
454-
mtd->resume = cfi_intelext_resume;
446+
mtd->_erase = cfi_intelext_erase_varsize;
447+
mtd->_read = cfi_intelext_read;
448+
mtd->_write = cfi_intelext_write_words;
449+
mtd->_sync = cfi_intelext_sync;
450+
mtd->_lock = cfi_intelext_lock;
451+
mtd->_unlock = cfi_intelext_unlock;
452+
mtd->_is_locked = cfi_intelext_is_locked;
453+
mtd->_suspend = cfi_intelext_suspend;
454+
mtd->_resume = cfi_intelext_resume;
455455
mtd->flags = MTD_CAP_NORFLASH;
456456
mtd->name = map->name;
457457
mtd->writesize = 1;
@@ -600,12 +600,12 @@ static struct mtd_info *cfi_intelext_setup(struct mtd_info *mtd)
600600
}
601601

602602
#ifdef CONFIG_MTD_OTP
603-
mtd->read_fact_prot_reg = cfi_intelext_read_fact_prot_reg;
604-
mtd->read_user_prot_reg = cfi_intelext_read_user_prot_reg;
605-
mtd->write_user_prot_reg = cfi_intelext_write_user_prot_reg;
606-
mtd->lock_user_prot_reg = cfi_intelext_lock_user_prot_reg;
607-
mtd->get_fact_prot_info = cfi_intelext_get_fact_prot_info;
608-
mtd->get_user_prot_info = cfi_intelext_get_user_prot_info;
603+
mtd->_read_fact_prot_reg = cfi_intelext_read_fact_prot_reg;
604+
mtd->_read_user_prot_reg = cfi_intelext_read_user_prot_reg;
605+
mtd->_write_user_prot_reg = cfi_intelext_write_user_prot_reg;
606+
mtd->_lock_user_prot_reg = cfi_intelext_lock_user_prot_reg;
607+
mtd->_get_fact_prot_info = cfi_intelext_get_fact_prot_info;
608+
mtd->_get_user_prot_info = cfi_intelext_get_user_prot_info;
609609
#endif
610610

611611
/* This function has the potential to distort the reality

‎drivers/mtd/chips/cfi_cmdset_0002.c‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static void fixup_use_write_buffers(struct mtd_info *mtd)
192192
struct cfi_private *cfi = map->fldrv_priv;
193193
if (cfi->cfiq->BufWriteTimeoutTyp) {
194194
pr_debug("Using buffer write method\n" );
195-
mtd->write = cfi_amdstd_write_buffers;
195+
mtd->_write = cfi_amdstd_write_buffers;
196196
}
197197
}
198198

@@ -231,8 +231,8 @@ static void fixup_convert_atmel_pri(struct mtd_info *mtd)
231231
static void fixup_use_secsi(struct mtd_info *mtd)
232232
{
233233
/* Setup for chips with a secsi area */
234-
mtd->read_user_prot_reg = cfi_amdstd_secsi_read;
235-
mtd->read_fact_prot_reg = cfi_amdstd_secsi_read;
234+
mtd->_read_user_prot_reg = cfi_amdstd_secsi_read;
235+
mtd->_read_fact_prot_reg = cfi_amdstd_secsi_read;
236236
}
237237

238238
static void fixup_use_erase_chip(struct mtd_info *mtd)
@@ -241,7 +241,7 @@ static void fixup_use_erase_chip(struct mtd_info *mtd)
241241
struct cfi_private *cfi = map->fldrv_priv;
242242
if ((cfi->cfiq->NumEraseRegions == 1) &&
243243
((cfi->cfiq->EraseRegionInfo[0] & 0xffff) == 0)) {
244-
mtd->erase = cfi_amdstd_erase_chip;
244+
mtd->_erase = cfi_amdstd_erase_chip;
245245
}
246246

247247
}
@@ -252,8 +252,8 @@ static void fixup_use_erase_chip(struct mtd_info *mtd)
252252
*/
253253
static void fixup_use_atmel_lock(struct mtd_info *mtd)
254254
{
255-
mtd->lock = cfi_atmel_lock;
256-
mtd->unlock = cfi_atmel_unlock;
255+
mtd->_lock = cfi_atmel_lock;
256+
mtd->_unlock = cfi_atmel_unlock;
257257
mtd->flags |= MTD_POWERUP_LOCK;
258258
}
259259

@@ -432,12 +432,12 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
432432
mtd->type = MTD_NORFLASH;
433433

434434
/* Fill in the default mtd operations */
435-
mtd->erase = cfi_amdstd_erase_varsize;
436-
mtd->write = cfi_amdstd_write_words;
437-
mtd->read = cfi_amdstd_read;
438-
mtd->sync = cfi_amdstd_sync;
439-
mtd->suspend = cfi_amdstd_suspend;
440-
mtd->resume = cfi_amdstd_resume;
435+
mtd->_erase = cfi_amdstd_erase_varsize;
436+
mtd->_write = cfi_amdstd_write_words;
437+
mtd->_read = cfi_amdstd_read;
438+
mtd->_sync = cfi_amdstd_sync;
439+
mtd->_suspend = cfi_amdstd_suspend;
440+
mtd->_resume = cfi_amdstd_resume;
441441
mtd->flags = MTD_CAP_NORFLASH;
442442
mtd->name = map->name;
443443
mtd->writesize = 1;
@@ -446,7 +446,7 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
446446
pr_debug("MTD %s(): write buffer size %d\n", __func__,
447447
mtd->writebufsize);
448448

449-
mtd->panic_write = cfi_amdstd_panic_write;
449+
mtd->_panic_write = cfi_amdstd_panic_write;
450450
mtd->reboot_notifier.notifier_call = cfi_amdstd_reboot;
451451

452452
if (cfi->cfi_mode==CFI_MODE_CFI){

‎drivers/mtd/chips/cfi_cmdset_0020.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,15 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
228228
}
229229

230230
/* Also select the correct geometry setup too */
231-
mtd->erase = cfi_staa_erase_varsize;
232-
mtd->read = cfi_staa_read;
233-
mtd->write = cfi_staa_write_buffers;
234-
mtd->writev = cfi_staa_writev;
235-
mtd->sync = cfi_staa_sync;
236-
mtd->lock = cfi_staa_lock;
237-
mtd->unlock = cfi_staa_unlock;
238-
mtd->suspend = cfi_staa_suspend;
239-
mtd->resume = cfi_staa_resume;
231+
mtd->_erase = cfi_staa_erase_varsize;
232+
mtd->_read = cfi_staa_read;
233+
mtd->_write = cfi_staa_write_buffers;
234+
mtd->_writev = cfi_staa_writev;
235+
mtd->_sync = cfi_staa_sync;
236+
mtd->_lock = cfi_staa_lock;
237+
mtd->_unlock = cfi_staa_unlock;
238+
mtd->_suspend = cfi_staa_suspend;
239+
mtd->_resume = cfi_staa_resume;
240240
mtd->flags = MTD_CAP_NORFLASH & ~MTD_BIT_WRITEABLE;
241241
mtd->writesize = 8; /* FIXME: Should be 0 for STMicro flashes w/out ECC */
242242
mtd->writebufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;

‎drivers/mtd/chips/fwh_lock.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static void fixup_use_fwh_lock(struct mtd_info *mtd)
101101
{
102102
printk(KERN_NOTICE "using fwh lock/unlock method\n");
103103
/* Setup for the chips with the fwh lock method */
104-
mtd->lock = fwh_lock_varsize;
105-
mtd->unlock = fwh_unlock_varsize;
104+
mtd->_lock = fwh_lock_varsize;
105+
mtd->_unlock = fwh_unlock_varsize;
106106
}
107107
#endif /* FWH_LOCK_H */

‎drivers/mtd/chips/map_absent.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ static struct mtd_info *map_absent_probe(struct map_info *map)
5555
mtd->name = map->name;
5656
mtd->type = MTD_ABSENT;
5757
mtd->size = map->size;
58-
mtd->erase = map_absent_erase;
59-
mtd->read = map_absent_read;
60-
mtd->write = map_absent_write;
61-
mtd->sync = map_absent_sync;
58+
mtd->_erase = map_absent_erase;
59+
mtd->_read = map_absent_read;
60+
mtd->_write = map_absent_write;
61+
mtd->_sync = map_absent_sync;
6262
mtd->flags = 0;
6363
mtd->erasesize = PAGE_SIZE;
6464
mtd->writesize = 1;

‎drivers/mtd/chips/map_ram.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ static struct mtd_info *map_ram_probe(struct map_info *map)
6464
mtd->name = map->name;
6565
mtd->type = MTD_RAM;
6666
mtd->size = map->size;
67-
mtd->erase = mapram_erase;
68-
mtd->get_unmapped_area = mapram_unmapped_area;
69-
mtd->read = mapram_read;
70-
mtd->write = mapram_write;
71-
mtd->sync = mapram_nop;
67+
mtd->_erase = mapram_erase;
68+
mtd->_get_unmapped_area = mapram_unmapped_area;
69+
mtd->_read = mapram_read;
70+
mtd->_write = mapram_write;
71+
mtd->_sync = mapram_nop;
7272
mtd->flags = MTD_CAP_RAM;
7373
mtd->writesize = 1;
7474

‎drivers/mtd/chips/map_rom.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ static struct mtd_info *map_rom_probe(struct map_info *map)
4141
mtd->name = map->name;
4242
mtd->type = MTD_ROM;
4343
mtd->size = map->size;
44-
mtd->get_unmapped_area = maprom_unmapped_area;
45-
mtd->read = maprom_read;
46-
mtd->write = maprom_write;
47-
mtd->sync = maprom_nop;
48-
mtd->erase = maprom_erase;
44+
mtd->_get_unmapped_area = maprom_unmapped_area;
45+
mtd->_read = maprom_read;
46+
mtd->_write = maprom_write;
47+
mtd->_sync = maprom_nop;
48+
mtd->_erase = maprom_erase;
4949
mtd->flags = MTD_CAP_ROM;
5050
mtd->erasesize = map->size;
5151
mtd->writesize = 1;

‎drivers/mtd/devices/block2mtd.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,11 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
285285
dev->mtd.writesize = 1;
286286
dev->mtd.type = MTD_RAM;
287287
dev->mtd.flags = MTD_CAP_RAM;
288-
dev->mtd.erase = block2mtd_erase;
289-
dev->mtd.write = block2mtd_write;
290-
dev->mtd.writev = mtd_writev;
291-
dev->mtd.sync = block2mtd_sync;
292-
dev->mtd.read = block2mtd_read;
288+
dev->mtd._erase = block2mtd_erase;
289+
dev->mtd._write = block2mtd_write;
290+
dev->mtd._writev = mtd_writev;
291+
dev->mtd._sync = block2mtd_sync;
292+
dev->mtd._read = block2mtd_read;
293293
dev->mtd.priv = dev;
294294
dev->mtd.owner = THIS_MODULE;
295295

‎drivers/mtd/devices/doc2000.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -565,11 +565,11 @@ void DoC2k_init(struct mtd_info *mtd)
565565
mtd->writesize = 512;
566566
mtd->oobsize = 16;
567567
mtd->owner = THIS_MODULE;
568-
mtd->erase = doc_erase;
569-
mtd->read = doc_read;
570-
mtd->write = doc_write;
571-
mtd->read_oob = doc_read_oob;
572-
mtd->write_oob = doc_write_oob;
568+
mtd->_erase = doc_erase;
569+
mtd->_read = doc_read;
570+
mtd->_write = doc_write;
571+
mtd->_read_oob = doc_read_oob;
572+
mtd->_write_oob = doc_write_oob;
573573
this->curfloor = -1;
574574
this->curchip = -1;
575575
mutex_init(&this->lock);

‎drivers/mtd/devices/doc2001.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,11 @@ void DoCMil_init(struct mtd_info *mtd)
349349
mtd->writesize = 512;
350350
mtd->oobsize = 16;
351351
mtd->owner = THIS_MODULE;
352-
mtd->erase = doc_erase;
353-
mtd->read = doc_read;
354-
mtd->write = doc_write;
355-
mtd->read_oob = doc_read_oob;
356-
mtd->write_oob = doc_write_oob;
352+
mtd->_erase = doc_erase;
353+
mtd->_read = doc_read;
354+
mtd->_write = doc_write;
355+
mtd->_read_oob = doc_read_oob;
356+
mtd->_write_oob = doc_write_oob;
357357
this->curfloor = -1;
358358
this->curchip = -1;
359359

0 commit comments

Comments
 (0)