drivers/mtd/maps/tqm8xxl.c: Style cleanups
PATCH 1/1 drivers/mtd/maps/tqm8xxl.c: Style cleanups
Change C++ style comments into K&R's.
Cut long lines into pieces.
This patch is against 2.6.22.1, and can be also applied to the last -mm tree.
---
tqm8xxl.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-)
drivers/mtd/maps/tqm8xxl.c +25 -16
@@ -38,7 +38,7 @@#define FLASH_SIZE 0x00800000#define FLASH_BANK_MAX 4 -// trivial struct to describe partition information +/* trivial struct to describe partition information*/ struct mtd_part_def {int nums;
@@ -46,7 +46,7 @@struct mtd_partition * mtd_part; }; -//static struct mtd_info *mymtd; +/*static struct mtd_info *mymtd;*/ static struct mtd_info * mtd_banks[FLASH_BANK_MAX ];static struct map_info * map_banks[FLASH_BANK_MAX ];static struct mtd_part_def part_banks[FLASH_BANK_MAX ];
@@ -106,7 +106,7 @@ .name = "jffs", .offset = 0x00200000, .size = 0x00200000, - //.size = MTDPART_SIZ_FULL, + /*.size = MTDPART_SIZ_FULL,*/ } };#endif
@@ -121,10 +121,11 @@ flash_addr = bd->bi_flashstart; flash_size = bd->bi_flashsize; -//request maximum flash size address space +/*request maximum flash size address space*/ start_scan_addr =ioremap (flash_addr, flash_size);if (!start_scan_addr) { -printk (KERN_WARNING "%s:Failed to ioremap address:0x%x\n" , __FUNCTION__, flash_addr); +printk (KERN_WARNING "%s:Failed to ioremap address:0x%x\n" , + __FUNCTION__, flash_addr);return -EIO ; }
@@ -132,12 +133,14 @@if (mtd_size >= flash_size)break ; -printk (KERN_INFO "%s: chip probing count %d\n" , __FUNCTION__, idx); +printk (KERN_INFO "%s: chip probing count %d\n" , __FUNCTION__, + idx); map_banks[idx] =kzalloc (sizeof (struct map_info ),GFP_KERNEL );if (map_banks[idx] ==NULL ) { ret = -ENOMEM ; -/* FIXME: What if some MTD devices were probed already? */ +/* FIXME: What if some MTD devices were probed +already? */ goto error_mem; }
@@ -145,7 +148,8 @@if (!map_banks[idx]->name) { ret = -ENOMEM ; -/* FIXME: What if some MTD devices were probed already? */ +/* FIXME: What if some MTD devices were probed +already? */ goto error_mem; }sprintf (map_banks[idx]->name,"TQM8xxL%d" , idx);
@@ -170,7 +174,7 @@ map_banks[idx]->phys += mtd_banks[idx-1 ]->size; } -//start to probe flash chips +/*start to probe flash chips*/ mtd_banks[idx] =do_map_probe ("cfi_probe" , map_banks[idx]);if (mtd_banks[idx]) {
@@ -178,7 +182,8 @@ mtd_size += mtd_banks[idx]->size; num_banks++; -printk (KERN_INFO "%s: bank%d, name:%s, size:%dbytes \n" , __FUNCTION__, num_banks, +printk (KERN_INFO "%s: bank%d, name:%s, size:%dbytes \n" , + __FUNCTION__, num_banks, mtd_banks[idx]->name, mtd_banks[idx]->size); } }
@@ -204,17 +209,21 @@for (idx =0 ; idx < num_banks ; idx++) {if (part_banks[idx].nums ==0 ) { -printk (KERN_NOTICE "TQM flash%d: no partition info available, registering whole flash at once\n" , idx); +printk (KERN_NOTICE "TQM flash%d: no partition info " +"available, registering whole flash at once\n" , + idx);add_mtd_device (mtd_banks[idx]); }else { -printk (KERN_NOTICE "TQM flash%d: Using %s partition definition\n" , - idx, part_banks[idx].type); -add_mtd_partitions (mtd_banks[idx], part_banks[idx].mtd_part, - part_banks[idx].nums); +printk (KERN_NOTICE "TQM flash%d: Using %s partition " +"definition\n" , + idx, part_banks[idx].type); +add_mtd_partitions (mtd_banks[idx], + part_banks[idx].mtd_part, part_banks[idx].nums); } }#else -printk (KERN_NOTICE "TQM flash: registering %d whole flash banks at once\n" , num_banks); +printk (KERN_NOTICE "TQM flash: registering %d whole flash banks at " +"once\n" , num_banks);for (idx =0 ; idx < num_banks ; idx++)add_mtd_device (mtd_banks[idx]);#endif
Quoted 18 lines · WANG Cong
Change C++ style comments into K&R's.
Cut long lines into pieces.This patch is against 2.6.22.1, and can be also applied to the last -mm tree.
Signed-off-by WANG Cong <[email protected]>---
tqm8xxl.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-)Index:
linux-2.6.22.1/drivers/mtd/maps/tqm8xxl.c
===================================================================
drivers/mtd/maps/tqm8xxl.c line 41
Quoted 5 lines
drivers/mtd/maps/tqm8xxl.c +1
-1@@ -38,7 +38,7 @@#define FLASH_SIZE 0x00800000#define FLASH_BANK_MAX 4 -// trivial struct to describe partition information +/* trivial struct to describe partition information*/
Needs a space at the end.
drivers/mtd/maps/tqm8xxl.c line 49
Quoted 9 lines
drivers/mtd/maps/tqm8xxl.c +1
-1struct mtd_part_def {int nums;@@ -46,7 +46,7 @@struct mtd_partition * mtd_part; }; -//static struct mtd_info *mymtd; +/*static struct mtd_info *mymtd;*/
Just delete this...
drivers/mtd/maps/tqm8xxl.c line 109
Quoted 9 lines
drivers/mtd/maps/tqm8xxl.c +1
-1static struct mtd_info * mtd_banks[FLASH_BANK_MAX ];static struct map_info * map_banks[FLASH_BANK_MAX ];static struct mtd_part_def part_banks[FLASH_BANK_MAX ];@@ -106,7 +106,7 @@ .name = "jffs", .offset = 0x00200000, .size = 0x00200000, -//.size = MTDPART_SIZ_FULL, +/*.size = MTDPART_SIZ_FULL,*/
Delete it...
drivers/mtd/maps/tqm8xxl.c line 124
Quoted 9 lines
drivers/mtd/maps/tqm8xxl.c +1
-1} };#endif @@ -121,10 +121,11 @@ flash_addr = bd->bi_flashstart; flash_size = bd->bi_flashsize; -//request maximum flash size address space +/*request maximum flash size address space*/
Spaces needed (repeat for the rest of the ones that don't have spaces either).
josh
PATCH RESEND 1/1 drivers/mtd/maps/tqm8xxl.c: Do some cleanups
Quoted 1 line · Josh Boyer
On Thu, 2007-07-12 at 23:01 +0800, WANG Cong wrote:
{snip}
Quoted 35 lines
Quoted 1 line
+/* trivial struct to describe partition information*/
Needs a space at the end.
Review line 49
Quoted 9 lines
struct
mtd_part_def
{(quoted diff) +1
-1int nums;@@ -46,7 +46,7 @@ struct mtd_partition* mtd_part; }; -//static struct mtd_info *mymtd; +/*static struct mtd_info *mymtd;*/Just delete this...
Review line 109
Quoted 9 lines
(quoted diff) +1
-1static struct mtd_info* mtd_banks[FLASH_BANK_MAX]; static struct map_info* map_banks[FLASH_BANK_MAX]; static struct mtd_part_def part_banks[FLASH_BANK_MAX];@@ -106,7 +106,7 @@ .name = "jffs", .offset = 0x00200000, .size = 0x00200000, - //.size = MTDPART_SIZ_FULL, + /*.size = MTDPART_SIZ_FULL,*/Delete it...
Quoted 7 lines
(quoted diff) +0
-0} }; #endif@@ -121,10 +121,11 @@ flash_addr = bd->bi_flashstart; flash_size = bd->bi_flashsize;
Quoted 5 lines
Review line 124
Quoted 2 lines
(quoted diff) +1
-1- //request maximum flash size address space + /*request maximum flash size address space*/Spaces needed (repeat for the rest of the ones that don't have spaces either).
Thanks, Josh. Could you please check if this one is fine for you?
Change C++ style comments into K&R's.
Cut long lines into pieces.
Don't need to cast the return value of kmalloc().
This patch is against 2.6.22.1.
--- tqm8xxl.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-)
drivers/mtd/maps/tqm8xxl.c +24 -18
@@ -38,7 +38,7 @@#define FLASH_SIZE 0x00800000#define FLASH_BANK_MAX 4 -// trivial struct to describe partition information +/* trivial struct to describe partition information */ struct mtd_part_def {int nums;
@@ -46,7 +46,6 @@struct mtd_partition * mtd_part; }; -//static struct mtd_info *mymtd; static struct mtd_info * mtd_banks[FLASH_BANK_MAX ];static struct map_info * map_banks[FLASH_BANK_MAX ];static struct mtd_part_def part_banks[FLASH_BANK_MAX ];
@@ -106,7 +105,6 @@ .name = "jffs", .offset = 0x00200000, .size = 0x00200000, - //.size = MTDPART_SIZ_FULL, } };#endif
@@ -121,10 +119,11 @@ flash_addr = bd->bi_flashstart; flash_size = bd->bi_flashsize; -//request maximum flash size address space +/* request maximum flash size address space */ start_scan_addr =ioremap (flash_addr, flash_size);if (!start_scan_addr) { -printk (KERN_WARNING "%s:Failed to ioremap address:0x%x\n" , __FUNCTION__, flash_addr); +printk (KERN_WARNING "%s:Failed to ioremap address:0x%x\n" , + __FUNCTION__, flash_addr);return -EIO ; }
@@ -132,20 +131,23 @@if (mtd_size >= flash_size)break ; -printk (KERN_INFO "%s: chip probing count %d\n" , __FUNCTION__, idx); +printk (KERN_INFO "%s: chip probing count %d\n" , + __FUNCTION__, idx); map_banks[idx] =kzalloc (sizeof (struct map_info ),GFP_KERNEL );if (map_banks[idx] ==NULL ) { ret = -ENOMEM ; -/* FIXME: What if some MTD devices were probed already? */ +/* FIXME: What if some MTD devices were probed +already? */ goto error_mem; } - map_banks[idx]->name = (char *)kmalloc (16 ,GFP_KERNEL ); + map_banks[idx]->name =kmalloc (16 ,GFP_KERNEL );if (!map_banks[idx]->name) { ret = -ENOMEM ; -/* FIXME: What if some MTD devices were probed already? */ +/* FIXME: What if some MTD devices were probed +already? */ goto error_mem; }sprintf (map_banks[idx]->name,"TQM8xxL%d" , idx);
@@ -170,7 +172,7 @@ map_banks[idx]->phys += mtd_banks[idx-1 ]->size; } -//start to probe flash chips +/* start to probe flash chips */ mtd_banks[idx] =do_map_probe ("cfi_probe" , map_banks[idx]);if (mtd_banks[idx]) {
@@ -178,8 +180,9 @@ mtd_size += mtd_banks[idx]->size; num_banks++; -printk (KERN_INFO "%s: bank%d, name:%s, size:%dbytes \n" , __FUNCTION__, num_banks, - mtd_banks[idx]->name, mtd_banks[idx]->size); +printk (KERN_INFO "%s: bank%d, name:%s, size:%dbytes \n" , + __FUNCTION__, num_banks, mtd_banks[idx]->name, + mtd_banks[idx]->size); } }
@@ -204,17 +207,20 @@for (idx =0 ; idx < num_banks ; idx++) {if (part_banks[idx].nums ==0 ) { -printk (KERN_NOTICE "TQM flash%d: no partition info available, registering whole flash at once\n" , idx); +printk (KERN_NOTICE "TQM flash%d: no partition info " +"available, registering whole flash at once\n" , + idx);add_mtd_device (mtd_banks[idx]); }else { -printk (KERN_NOTICE "TQM flash%d: Using %s partition definition\n" , - idx, part_banks[idx].type); -add_mtd_partitions (mtd_banks[idx], part_banks[idx].mtd_part, - part_banks[idx].nums); +printk (KERN_NOTICE "TQM flash%d: Using %s partition " +"definition\n" , idx, part_banks[idx].type); +add_mtd_partitions (mtd_banks[idx], + part_banks[idx].mtd_part, part_banks[idx].nums); } }#else -printk (KERN_NOTICE "TQM flash: registering %d whole flash banks at once\n" , num_banks); +printk (KERN_NOTICE "TQM flash: registering %d whole flash banks at " +"once\n" , num_banks);for (idx =0 ; idx < num_banks ; idx++)add_mtd_device (mtd_banks[idx]);#endif
Re: [Resend][Patch] drivers/mtd/maps/tqm8xxl.c: Do some cleanups
drivers/mtd/maps/tqm8xxl.c line 143
Quoted 7 lines · WANG Cong
if(map_banks[idx] == NULL) { ret = -ENOMEM;drivers/mtd/maps/tqm8xxl.c +2
-1-/* FIXME: What if some MTD devices were probed already? */ +/* FIXME: What if some MTD devices were probed +already? */ goto error_mem; }
That's just horrid. Leave it as it was.
Signature · 1 line
dwmw2
Re: [Resend][Patch] drivers/mtd/maps/tqm8xxl.c: Do some cleanups
Quoted 10 lines · David Woodhouse
drivers/mtd/maps/tqm8xxl.c line 143
Quoted 7 lines · WANG Cong
if(map_banks[idx] == NULL) { ret = -ENOMEM;drivers/mtd/maps/tqm8xxl.c +2
-1-/* FIXME: What if some MTD devices were probed already? */ +/* FIXME: What if some MTD devices were probed +already? */ goto error_mem; }
Quoted 2 lines
That's just horrid. Leave it as it was.
Sorry, I can't fully understand you. You mean only the above change is horrid or the entire patch?
I have some questions about mtd/maps drivers. Even when I use make allyesconfig, I still can't compile some drivers. I should add the corresponding CONFIGs manually. Why this? And I still got some errors and warnings, such as:
drivers/mtd/maps/pmcmsp-flash.c:40:22: error: msp_prom.h: No such file or directory drivers/mtd/maps/pmcmsp-flash.c:41:22: error: msp_regs.h: No such file or directory drivers/mtd/maps/pmcmsp-flash.c: In function 'init_msp_flash':drivers/mtd/maps/pmcmsp-flash.c:62: error: 'DEV_ID_REG' undeclared (first use in this function) drivers/mtd/maps/pmcmsp-flash.c:62: error: (Each undeclared identifier is reported only once drivers/mtd/maps/pmcmsp-flash.c:62: error: for each function it appears in.) drivers/mtd/maps/pmcmsp-flash.c:62: error: 'DEV_ID_SINGLE_PC' undeclared (first use in this function) drivers/mtd/maps/pmcmsp-flash.c:63: error: 'ELB_1PC_EN_REG' undeclared (first use in this function) drivers/mtd/maps/pmcmsp-flash.c:63: error: 'SINGLE_PCCARD' undeclared (first use in this function)
Did I miss something?
Thanks!
Signature · 1 line
If loving computers is wrong, I don't want to be right.
Re: [Resend][Patch] drivers/mtd/maps/tqm8xxl.c: Do some cleanups
Quoted 11 lines · WANG Cong
Quoted 10 lines · David Woodhouse
Quoted 7 lines · WANG Cong
if(map_banks[idx] == NULL) { ret = -ENOMEM;drivers/mtd/maps/tqm8xxl.c +2
-1-/* FIXME: What if some MTD devices were probed already? */ +/* FIXME: What if some MTD devices were probed +already? */ goto error_mem; }
Quoted 5 lines
Quoted 2 lines
That's just horrid. Leave it as it was.
Sorry, I can't fully understand you. You mean only the above change is horrid or the entire patch?
Just the above change. See Linus' comments about strict limits on 80 columns being a Nazi dream.
Quoted 14 lines
I have some questions about mtd/maps drivers. Even when I use
make allyesconfig, I still can't compile some drivers. I should add the corresponding CONFIGs manually. Why this? And I still got some errors and warnings, such as:
drivers/mtd/maps/pmcmsp-flash.c:40:22: error:msp_prom.h: No such file or directorydrivers/mtd/maps/pmcmsp-flash.c:41:22: error:msp_regs.h: No such file or directorydrivers/mtd/maps/pmcmsp-flash.c: In function 'init_msp_flash':drivers/mtd/maps/pmcmsp-flash.c:62: error: 'DEV_ID_REG' undeclared (first use in this function)drivers/mtd/maps/pmcmsp-flash.c:62: error: (Each undeclared identifier is reported only oncedrivers/mtd/maps/pmcmsp-flash.c:62: error: for each function it appears in.)drivers/mtd/maps/pmcmsp-flash.c:62: error: 'DEV_ID_SINGLE_PC' undeclared (first use in this function)drivers/mtd/maps/pmcmsp-flash.c:63: error: 'ELB_1PC_EN_REG' undeclared (first use in this function)drivers/mtd/maps/pmcmsp-flash.c:63: error: 'SINGLE_PCCARD' undeclared (first use in this function)
Quoted 1 line
Did I miss something?
I think that map driver should probably depend on CONFIG_PMC_MSP. Ralf?
Signature · 1 line
dwmw2
Re: [Resend][Patch] drivers/mtd/maps/tqm8xxl.c: Do some cleanups
Quoted 6 lines · David Woodhouse
Quoted 4 lines
drivers/mtd/maps/pmcmsp-flash.c:63: error: 'ELB_1PC_EN_REG' undeclared (first use in this function)drivers/mtd/maps/pmcmsp-flash.c:63: error: 'SINGLE_PCCARD' undeclared (first use in this function)Did I miss something?
I think that map driver should probably depend on
CONFIG_PMC_MSP. Ralf?
*confused*
68aa0fa87f6d4b2f5e8ad39ecaec8bba9137bb3d did add:
+config MTD_PMC_MSP_EVM
+ tristate "CFI Flash device mapped on PMC-Sierra MSP" + depends on PMC_MSP && MTD_CFI + select MTD_PARTITIONS
drivers/mtd/maps/Makefile:obj-$(CONFIG_MTD_PMC_MSP_EVM) += pmcmsp-flash.o
Is he trying to build something else than very recent kernel.org tree?
Ralf
Re: [Resend][Patch] drivers/mtd/maps/tqm8xxl.c: Do some cleanups
Quoted 10 lines · Ralf Baechle
(quoted diff) +4
-0+config MTD_PMC_MSP_EVM + tristate "CFI Flash device mapped on PMC-Sierra MSP" + depends on PMC_MSP && MTD_CFI + select MTD_PARTITIONSdrivers/mtd/maps/Makefile:obj-$(CONFIG_MTD_PMC_MSP_EVM) +=
pmcmsp-flash.oIs he trying to build something else than very recent kernel.org tree?
Hm. His mail did say "Even when I use make allyesconfig, I still can't compile some drivers. I should add the corresponding CONFIGs manually."
I wonder if he disabled the correct conditions and then tried building it in an i386 kernel?
Signature · 1 line
dwmw2
Re: [Resend][Patch] drivers/mtd/maps/tqm8xxl.c: Do some cleanups
Quoted 9 lines · David Woodhouse
Quoted 8 lines · Ralf Baechle
(quoted diff) +4
-0+config MTD_PMC_MSP_EVM + tristate "CFI Flash device mapped on PMC-Sierra MSP" + depends on PMC_MSP && MTD_CFI + select MTD_PARTITIONSdrivers/mtd/maps/Makefile:obj-$(CONFIG_MTD_PMC_MSP_EVM) +=
pmcmsp-flash.o
Quoted 9 lines
Quoted 2 lines
Is he trying to build something else than very recent kernel.org tree?
Hm. His mail did say "Even when I use
make allyesconfig, I still can't compile some drivers. I should add the corresponding CONFIGs manually."I wonder if he disabled the correct conditions and then tried building it in an i386 kernel?
Er, I first used 'make allyesconfig', then added CONFIG_MTD_PMC_MSP_EVM=y manually. And yes, I am on i386.
Signature · 1 line
If loving computers is wrong, I don't want to be right.
Re: [Resend][Patch] drivers/mtd/maps/tqm8xxl.c: Do some cleanups
In reply to Ralf BaechleQuoted 18 lines · Ralf Baechle
Quoted 6 lines · David Woodhouse
Quoted 4 lines
drivers/mtd/maps/pmcmsp-flash.c:63: error: 'ELB_1PC_EN_REG' undeclared (first use in this function)drivers/mtd/maps/pmcmsp-flash.c:63: error: 'SINGLE_PCCARD' undeclared (first use in this function)Did I miss something?
I think that map driver should probably depend on
CONFIG_PMC_MSP. Ralf?*confused*
68aa0fa87f6d4b2f5e8ad39ecaec8bba9137bb3ddid add:(quoted diff) +4
-0+config MTD_PMC_MSP_EVM + tristate "CFI Flash device mapped on PMC-Sierra MSP" + depends on PMC_MSP && MTD_CFI + select MTD_PARTITIONS
Quoted 4 lines
drivers/mtd/maps/Makefile:obj-$(CONFIG_MTD_PMC_MSP_EVM) += pmcmsp-flash.o
Is he trying to build something else than very recent kernel.org tree?
Yes. very recent, 2.6.22.1.
Signature · 1 line
If loving computers is wrong, I don't want to be right.