aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nandsim.c
diff options
context:
space:
mode:
authorVijay Kumar <vijaykumar@bravegnu.org>2006-10-14 12:03:34 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-10-21 11:40:55 -0400
commita5602146c5abea7dfb0c9f4fe6f5870ebdafbc9f (patch)
treedf23c5fe35ffb9791ede661a99dbaa17d44c5704 /drivers/mtd/nand/nandsim.c
parentd086d43640a40dda7783f3c56724048685586d17 (diff)
[MTD] NAND: nandsim coding style fix
Removes line break after return type in function definitions, to be consistent with the Linux coding style. Signed-off-by: Vijay Kumar <vijaykumar@bravegnu.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/nand/nandsim.c')
-rw-r--r--drivers/mtd/nand/nandsim.c57
1 files changed, 19 insertions, 38 deletions
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index f00e195f4711..28ee78544ff2 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -349,8 +349,7 @@ static u_char ns_verify_buf[NS_LARGEST_PAGE_SIZE];
349 * 349 *
350 * RETURNS: 0 if success, -ENOMEM if memory alloc fails. 350 * RETURNS: 0 if success, -ENOMEM if memory alloc fails.
351 */ 351 */
352static int 352static int alloc_device(struct nandsim *ns)
353alloc_device(struct nandsim *ns)
354{ 353{
355 int i; 354 int i;
356 355
@@ -369,8 +368,7 @@ alloc_device(struct nandsim *ns)
369/* 368/*
370 * Free any allocated pages, and free the array of page pointers. 369 * Free any allocated pages, and free the array of page pointers.
371 */ 370 */
372static void 371static void free_device(struct nandsim *ns)
373free_device(struct nandsim *ns)
374{ 372{
375 int i; 373 int i;
376 374
@@ -388,8 +386,7 @@ free_device(struct nandsim *ns)
388 * 386 *
389 * RETURNS: 0 if success, -ERRNO if failure. 387 * RETURNS: 0 if success, -ERRNO if failure.
390 */ 388 */
391static int 389static int init_nandsim(struct mtd_info *mtd)
392init_nandsim(struct mtd_info *mtd)
393{ 390{
394 struct nand_chip *chip = (struct nand_chip *)mtd->priv; 391 struct nand_chip *chip = (struct nand_chip *)mtd->priv;
395 struct nandsim *ns = (struct nandsim *)(chip->priv); 392 struct nandsim *ns = (struct nandsim *)(chip->priv);
@@ -505,8 +502,7 @@ error:
505/* 502/*
506 * Free the nandsim structure. 503 * Free the nandsim structure.
507 */ 504 */
508static void 505static void free_nandsim(struct nandsim *ns)
509free_nandsim(struct nandsim *ns)
510{ 506{
511 kfree(ns->buf.byte); 507 kfree(ns->buf.byte);
512 free_device(ns); 508 free_device(ns);
@@ -517,8 +513,7 @@ free_nandsim(struct nandsim *ns)
517/* 513/*
518 * Returns the string representation of 'state' state. 514 * Returns the string representation of 'state' state.
519 */ 515 */
520static char * 516static char *get_state_name(uint32_t state)
521get_state_name(uint32_t state)
522{ 517{
523 switch (NS_STATE(state)) { 518 switch (NS_STATE(state)) {
524 case STATE_CMD_READ0: 519 case STATE_CMD_READ0:
@@ -576,8 +571,7 @@ get_state_name(uint32_t state)
576 * 571 *
577 * RETURNS: 1 if wrong command, 0 if right. 572 * RETURNS: 1 if wrong command, 0 if right.
578 */ 573 */
579static int 574static int check_command(int cmd)
580check_command(int cmd)
581{ 575{
582 switch (cmd) { 576 switch (cmd) {
583 577
@@ -603,8 +597,7 @@ check_command(int cmd)
603/* 597/*
604 * Returns state after command is accepted by command number. 598 * Returns state after command is accepted by command number.
605 */ 599 */
606static uint32_t 600static uint32_t get_state_by_command(unsigned command)
607get_state_by_command(unsigned command)
608{ 601{
609 switch (command) { 602 switch (command) {
610 case NAND_CMD_READ0: 603 case NAND_CMD_READ0:
@@ -640,8 +633,7 @@ get_state_by_command(unsigned command)
640/* 633/*
641 * Move an address byte to the correspondent internal register. 634 * Move an address byte to the correspondent internal register.
642 */ 635 */
643static inline void 636static inline void accept_addr_byte(struct nandsim *ns, u_char bt)
644accept_addr_byte(struct nandsim *ns, u_char bt)
645{ 637{
646 uint byte = (uint)bt; 638 uint byte = (uint)bt;
647 639
@@ -659,8 +651,7 @@ accept_addr_byte(struct nandsim *ns, u_char bt)
659/* 651/*
660 * Switch to STATE_READY state. 652 * Switch to STATE_READY state.
661 */ 653 */
662static inline void 654static inline void switch_to_ready_state(struct nandsim *ns, u_char status)
663switch_to_ready_state(struct nandsim *ns, u_char status)
664{ 655{
665 NS_DBG("switch_to_ready_state: switch to %s state\n", get_state_name(STATE_READY)); 656 NS_DBG("switch_to_ready_state: switch to %s state\n", get_state_name(STATE_READY));
666 657
@@ -719,8 +710,7 @@ switch_to_ready_state(struct nandsim *ns, u_char status)
719 * -1 - several matches. 710 * -1 - several matches.
720 * 0 - operation is found. 711 * 0 - operation is found.
721 */ 712 */
722static int 713static int find_operation(struct nandsim *ns, uint32_t flag)
723find_operation(struct nandsim *ns, uint32_t flag)
724{ 714{
725 int opsfound = 0; 715 int opsfound = 0;
726 int i, j, idx = 0; 716 int i, j, idx = 0;
@@ -887,8 +877,7 @@ static int prog_page(struct nandsim *ns, int num)
887 * 877 *
888 * RETURNS: 0 if success, -1 if error. 878 * RETURNS: 0 if success, -1 if error.
889 */ 879 */
890static int 880static int do_state_action(struct nandsim *ns, uint32_t action)
891do_state_action(struct nandsim *ns, uint32_t action)
892{ 881{
893 int num; 882 int num;
894 int busdiv = ns->busw == 8 ? 1 : 2; 883 int busdiv = ns->busw == 8 ? 1 : 2;
@@ -1020,8 +1009,7 @@ do_state_action(struct nandsim *ns, uint32_t action)
1020/* 1009/*
1021 * Switch simulator's state. 1010 * Switch simulator's state.
1022 */ 1011 */
1023static void 1012static void switch_state(struct nandsim *ns)
1024switch_state(struct nandsim *ns)
1025{ 1013{
1026 if (ns->op) { 1014 if (ns->op) {
1027 /* 1015 /*
@@ -1162,8 +1150,7 @@ switch_state(struct nandsim *ns)
1162 } 1150 }
1163} 1151}
1164 1152
1165static u_char 1153static u_char ns_nand_read_byte(struct mtd_info *mtd)
1166ns_nand_read_byte(struct mtd_info *mtd)
1167{ 1154{
1168 struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv; 1155 struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv;
1169 u_char outb = 0x00; 1156 u_char outb = 0x00;
@@ -1236,8 +1223,7 @@ ns_nand_read_byte(struct mtd_info *mtd)
1236 return outb; 1223 return outb;
1237} 1224}
1238 1225
1239static void 1226static void ns_nand_write_byte(struct mtd_info *mtd, u_char byte)
1240ns_nand_write_byte(struct mtd_info *mtd, u_char byte)
1241{ 1227{
1242 struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv; 1228 struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv;
1243 1229
@@ -1400,15 +1386,13 @@ static void ns_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int bitmask)
1400 ns_nand_write_byte(mtd, cmd); 1386 ns_nand_write_byte(mtd, cmd);
1401} 1387}
1402 1388
1403static int 1389static int ns_device_ready(struct mtd_info *mtd)
1404ns_device_ready(struct mtd_info *mtd)
1405{ 1390{
1406 NS_DBG("device_ready\n"); 1391 NS_DBG("device_ready\n");
1407 return 1; 1392 return 1;
1408} 1393}
1409 1394
1410static uint16_t 1395static uint16_t ns_nand_read_word(struct mtd_info *mtd)
1411ns_nand_read_word(struct mtd_info *mtd)
1412{ 1396{
1413 struct nand_chip *chip = (struct nand_chip *)mtd->priv; 1397 struct nand_chip *chip = (struct nand_chip *)mtd->priv;
1414 1398
@@ -1417,8 +1401,7 @@ ns_nand_read_word(struct mtd_info *mtd)
1417 return chip->read_byte(mtd) | (chip->read_byte(mtd) << 8); 1401 return chip->read_byte(mtd) | (chip->read_byte(mtd) << 8);
1418} 1402}
1419 1403
1420static void 1404static void ns_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
1421ns_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
1422{ 1405{
1423 struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv; 1406 struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv;
1424 1407
@@ -1445,8 +1428,7 @@ ns_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
1445 } 1428 }
1446} 1429}
1447 1430
1448static void 1431static void ns_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
1449ns_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
1450{ 1432{
1451 struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv; 1433 struct nandsim *ns = (struct nandsim *)((struct nand_chip *)mtd->priv)->priv;
1452 1434
@@ -1499,8 +1481,7 @@ ns_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
1499 return; 1481 return;
1500} 1482}
1501 1483
1502static int 1484static int ns_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
1503ns_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
1504{ 1485{
1505 ns_nand_read_buf(mtd, (u_char *)&ns_verify_buf[0], len); 1486 ns_nand_read_buf(mtd, (u_char *)&ns_verify_buf[0], len);
1506 1487