Skip to content

Commit 68aa352

Browse files
dedekindDavid Woodhouse
authored andcommitted
mtd: nand: rename the id field of 'struct nand_flash_dev'
The 'id' is a bit confusing name because NAND IDs are multi-byte. Re-name it to 'dev_id' to make it clear that this is the "device ID" part (the second byte). While on it, clean-up the commentary for 'struct nand_flash_dev'. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Acked-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent 3239a6c commit 68aa352

7 files changed

Lines changed: 17 additions & 18 deletions

File tree

‎drivers/mtd/devices/doc2000.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
379379

380380
/* Print and store the manufacturer and ID codes. */
381381
for (i = 0; nand_flash_ids[i].name != NULL; i++) {
382-
if (id == nand_flash_ids[i].id) {
382+
if (id == nand_flash_ids[i].dev_id) {
383383
/* Try to identify manufacturer */
384384
for (j = 0; nand_manuf_ids[j].id != 0x0; j++) {
385385
if (nand_manuf_ids[j].id == mfr)

‎drivers/mtd/devices/doc2001.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
206206

207207
/* FIXME: to deal with multi-flash on multi-Millennium case more carefully */
208208
for (i = 0; nand_flash_ids[i].name != NULL; i++) {
209-
if ( id == nand_flash_ids[i].id) {
209+
if ( id == nand_flash_ids[i].dev_id) {
210210
/* Try to identify manufacturer */
211211
for (j = 0; nand_manuf_ids[j].id != 0x0; j++) {
212212
if (nand_manuf_ids[j].id == mfr)

‎drivers/mtd/devices/doc2001plus.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
314314
return 0;
315315

316316
for (i = 0; nand_flash_ids[i].name != NULL; i++) {
317-
if (id == nand_flash_ids[i].id) {
317+
if (id == nand_flash_ids[i].dev_id) {
318318
/* Try to identify manufacturer */
319319
for (j = 0; nand_manuf_ids[j].id != 0x0; j++) {
320320
if (nand_manuf_ids[j].id == mfr)

‎drivers/mtd/nand/nand_base.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3142,7 +3142,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
31423142
type = nand_flash_ids;
31433143

31443144
for (; type->name != NULL; type++)
3145-
if (*dev_id == type->id)
3145+
if (*dev_id == type->dev_id)
31463146
break;
31473147

31483148
chip->onfi_version = 0;

‎drivers/mtd/nand/nandsim.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -766,9 +766,9 @@ static int init_nandsim(struct mtd_info *mtd)
766766
}
767767

768768
/* Detect how many ID bytes the NAND chip outputs */
769-
for (i = 0; nand_flash_ids[i].name != NULL; i++) {
770-
if (second_id_byte != nand_flash_ids[i].id)
771-
continue;
769+
for (i = 0; nand_flash_ids[i].name != NULL; i++) {
770+
if (second_id_byte != nand_flash_ids[i].dev_id)
771+
continue;
772772
}
773773

774774
if (ns->busw == 16)

‎drivers/mtd/nand/pxa3xx_nand.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ static int pxa3xx_nand_scan(struct mtd_info *mtd)
989989
}
990990

991991
pxa3xx_flash_ids[0].name = f->name;
992-
pxa3xx_flash_ids[0].id = (f->chip_id >> 8) & 0xffff;
992+
pxa3xx_flash_ids[0].dev_id = (f->chip_id >> 8) & 0xffff;
993993
pxa3xx_flash_ids[0].pagesize = f->page_size;
994994
chipsize = (uint64_t)f->num_blocks * f->page_per_block * f->page_size;
995995
pxa3xx_flash_ids[0].chipsize = chipsize >> 20;

‎include/linux/mtd/nand.h‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -548,19 +548,18 @@ struct nand_chip {
548548

549549
/**
550550
* struct nand_flash_dev - NAND Flash Device ID Structure
551-
* @name: Identify the device type
552-
* @id: device ID code
553-
* @pagesize: Pagesize in bytes. Either 256 or 512 or 0
554-
* If the pagesize is 0, then the real pagesize
555-
* and the eraseize are determined from the
556-
* extended id bytes in the chip
557-
* @erasesize: Size of an erase block in the flash device.
558-
* @chipsize: Total chipsize in Mega Bytes
559-
* @options: Bitfield to store chip relevant options
551+
* @name: a human-readable name of the NAND chip
552+
* @dev_id: the device ID (the second byte of the full chip ID array)
553+
* @pagesize: size of the NAND page in bytes; if 0, then the real page size (as
554+
* well as the eraseblock size) is determined from the extended NAND
555+
* chip ID array)
556+
* @erasesize: eraseblock size in bytes (determined from the extended ID if 0)
557+
* @chipsize: total chip size in MiB
558+
* @options: stores various chip bit options
560559
*/
561560
struct nand_flash_dev {
562561
char *name;
563-
int id;
562+
int dev_id;
564563
unsigned long pagesize;
565564
unsigned long chipsize;
566565
unsigned long erasesize;

0 commit comments

Comments
 (0)