From 48813cf989eb8695fe84df30207fc8ff5f15783c Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Wed, 14 Jul 2010 13:12:57 +0300 Subject: [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 Acked-by: Hannes Reinecke Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic79xx_osm.c | 108 ++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 54 deletions(-) (limited to 'drivers/scsi/aic7xxx/aic79xx_osm.c') diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 4c41332a354b..88ad8482ef59 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -674,7 +674,7 @@ ahd_linux_slave_alloc(struct scsi_device *sdev) struct ahd_linux_device *dev; if (bootverbose) - printf("%s: Slave Alloc %d\n", ahd_name(ahd), sdev->id); + printk("%s: Slave Alloc %d\n", ahd_name(ahd), sdev->id); dev = scsi_transport_device_data(sdev); memset(dev, 0, sizeof(*dev)); @@ -798,10 +798,10 @@ ahd_linux_dev_reset(struct scsi_cmnd *cmd) scmd_printk(KERN_INFO, cmd, "Attempting to queue a TARGET RESET message:"); - printf("CDB:"); + printk("CDB:"); for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++) - printf(" 0x%x", cmd->cmnd[cdb_byte]); - printf("\n"); + printk(" 0x%x", cmd->cmnd[cdb_byte]); + printk("\n"); /* * Determine if we currently own this command. @@ -857,16 +857,16 @@ ahd_linux_dev_reset(struct scsi_cmnd *cmd) ahd->platform_data->eh_done = &done; ahd_unlock(ahd, &flags); - printf("%s: Device reset code sleeping\n", ahd_name(ahd)); + printk("%s: Device reset code sleeping\n", ahd_name(ahd)); if (!wait_for_completion_timeout(&done, 5 * HZ)) { ahd_lock(ahd, &flags); ahd->platform_data->eh_done = NULL; ahd_unlock(ahd, &flags); - printf("%s: Device reset timer expired (active %d)\n", + printk("%s: Device reset timer expired (active %d)\n", ahd_name(ahd), dev->active); retval = FAILED; } - printf("%s: Device reset returning 0x%x\n", ahd_name(ahd), retval); + printk("%s: Device reset returning 0x%x\n", ahd_name(ahd), retval); return (retval); } @@ -884,7 +884,7 @@ ahd_linux_bus_reset(struct scsi_cmnd *cmd) ahd = *(struct ahd_softc **)cmd->device->host->hostdata; #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_RECOVERY) != 0) - printf("%s: Bus reset called for cmd %p\n", + printk("%s: Bus reset called for cmd %p\n", ahd_name(ahd), cmd); #endif ahd_lock(ahd, &flags); @@ -894,7 +894,7 @@ ahd_linux_bus_reset(struct scsi_cmnd *cmd) ahd_unlock(ahd, &flags); if (bootverbose) - printf("%s: SCSI bus reset delivered. " + printk("%s: SCSI bus reset delivered. " "%d SCBs aborted.\n", ahd_name(ahd), found); return (SUCCESS); @@ -935,7 +935,7 @@ ahd_dma_tag_create(struct ahd_softc *ahd, bus_dma_tag_t parent, { bus_dma_tag_t dmat; - dmat = malloc(sizeof(*dmat), M_DEVBUF, M_NOWAIT); + dmat = kmalloc(sizeof(*dmat), GFP_ATOMIC); if (dmat == NULL) return (ENOMEM); @@ -956,7 +956,7 @@ ahd_dma_tag_create(struct ahd_softc *ahd, bus_dma_tag_t parent, void ahd_dma_tag_destroy(struct ahd_softc *ahd, bus_dma_tag_t dmat) { - free(dmat, M_DEVBUF); + kfree(dmat); } int @@ -1019,7 +1019,7 @@ ahd_linux_setup_iocell_info(u_long index, int instance, int targ, int32_t value) iocell_info = (uint8_t*)&aic79xx_iocell_info[instance]; iocell_info[index] = value & 0xFFFF; if (bootverbose) - printf("iocell[%d:%ld] = %d\n", instance, index, value); + printk("iocell[%d:%ld] = %d\n", instance, index, value); } } @@ -1029,7 +1029,7 @@ ahd_linux_setup_tag_info_global(char *p) int tags, i, j; tags = simple_strtoul(p + 1, NULL, 0) & 0xff; - printf("Setting Global Tags= %d\n", tags); + printk("Setting Global Tags= %d\n", tags); for (i = 0; i < ARRAY_SIZE(aic79xx_tag_info); i++) { for (j = 0; j < AHD_NUM_TARGETS; j++) { @@ -1047,7 +1047,7 @@ ahd_linux_setup_tag_info(u_long arg, int instance, int targ, int32_t value) && (targ < AHD_NUM_TARGETS)) { aic79xx_tag_info[instance].tag_commands[targ] = value & 0x1FF; if (bootverbose) - printf("tag_info[%d:%d] = %d\n", instance, targ, value); + printk("tag_info[%d:%d] = %d\n", instance, targ, value); } } @@ -1088,7 +1088,7 @@ ahd_parse_brace_option(char *opt_name, char *opt_arg, char *end, int depth, if (targ == -1) targ = 0; } else { - printf("Malformed Option %s\n", + printk("Malformed Option %s\n", opt_name); done = TRUE; } @@ -1246,7 +1246,7 @@ ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *templa ahd_set_unit(ahd, ahd_linux_unit++); ahd_unlock(ahd, &s); sprintf(buf, "scsi%d", host->host_no); - new_name = malloc(strlen(buf) + 1, M_DEVBUF, M_NOWAIT); + new_name = kmalloc(strlen(buf) + 1, GFP_ATOMIC); if (new_name != NULL) { strcpy(new_name, buf); ahd_set_name(ahd, new_name); @@ -1322,7 +1322,7 @@ int ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg) { ahd->platform_data = - malloc(sizeof(struct ahd_platform_data), M_DEVBUF, M_NOWAIT); + kmalloc(sizeof(struct ahd_platform_data), GFP_ATOMIC); if (ahd->platform_data == NULL) return (ENOMEM); memset(ahd->platform_data, 0, sizeof(struct ahd_platform_data)); @@ -1364,7 +1364,7 @@ ahd_platform_free(struct ahd_softc *ahd) if (ahd->platform_data->host) scsi_host_put(ahd->platform_data->host); - free(ahd->platform_data, M_DEVBUF); + kfree(ahd->platform_data); } } @@ -1502,7 +1502,7 @@ ahd_linux_user_tagdepth(struct ahd_softc *ahd, struct ahd_devinfo *devinfo) if (ahd->unit >= ARRAY_SIZE(aic79xx_tag_info)) { if (warned_user == 0) { - printf(KERN_WARNING + printk(KERN_WARNING "aic79xx: WARNING: Insufficient tag_info instances\n" "aic79xx: for installed controllers. Using defaults\n" "aic79xx: Please update the aic79xx_tag_info array in\n" @@ -1544,7 +1544,7 @@ ahd_linux_device_queue_depth(struct scsi_device *sdev) ahd_send_async(ahd, devinfo.channel, devinfo.target, devinfo.lun, AC_TRANSFER_NEG); ahd_print_devinfo(ahd, &devinfo); - printf("Tagged Queuing enabled. Depth %d\n", tags); + printk("Tagged Queuing enabled. Depth %d\n", tags); } else { ahd_platform_set_tags(ahd, sdev, &devinfo, AHD_QUEUE_NONE); ahd_send_async(ahd, devinfo.channel, devinfo.target, @@ -1794,7 +1794,7 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb) struct ahd_linux_device *dev; if ((scb->flags & SCB_ACTIVE) == 0) { - printf("SCB %d done'd twice\n", SCB_GET_TAG(scb)); + printk("SCB %d done'd twice\n", SCB_GET_TAG(scb)); ahd_dump_card_state(ahd); panic("Stopping for safety"); } @@ -1825,7 +1825,7 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb) #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_MISC) != 0) { ahd_print_path(ahd, scb); - printf("Set CAM_UNCOR_PARITY\n"); + printk("Set CAM_UNCOR_PARITY\n"); } #endif ahd_set_transaction_status(scb, CAM_UNCOR_PARITY); @@ -1843,12 +1843,12 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb) u_int i; ahd_print_path(ahd, scb); - printf("CDB:"); + printk("CDB:"); for (i = 0; i < scb->io_ctx->cmd_len; i++) - printf(" 0x%x", scb->io_ctx->cmnd[i]); - printf("\n"); + printk(" 0x%x", scb->io_ctx->cmnd[i]); + printk("\n"); ahd_print_path(ahd, scb); - printf("Saw underflow (%ld of %ld bytes). " + printk("Saw underflow (%ld of %ld bytes). " "Treated as error\n", ahd_get_residual(scb), ahd_get_transfer_length(scb)); @@ -1881,7 +1881,7 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb) dev->commands_since_idle_or_otag = 0; if ((scb->flags & SCB_RECOVERY_SCB) != 0) { - printf("Recovery SCB completes\n"); + printk("Recovery SCB completes\n"); if (ahd_get_transaction_status(scb) == CAM_BDR_SENT || ahd_get_transaction_status(scb) == CAM_REQ_ABORTED) ahd_set_transaction_status(scb, CAM_CMD_TIMEOUT); @@ -1963,14 +1963,14 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd, if (ahd_debug & AHD_SHOW_SENSE) { int i; - printf("Copied %d bytes of sense data at %d:", + printk("Copied %d bytes of sense data at %d:", sense_size, sense_offset); for (i = 0; i < sense_size; i++) { if ((i & 0xF) == 0) - printf("\n"); - printf("0x%x ", cmd->sense_buffer[i]); + printk("\n"); + printk("0x%x ", cmd->sense_buffer[i]); } - printf("\n"); + printk("\n"); } #endif } @@ -1995,7 +1995,7 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd, #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_QFULL) != 0) { ahd_print_path(ahd, scb); - printf("Dropping tag count to %d\n", + printk("Dropping tag count to %d\n", dev->active); } #endif @@ -2014,7 +2014,7 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd, == AHD_LOCK_TAGS_COUNT) { dev->maxtags = dev->active; ahd_print_path(ahd, scb); - printf("Locking max tag count at %d\n", + printk("Locking max tag count at %d\n", dev->active); } } else { @@ -2138,7 +2138,7 @@ ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, struct scsi_cmnd *cmd) } if (do_fallback) { - printf("%s: device overrun (status %x) on %d:%d:%d\n", + printk("%s: device overrun (status %x) on %d:%d:%d\n", ahd_name(ahd), status, cmd->device->channel, cmd->device->id, cmd->device->lun); } @@ -2187,10 +2187,10 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd *cmd) scmd_printk(KERN_INFO, cmd, "Attempting to queue an ABORT message:"); - printf("CDB:"); + printk("CDB:"); for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++) - printf(" 0x%x", cmd->cmnd[cdb_byte]); - printf("\n"); + printk(" 0x%x", cmd->cmnd[cdb_byte]); + printk("\n"); ahd_lock(ahd, &flags); @@ -2249,7 +2249,7 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd *cmd) goto no_cmd; } - printf("%s: At time of recovery, card was %spaused\n", + printk("%s: At time of recovery, card was %spaused\n", ahd_name(ahd), was_paused ? "" : "not "); ahd_dump_card_state(ahd); @@ -2260,7 +2260,7 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd *cmd) pending_scb->hscb->tag, ROLE_INITIATOR, CAM_REQ_ABORTED, SEARCH_COMPLETE) > 0) { - printf("%s:%d:%d:%d: Cmd aborted from QINFIFO\n", + printk("%s:%d:%d:%d: Cmd aborted from QINFIFO\n", ahd_name(ahd), cmd->device->channel, cmd->device->id, cmd->device->lun); retval = SUCCESS; @@ -2355,7 +2355,7 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd *cmd) ahd_qinfifo_requeue_tail(ahd, pending_scb); ahd_set_scbptr(ahd, saved_scbptr); ahd_print_path(ahd, pending_scb); - printf("Device is disconnected, re-queuing SCB\n"); + printk("Device is disconnected, re-queuing SCB\n"); wait = TRUE; } else { scmd_printk(KERN_INFO, cmd, "Unable to deliver message\n"); @@ -2380,21 +2380,21 @@ done: ahd->platform_data->eh_done = &done; ahd_unlock(ahd, &flags); - printf("%s: Recovery code sleeping\n", ahd_name(ahd)); + printk("%s: Recovery code sleeping\n", ahd_name(ahd)); if (!wait_for_completion_timeout(&done, 5 * HZ)) { ahd_lock(ahd, &flags); ahd->platform_data->eh_done = NULL; ahd_unlock(ahd, &flags); - printf("%s: Timer Expired (active %d)\n", + printk("%s: Timer Expired (active %d)\n", ahd_name(ahd), dev->active); retval = FAILED; } - printf("Recovery code awake\n"); + printk("Recovery code awake\n"); } else ahd_unlock(ahd, &flags); if (retval != SUCCESS) - printf("%s: Command abort returning 0x%x\n", + printk("%s: Command abort returning 0x%x\n", ahd_name(ahd), retval); return retval; @@ -2431,7 +2431,7 @@ static void ahd_linux_set_period(struct scsi_target *starget, int period) #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_DV) != 0) - printf("%s: set period to %d\n", ahd_name(ahd), period); + printk("%s: set period to %d\n", ahd_name(ahd), period); #endif if (offset == 0) offset = MAX_OFFSET; @@ -2484,7 +2484,7 @@ static void ahd_linux_set_offset(struct scsi_target *starget, int offset) #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_DV) != 0) - printf("%s: set offset to %d\n", ahd_name(ahd), offset); + printk("%s: set offset to %d\n", ahd_name(ahd), offset); #endif ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, @@ -2520,7 +2520,7 @@ static void ahd_linux_set_dt(struct scsi_target *starget, int dt) #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_DV) != 0) - printf("%s: %s DT\n", ahd_name(ahd), + printk("%s: %s DT\n", ahd_name(ahd), dt ? "enabling" : "disabling"); #endif if (dt && spi_max_width(starget)) { @@ -2562,7 +2562,7 @@ static void ahd_linux_set_qas(struct scsi_target *starget, int qas) #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_DV) != 0) - printf("%s: %s QAS\n", ahd_name(ahd), + printk("%s: %s QAS\n", ahd_name(ahd), qas ? "enabling" : "disabling"); #endif @@ -2601,7 +2601,7 @@ static void ahd_linux_set_iu(struct scsi_target *starget, int iu) #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_DV) != 0) - printf("%s: %s IU\n", ahd_name(ahd), + printk("%s: %s IU\n", ahd_name(ahd), iu ? "enabling" : "disabling"); #endif @@ -2641,7 +2641,7 @@ static void ahd_linux_set_rd_strm(struct scsi_target *starget, int rdstrm) #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_DV) != 0) - printf("%s: %s Read Streaming\n", ahd_name(ahd), + printk("%s: %s Read Streaming\n", ahd_name(ahd), rdstrm ? "enabling" : "disabling"); #endif @@ -2677,7 +2677,7 @@ static void ahd_linux_set_wr_flow(struct scsi_target *starget, int wrflow) #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_DV) != 0) - printf("%s: %s Write Flow Control\n", ahd_name(ahd), + printk("%s: %s Write Flow Control\n", ahd_name(ahd), wrflow ? "enabling" : "disabling"); #endif @@ -2714,14 +2714,14 @@ static void ahd_linux_set_rti(struct scsi_target *starget, int rti) if ((ahd->features & AHD_RTI) == 0) { #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_DV) != 0) - printf("%s: RTI not available\n", ahd_name(ahd)); + printk("%s: RTI not available\n", ahd_name(ahd)); #endif return; } #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_DV) != 0) - printf("%s: %s RTI\n", ahd_name(ahd), + printk("%s: %s RTI\n", ahd_name(ahd), rti ? "enabling" : "disabling"); #endif @@ -2757,7 +2757,7 @@ static void ahd_linux_set_pcomp_en(struct scsi_target *starget, int pcomp) #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_DV) != 0) - printf("%s: %s Precompensation\n", ahd_name(ahd), + printk("%s: %s Precompensation\n", ahd_name(ahd), pcomp ? "Enable" : "Disable"); #endif -- cgit v1.2.3