diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2007-07-09 15:00:10 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-07-15 10:36:25 -0400 |
commit | cebadc5c97547aa8567ee2d628b187a34869b389 (patch) | |
tree | 24d9e677f440e204ab6ec40032f4a2984b1856a0 | |
parent | 75a1099c0bfc5545088cdc9eae2fd98015656595 (diff) |
[SCSI] ppa: coding police and printk levels
Add printk levels
Clean up some oddities of formatting
Fix goto labels
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/ppa.c | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index 584ba4d6e038..2f1fa1eb7e90 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c | |||
@@ -129,11 +129,11 @@ static inline int ppa_proc_write(ppa_struct *dev, char *buffer, int length) | |||
129 | if ((length > 10) && (strncmp(buffer, "recon_tmo=", 10) == 0)) { | 129 | if ((length > 10) && (strncmp(buffer, "recon_tmo=", 10) == 0)) { |
130 | x = simple_strtoul(buffer + 10, NULL, 0); | 130 | x = simple_strtoul(buffer + 10, NULL, 0); |
131 | dev->recon_tmo = x; | 131 | dev->recon_tmo = x; |
132 | printk("ppa: recon_tmo set to %ld\n", x); | 132 | printk(KERN_INFO "ppa: recon_tmo set to %ld\n", x); |
133 | return length; | 133 | return length; |
134 | } | 134 | } |
135 | printk("ppa /proc: invalid variable\n"); | 135 | printk(KERN_WARNING "ppa /proc: invalid variable\n"); |
136 | return (-EINVAL); | 136 | return -EINVAL; |
137 | } | 137 | } |
138 | 138 | ||
139 | static int ppa_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int inout) | 139 | static int ppa_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int inout) |
@@ -216,7 +216,7 @@ static unsigned char ppa_wait(ppa_struct *dev) | |||
216 | 216 | ||
217 | /* Counter expired - Time out occurred */ | 217 | /* Counter expired - Time out occurred */ |
218 | ppa_fail(dev, DID_TIME_OUT); | 218 | ppa_fail(dev, DID_TIME_OUT); |
219 | printk("ppa timeout in ppa_wait\n"); | 219 | printk(KERN_WARNING "ppa timeout in ppa_wait\n"); |
220 | return 0; /* command timed out */ | 220 | return 0; /* command timed out */ |
221 | } | 221 | } |
222 | 222 | ||
@@ -248,7 +248,7 @@ static inline void ecp_sync(ppa_struct *dev) | |||
248 | return; | 248 | return; |
249 | udelay(5); | 249 | udelay(5); |
250 | } | 250 | } |
251 | printk("ppa: ECP sync failed as data still present in FIFO.\n"); | 251 | printk(KERN_WARNING "ppa: ECP sync failed as data still present in FIFO.\n"); |
252 | } | 252 | } |
253 | } | 253 | } |
254 | 254 | ||
@@ -328,7 +328,7 @@ static int ppa_out(ppa_struct *dev, char *buffer, int len) | |||
328 | break; | 328 | break; |
329 | 329 | ||
330 | default: | 330 | default: |
331 | printk("PPA: bug in ppa_out()\n"); | 331 | printk(KERN_ERR "PPA: bug in ppa_out()\n"); |
332 | r = 0; | 332 | r = 0; |
333 | } | 333 | } |
334 | return r; | 334 | return r; |
@@ -381,7 +381,7 @@ static int ppa_in(ppa_struct *dev, char *buffer, int len) | |||
381 | break; | 381 | break; |
382 | 382 | ||
383 | default: | 383 | default: |
384 | printk("PPA: bug in ppa_ins()\n"); | 384 | printk(KERN_ERR "PPA: bug in ppa_ins()\n"); |
385 | r = 0; | 385 | r = 0; |
386 | break; | 386 | break; |
387 | } | 387 | } |
@@ -633,7 +633,7 @@ static void ppa_interrupt(struct work_struct *work) | |||
633 | struct scsi_cmnd *cmd = dev->cur_cmd; | 633 | struct scsi_cmnd *cmd = dev->cur_cmd; |
634 | 634 | ||
635 | if (!cmd) { | 635 | if (!cmd) { |
636 | printk("PPA: bug in ppa_interrupt\n"); | 636 | printk(KERN_ERR "PPA: bug in ppa_interrupt\n"); |
637 | return; | 637 | return; |
638 | } | 638 | } |
639 | if (ppa_engine(dev, cmd)) { | 639 | if (ppa_engine(dev, cmd)) { |
@@ -646,31 +646,31 @@ static void ppa_interrupt(struct work_struct *work) | |||
646 | case DID_OK: | 646 | case DID_OK: |
647 | break; | 647 | break; |
648 | case DID_NO_CONNECT: | 648 | case DID_NO_CONNECT: |
649 | printk("ppa: no device at SCSI ID %i\n", cmd->device->target); | 649 | printk(KERN_DEBUG "ppa: no device at SCSI ID %i\n", cmd->device->target); |
650 | break; | 650 | break; |
651 | case DID_BUS_BUSY: | 651 | case DID_BUS_BUSY: |
652 | printk("ppa: BUS BUSY - EPP timeout detected\n"); | 652 | printk(KERN_DEBUG "ppa: BUS BUSY - EPP timeout detected\n"); |
653 | break; | 653 | break; |
654 | case DID_TIME_OUT: | 654 | case DID_TIME_OUT: |
655 | printk("ppa: unknown timeout\n"); | 655 | printk(KERN_DEBUG "ppa: unknown timeout\n"); |
656 | break; | 656 | break; |
657 | case DID_ABORT: | 657 | case DID_ABORT: |
658 | printk("ppa: told to abort\n"); | 658 | printk(KERN_DEBUG "ppa: told to abort\n"); |
659 | break; | 659 | break; |
660 | case DID_PARITY: | 660 | case DID_PARITY: |
661 | printk("ppa: parity error (???)\n"); | 661 | printk(KERN_DEBUG "ppa: parity error (???)\n"); |
662 | break; | 662 | break; |
663 | case DID_ERROR: | 663 | case DID_ERROR: |
664 | printk("ppa: internal driver error\n"); | 664 | printk(KERN_DEBUG "ppa: internal driver error\n"); |
665 | break; | 665 | break; |
666 | case DID_RESET: | 666 | case DID_RESET: |
667 | printk("ppa: told to reset device\n"); | 667 | printk(KERN_DEBUG "ppa: told to reset device\n"); |
668 | break; | 668 | break; |
669 | case DID_BAD_INTR: | 669 | case DID_BAD_INTR: |
670 | printk("ppa: bad interrupt (???)\n"); | 670 | printk(KERN_WARNING "ppa: bad interrupt (???)\n"); |
671 | break; | 671 | break; |
672 | default: | 672 | default: |
673 | printk("ppa: bad return code (%02x)\n", | 673 | printk(KERN_WARNING "ppa: bad return code (%02x)\n", |
674 | (cmd->result >> 16) & 0xff); | 674 | (cmd->result >> 16) & 0xff); |
675 | } | 675 | } |
676 | #endif | 676 | #endif |
@@ -724,8 +724,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd) | |||
724 | 724 | ||
725 | if (retv) { | 725 | if (retv) { |
726 | if (time_after(jiffies, dev->jstart + (1 * HZ))) { | 726 | if (time_after(jiffies, dev->jstart + (1 * HZ))) { |
727 | printk | 727 | printk(KERN_ERR "ppa: Parallel port cable is unplugged.\n"); |
728 | ("ppa: Parallel port cable is unplugged!!\n"); | ||
729 | ppa_fail(dev, DID_BUS_BUSY); | 728 | ppa_fail(dev, DID_BUS_BUSY); |
730 | return 0; | 729 | return 0; |
731 | } else { | 730 | } else { |
@@ -755,11 +754,9 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd) | |||
755 | case 4: /* Phase 4 - Setup scatter/gather buffers */ | 754 | case 4: /* Phase 4 - Setup scatter/gather buffers */ |
756 | if (cmd->use_sg) { | 755 | if (cmd->use_sg) { |
757 | /* if many buffers are available, start filling the first */ | 756 | /* if many buffers are available, start filling the first */ |
758 | cmd->SCp.buffer = | 757 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; |
759 | (struct scatterlist *) cmd->request_buffer; | ||
760 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 758 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
761 | cmd->SCp.ptr = | 759 | cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + |
762 | page_address(cmd->SCp.buffer->page) + | ||
763 | cmd->SCp.buffer->offset; | 760 | cmd->SCp.buffer->offset; |
764 | } else { | 761 | } else { |
765 | /* else fill the only available buffer */ | 762 | /* else fill the only available buffer */ |
@@ -800,7 +797,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd) | |||
800 | break; | 797 | break; |
801 | 798 | ||
802 | default: | 799 | default: |
803 | printk("ppa: Invalid scsi phase\n"); | 800 | printk(KERN_ERR "ppa: Invalid scsi phase\n"); |
804 | } | 801 | } |
805 | return 0; | 802 | return 0; |
806 | } | 803 | } |
@@ -811,7 +808,7 @@ static int ppa_queuecommand(struct scsi_cmnd *cmd, | |||
811 | ppa_struct *dev = ppa_dev(cmd->device->host); | 808 | ppa_struct *dev = ppa_dev(cmd->device->host); |
812 | 809 | ||
813 | if (dev->cur_cmd) { | 810 | if (dev->cur_cmd) { |
814 | printk("PPA: bug in ppa_queuecommand\n"); | 811 | printk(KERN_ERR "PPA: bug in ppa_queuecommand\n"); |
815 | return 0; | 812 | return 0; |
816 | } | 813 | } |
817 | dev->failed = 0; | 814 | dev->failed = 0; |
@@ -899,7 +896,7 @@ static int device_check(ppa_struct *dev) | |||
899 | /* This routine looks for a device and then attempts to use EPP | 896 | /* This routine looks for a device and then attempts to use EPP |
900 | to send a command. If all goes as planned then EPP is available. */ | 897 | to send a command. If all goes as planned then EPP is available. */ |
901 | 898 | ||
902 | static char cmd[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | 899 | static u8 cmd[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
903 | int loop, old_mode, status, k, ppb = dev->base; | 900 | int loop, old_mode, status, k, ppb = dev->base; |
904 | unsigned char l; | 901 | unsigned char l; |
905 | 902 | ||
@@ -909,14 +906,14 @@ static int device_check(ppa_struct *dev) | |||
909 | if ((ppb & 0x0007) == 0x0000) | 906 | if ((ppb & 0x0007) == 0x0000) |
910 | dev->mode = PPA_EPP_32; | 907 | dev->mode = PPA_EPP_32; |
911 | 908 | ||
912 | second_pass: | 909 | second_pass: |
913 | ppa_connect(dev, CONNECT_EPP_MAYBE); | 910 | ppa_connect(dev, CONNECT_EPP_MAYBE); |
914 | /* Select SCSI device */ | 911 | /* Select SCSI device */ |
915 | if (!ppa_select(dev, loop)) { | 912 | if (!ppa_select(dev, loop)) { |
916 | ppa_disconnect(dev); | 913 | ppa_disconnect(dev); |
917 | continue; | 914 | continue; |
918 | } | 915 | } |
919 | printk("ppa: Found device at ID %i, Attempting to use %s\n", | 916 | printk(KERN_INFO "ppa: Found device at ID %i, Attempting to use %s\n", |
920 | loop, PPA_MODE_STRING[dev->mode]); | 917 | loop, PPA_MODE_STRING[dev->mode]); |
921 | 918 | ||
922 | /* Send SCSI command */ | 919 | /* Send SCSI command */ |
@@ -965,7 +962,7 @@ static int device_check(ppa_struct *dev) | |||
965 | return -EIO; | 962 | return -EIO; |
966 | } | 963 | } |
967 | ppa_disconnect(dev); | 964 | ppa_disconnect(dev); |
968 | printk("ppa: Communication established with ID %i using %s\n", | 965 | printk(KERN_INFO "ppa: Communication established with ID %i using %s\n", |
969 | loop, PPA_MODE_STRING[dev->mode]); | 966 | loop, PPA_MODE_STRING[dev->mode]); |
970 | ppa_connect(dev, CONNECT_EPP_MAYBE); | 967 | ppa_connect(dev, CONNECT_EPP_MAYBE); |
971 | ppa_reset_pulse(ppb); | 968 | ppa_reset_pulse(ppb); |
@@ -1140,7 +1137,7 @@ static struct parport_driver ppa_driver = { | |||
1140 | 1137 | ||
1141 | static int __init ppa_driver_init(void) | 1138 | static int __init ppa_driver_init(void) |
1142 | { | 1139 | { |
1143 | printk("ppa: Version %s\n", PPA_VERSION); | 1140 | printk(KERN_INFO "ppa: Version %s\n", PPA_VERSION); |
1144 | return parport_register_driver(&ppa_driver); | 1141 | return parport_register_driver(&ppa_driver); |
1145 | } | 1142 | } |
1146 | 1143 | ||