aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic7xxx/aic7xxx_osm.c
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2010-07-14 06:12:57 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-28 10:05:27 -0400
commit48813cf989eb8695fe84df30207fc8ff5f15783c (patch)
tree031eb09af4f435faa285f863416bece80e9d2193 /drivers/scsi/aic7xxx/aic7xxx_osm.c
parent660bdddb52843d361e47c30294366ae0deac821b (diff)
[SCSI] aic7xxx: Remove OS utility wrappers
This patch removes malloc(), free(), and printf() wrappers from the aic7xxx SCSI driver. I didn't use pr_debug for printf because of some 'clever' uses of printf don't compile with the pr_debug. I didn't fix the overeager uses of GFP_ATOMIC either because I wanted to keep this patch as simple as possible. [jejb:fixed up checkpatch errors and fixed up missed conversion] Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Acked-by: Hannes Reinecke <hare@suse.de> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/aic7xxx/aic7xxx_osm.c')
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 5e42dac2350..aeea7a61478 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -653,7 +653,7 @@ ahc_linux_slave_alloc(struct scsi_device *sdev)
653 struct ahc_linux_device *dev; 653 struct ahc_linux_device *dev;
654 654
655 if (bootverbose) 655 if (bootverbose)
656 printf("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id); 656 printk("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id);
657 657
658 dev = scsi_transport_device_data(sdev); 658 dev = scsi_transport_device_data(sdev);
659 memset(dev, 0, sizeof(*dev)); 659 memset(dev, 0, sizeof(*dev));
@@ -755,7 +755,7 @@ ahc_linux_abort(struct scsi_cmnd *cmd)
755 755
756 error = ahc_linux_queue_recovery_cmd(cmd, SCB_ABORT); 756 error = ahc_linux_queue_recovery_cmd(cmd, SCB_ABORT);
757 if (error != 0) 757 if (error != 0)
758 printf("aic7xxx_abort returns 0x%x\n", error); 758 printk("aic7xxx_abort returns 0x%x\n", error);
759 return (error); 759 return (error);
760} 760}
761 761
@@ -769,7 +769,7 @@ ahc_linux_dev_reset(struct scsi_cmnd *cmd)
769 769
770 error = ahc_linux_queue_recovery_cmd(cmd, SCB_DEVICE_RESET); 770 error = ahc_linux_queue_recovery_cmd(cmd, SCB_DEVICE_RESET);
771 if (error != 0) 771 if (error != 0)
772 printf("aic7xxx_dev_reset returns 0x%x\n", error); 772 printk("aic7xxx_dev_reset returns 0x%x\n", error);
773 return (error); 773 return (error);
774} 774}
775 775
@@ -791,7 +791,7 @@ ahc_linux_bus_reset(struct scsi_cmnd *cmd)
791 ahc_unlock(ahc, &flags); 791 ahc_unlock(ahc, &flags);
792 792
793 if (bootverbose) 793 if (bootverbose)
794 printf("%s: SCSI bus reset delivered. " 794 printk("%s: SCSI bus reset delivered. "
795 "%d SCBs aborted.\n", ahc_name(ahc), found); 795 "%d SCBs aborted.\n", ahc_name(ahc), found);
796 796
797 return SUCCESS; 797 return SUCCESS;
@@ -840,7 +840,7 @@ ahc_dma_tag_create(struct ahc_softc *ahc, bus_dma_tag_t parent,
840{ 840{
841 bus_dma_tag_t dmat; 841 bus_dma_tag_t dmat;
842 842
843 dmat = malloc(sizeof(*dmat), M_DEVBUF, M_NOWAIT); 843 dmat = kmalloc(sizeof(*dmat), GFP_ATOMIC);
844 if (dmat == NULL) 844 if (dmat == NULL)
845 return (ENOMEM); 845 return (ENOMEM);
846 846
@@ -861,7 +861,7 @@ ahc_dma_tag_create(struct ahc_softc *ahc, bus_dma_tag_t parent,
861void 861void
862ahc_dma_tag_destroy(struct ahc_softc *ahc, bus_dma_tag_t dmat) 862ahc_dma_tag_destroy(struct ahc_softc *ahc, bus_dma_tag_t dmat)
863{ 863{
864 free(dmat, M_DEVBUF); 864 kfree(dmat);
865} 865}
866 866
867int 867int
@@ -918,7 +918,7 @@ ahc_linux_setup_tag_info_global(char *p)
918 int tags, i, j; 918 int tags, i, j;
919 919
920 tags = simple_strtoul(p + 1, NULL, 0) & 0xff; 920 tags = simple_strtoul(p + 1, NULL, 0) & 0xff;
921 printf("Setting Global Tags= %d\n", tags); 921 printk("Setting Global Tags= %d\n", tags);
922 922
923 for (i = 0; i < ARRAY_SIZE(aic7xxx_tag_info); i++) { 923 for (i = 0; i < ARRAY_SIZE(aic7xxx_tag_info); i++) {
924 for (j = 0; j < AHC_NUM_TARGETS; j++) { 924 for (j = 0; j < AHC_NUM_TARGETS; j++) {
@@ -936,7 +936,7 @@ ahc_linux_setup_tag_info(u_long arg, int instance, int targ, int32_t value)
936 && (targ < AHC_NUM_TARGETS)) { 936 && (targ < AHC_NUM_TARGETS)) {
937 aic7xxx_tag_info[instance].tag_commands[targ] = value & 0xff; 937 aic7xxx_tag_info[instance].tag_commands[targ] = value & 0xff;
938 if (bootverbose) 938 if (bootverbose)
939 printf("tag_info[%d:%d] = %d\n", instance, targ, value); 939 printk("tag_info[%d:%d] = %d\n", instance, targ, value);
940 } 940 }
941} 941}
942 942
@@ -977,7 +977,7 @@ ahc_parse_brace_option(char *opt_name, char *opt_arg, char *end, int depth,
977 if (targ == -1) 977 if (targ == -1)
978 targ = 0; 978 targ = 0;
979 } else { 979 } else {
980 printf("Malformed Option %s\n", 980 printk("Malformed Option %s\n",
981 opt_name); 981 opt_name);
982 done = TRUE; 982 done = TRUE;
983 } 983 }
@@ -1120,7 +1120,7 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa
1120 ahc_set_unit(ahc, ahc_linux_unit++); 1120 ahc_set_unit(ahc, ahc_linux_unit++);
1121 ahc_unlock(ahc, &s); 1121 ahc_unlock(ahc, &s);
1122 sprintf(buf, "scsi%d", host->host_no); 1122 sprintf(buf, "scsi%d", host->host_no);
1123 new_name = malloc(strlen(buf) + 1, M_DEVBUF, M_NOWAIT); 1123 new_name = kmalloc(strlen(buf) + 1, GFP_ATOMIC);
1124 if (new_name != NULL) { 1124 if (new_name != NULL) {
1125 strcpy(new_name, buf); 1125 strcpy(new_name, buf);
1126 ahc_set_name(ahc, new_name); 1126 ahc_set_name(ahc, new_name);
@@ -1220,7 +1220,7 @@ ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg)
1220{ 1220{
1221 1221
1222 ahc->platform_data = 1222 ahc->platform_data =
1223 malloc(sizeof(struct ahc_platform_data), M_DEVBUF, M_NOWAIT); 1223 kmalloc(sizeof(struct ahc_platform_data), GFP_ATOMIC);
1224 if (ahc->platform_data == NULL) 1224 if (ahc->platform_data == NULL)
1225 return (ENOMEM); 1225 return (ENOMEM);
1226 memset(ahc->platform_data, 0, sizeof(struct ahc_platform_data)); 1226 memset(ahc->platform_data, 0, sizeof(struct ahc_platform_data));
@@ -1264,7 +1264,7 @@ ahc_platform_free(struct ahc_softc *ahc)
1264 if (ahc->platform_data->host) 1264 if (ahc->platform_data->host)
1265 scsi_host_put(ahc->platform_data->host); 1265 scsi_host_put(ahc->platform_data->host);
1266 1266
1267 free(ahc->platform_data, M_DEVBUF); 1267 kfree(ahc->platform_data);
1268 } 1268 }
1269} 1269}
1270 1270
@@ -1378,7 +1378,7 @@ ahc_linux_user_tagdepth(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
1378 if (ahc->unit >= ARRAY_SIZE(aic7xxx_tag_info)) { 1378 if (ahc->unit >= ARRAY_SIZE(aic7xxx_tag_info)) {
1379 if (warned_user == 0) { 1379 if (warned_user == 0) {
1380 1380
1381 printf(KERN_WARNING 1381 printk(KERN_WARNING
1382"aic7xxx: WARNING: Insufficient tag_info instances\n" 1382"aic7xxx: WARNING: Insufficient tag_info instances\n"
1383"aic7xxx: for installed controllers. Using defaults\n" 1383"aic7xxx: for installed controllers. Using defaults\n"
1384"aic7xxx: Please update the aic7xxx_tag_info array in\n" 1384"aic7xxx: Please update the aic7xxx_tag_info array in\n"
@@ -1421,7 +1421,7 @@ ahc_linux_device_queue_depth(struct scsi_device *sdev)
1421 ahc_send_async(ahc, devinfo.channel, devinfo.target, 1421 ahc_send_async(ahc, devinfo.channel, devinfo.target,
1422 devinfo.lun, AC_TRANSFER_NEG); 1422 devinfo.lun, AC_TRANSFER_NEG);
1423 ahc_print_devinfo(ahc, &devinfo); 1423 ahc_print_devinfo(ahc, &devinfo);
1424 printf("Tagged Queuing enabled. Depth %d\n", tags); 1424 printk("Tagged Queuing enabled. Depth %d\n", tags);
1425 } else { 1425 } else {
1426 ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_NONE); 1426 ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_NONE);
1427 ahc_send_async(ahc, devinfo.channel, devinfo.target, 1427 ahc_send_async(ahc, devinfo.channel, devinfo.target,
@@ -1735,7 +1735,7 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb)
1735 * not have been dispatched to the controller, so 1735 * not have been dispatched to the controller, so
1736 * only check the SCB_ACTIVE flag for tagged transactions. 1736 * only check the SCB_ACTIVE flag for tagged transactions.
1737 */ 1737 */
1738 printf("SCB %d done'd twice\n", scb->hscb->tag); 1738 printk("SCB %d done'd twice\n", scb->hscb->tag);
1739 ahc_dump_card_state(ahc); 1739 ahc_dump_card_state(ahc);
1740 panic("Stopping for safety"); 1740 panic("Stopping for safety");
1741 } 1741 }
@@ -1765,7 +1765,7 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb)
1765#ifdef AHC_DEBUG 1765#ifdef AHC_DEBUG
1766 if ((ahc_debug & AHC_SHOW_MISC) != 0) { 1766 if ((ahc_debug & AHC_SHOW_MISC) != 0) {
1767 ahc_print_path(ahc, scb); 1767 ahc_print_path(ahc, scb);
1768 printf("Set CAM_UNCOR_PARITY\n"); 1768 printk("Set CAM_UNCOR_PARITY\n");
1769 } 1769 }
1770#endif 1770#endif
1771 ahc_set_transaction_status(scb, CAM_UNCOR_PARITY); 1771 ahc_set_transaction_status(scb, CAM_UNCOR_PARITY);
@@ -1783,12 +1783,12 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb)
1783 u_int i; 1783 u_int i;
1784 1784
1785 ahc_print_path(ahc, scb); 1785 ahc_print_path(ahc, scb);
1786 printf("CDB:"); 1786 printk("CDB:");
1787 for (i = 0; i < scb->io_ctx->cmd_len; i++) 1787 for (i = 0; i < scb->io_ctx->cmd_len; i++)
1788 printf(" 0x%x", scb->io_ctx->cmnd[i]); 1788 printk(" 0x%x", scb->io_ctx->cmnd[i]);
1789 printf("\n"); 1789 printk("\n");
1790 ahc_print_path(ahc, scb); 1790 ahc_print_path(ahc, scb);
1791 printf("Saw underflow (%ld of %ld bytes). " 1791 printk("Saw underflow (%ld of %ld bytes). "
1792 "Treated as error\n", 1792 "Treated as error\n",
1793 ahc_get_residual(scb), 1793 ahc_get_residual(scb),
1794 ahc_get_transfer_length(scb)); 1794 ahc_get_transfer_length(scb));
@@ -1821,7 +1821,7 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb)
1821 dev->commands_since_idle_or_otag = 0; 1821 dev->commands_since_idle_or_otag = 0;
1822 1822
1823 if ((scb->flags & SCB_RECOVERY_SCB) != 0) { 1823 if ((scb->flags & SCB_RECOVERY_SCB) != 0) {
1824 printf("Recovery SCB completes\n"); 1824 printk("Recovery SCB completes\n");
1825 if (ahc_get_transaction_status(scb) == CAM_BDR_SENT 1825 if (ahc_get_transaction_status(scb) == CAM_BDR_SENT
1826 || ahc_get_transaction_status(scb) == CAM_REQ_ABORTED) 1826 || ahc_get_transaction_status(scb) == CAM_REQ_ABORTED)
1827 ahc_set_transaction_status(scb, CAM_CMD_TIMEOUT); 1827 ahc_set_transaction_status(scb, CAM_CMD_TIMEOUT);
@@ -1886,14 +1886,14 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
1886 if (ahc_debug & AHC_SHOW_SENSE) { 1886 if (ahc_debug & AHC_SHOW_SENSE) {
1887 int i; 1887 int i;
1888 1888
1889 printf("Copied %d bytes of sense data:", 1889 printk("Copied %d bytes of sense data:",
1890 sense_size); 1890 sense_size);
1891 for (i = 0; i < sense_size; i++) { 1891 for (i = 0; i < sense_size; i++) {
1892 if ((i & 0xF) == 0) 1892 if ((i & 0xF) == 0)
1893 printf("\n"); 1893 printk("\n");
1894 printf("0x%x ", cmd->sense_buffer[i]); 1894 printk("0x%x ", cmd->sense_buffer[i]);
1895 } 1895 }
1896 printf("\n"); 1896 printk("\n");
1897 } 1897 }
1898#endif 1898#endif
1899 } 1899 }
@@ -1918,7 +1918,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
1918 dev->openings = 0; 1918 dev->openings = 0;
1919/* 1919/*
1920 ahc_print_path(ahc, scb); 1920 ahc_print_path(ahc, scb);
1921 printf("Dropping tag count to %d\n", dev->active); 1921 printk("Dropping tag count to %d\n", dev->active);
1922 */ 1922 */
1923 if (dev->active == dev->tags_on_last_queuefull) { 1923 if (dev->active == dev->tags_on_last_queuefull) {
1924 1924
@@ -1935,7 +1935,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
1935 == AHC_LOCK_TAGS_COUNT) { 1935 == AHC_LOCK_TAGS_COUNT) {
1936 dev->maxtags = dev->active; 1936 dev->maxtags = dev->active;
1937 ahc_print_path(ahc, scb); 1937 ahc_print_path(ahc, scb);
1938 printf("Locking max tag count at %d\n", 1938 printk("Locking max tag count at %d\n",
1939 dev->active); 1939 dev->active);
1940 } 1940 }
1941 } else { 1941 } else {
@@ -2100,10 +2100,10 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2100 scmd_printk(KERN_INFO, cmd, "Attempting to queue a%s message\n", 2100 scmd_printk(KERN_INFO, cmd, "Attempting to queue a%s message\n",
2101 flag == SCB_ABORT ? "n ABORT" : " TARGET RESET"); 2101 flag == SCB_ABORT ? "n ABORT" : " TARGET RESET");
2102 2102
2103 printf("CDB:"); 2103 printk("CDB:");
2104 for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++) 2104 for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++)
2105 printf(" 0x%x", cmd->cmnd[cdb_byte]); 2105 printk(" 0x%x", cmd->cmnd[cdb_byte]);
2106 printf("\n"); 2106 printk("\n");
2107 2107
2108 ahc_lock(ahc, &flags); 2108 ahc_lock(ahc, &flags);
2109 2109
@@ -2121,7 +2121,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2121 * No target device for this command exists, 2121 * No target device for this command exists,
2122 * so we must not still own the command. 2122 * so we must not still own the command.
2123 */ 2123 */
2124 printf("%s:%d:%d:%d: Is not an active device\n", 2124 printk("%s:%d:%d:%d: Is not an active device\n",
2125 ahc_name(ahc), cmd->device->channel, cmd->device->id, 2125 ahc_name(ahc), cmd->device->channel, cmd->device->id,
2126 cmd->device->lun); 2126 cmd->device->lun);
2127 retval = SUCCESS; 2127 retval = SUCCESS;
@@ -2133,7 +2133,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2133 cmd->device->channel + 'A', 2133 cmd->device->channel + 'A',
2134 cmd->device->lun, 2134 cmd->device->lun,
2135 CAM_REQ_ABORTED, SEARCH_COMPLETE) != 0) { 2135 CAM_REQ_ABORTED, SEARCH_COMPLETE) != 0) {
2136 printf("%s:%d:%d:%d: Command found on untagged queue\n", 2136 printk("%s:%d:%d:%d: Command found on untagged queue\n",
2137 ahc_name(ahc), cmd->device->channel, cmd->device->id, 2137 ahc_name(ahc), cmd->device->channel, cmd->device->id,
2138 cmd->device->lun); 2138 cmd->device->lun);
2139 retval = SUCCESS; 2139 retval = SUCCESS;
@@ -2187,7 +2187,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2187 goto no_cmd; 2187 goto no_cmd;
2188 } 2188 }
2189 2189
2190 printf("%s: At time of recovery, card was %spaused\n", 2190 printk("%s: At time of recovery, card was %spaused\n",
2191 ahc_name(ahc), was_paused ? "" : "not "); 2191 ahc_name(ahc), was_paused ? "" : "not ");
2192 ahc_dump_card_state(ahc); 2192 ahc_dump_card_state(ahc);
2193 2193
@@ -2199,7 +2199,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2199 pending_scb->hscb->tag, 2199 pending_scb->hscb->tag,
2200 ROLE_INITIATOR, CAM_REQ_ABORTED, 2200 ROLE_INITIATOR, CAM_REQ_ABORTED,
2201 SEARCH_COMPLETE) > 0) { 2201 SEARCH_COMPLETE) > 0) {
2202 printf("%s:%d:%d:%d: Cmd aborted from QINFIFO\n", 2202 printk("%s:%d:%d:%d: Cmd aborted from QINFIFO\n",
2203 ahc_name(ahc), cmd->device->channel, 2203 ahc_name(ahc), cmd->device->channel,
2204 cmd->device->id, cmd->device->lun); 2204 cmd->device->id, cmd->device->lun);
2205 retval = SUCCESS; 2205 retval = SUCCESS;
@@ -2313,7 +2313,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2313 ahc_qinfifo_requeue_tail(ahc, pending_scb); 2313 ahc_qinfifo_requeue_tail(ahc, pending_scb);
2314 ahc_outb(ahc, SCBPTR, saved_scbptr); 2314 ahc_outb(ahc, SCBPTR, saved_scbptr);
2315 ahc_print_path(ahc, pending_scb); 2315 ahc_print_path(ahc, pending_scb);
2316 printf("Device is disconnected, re-queuing SCB\n"); 2316 printk("Device is disconnected, re-queuing SCB\n");
2317 wait = TRUE; 2317 wait = TRUE;
2318 } else { 2318 } else {
2319 scmd_printk(KERN_INFO, cmd, "Unable to deliver message\n"); 2319 scmd_printk(KERN_INFO, cmd, "Unable to deliver message\n");
@@ -2338,16 +2338,16 @@ done:
2338 ahc->platform_data->eh_done = &done; 2338 ahc->platform_data->eh_done = &done;
2339 ahc_unlock(ahc, &flags); 2339 ahc_unlock(ahc, &flags);
2340 2340
2341 printf("Recovery code sleeping\n"); 2341 printk("Recovery code sleeping\n");
2342 if (!wait_for_completion_timeout(&done, 5 * HZ)) { 2342 if (!wait_for_completion_timeout(&done, 5 * HZ)) {
2343 ahc_lock(ahc, &flags); 2343 ahc_lock(ahc, &flags);
2344 ahc->platform_data->eh_done = NULL; 2344 ahc->platform_data->eh_done = NULL;
2345 ahc_unlock(ahc, &flags); 2345 ahc_unlock(ahc, &flags);
2346 2346
2347 printf("Timer Expired\n"); 2347 printk("Timer Expired\n");
2348 retval = FAILED; 2348 retval = FAILED;
2349 } 2349 }
2350 printf("Recovery code awake\n"); 2350 printk("Recovery code awake\n");
2351 } else 2351 } else
2352 ahc_unlock(ahc, &flags); 2352 ahc_unlock(ahc, &flags);
2353 return (retval); 2353 return (retval);