summaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys/visorhba/visorhba_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/unisys/visorhba/visorhba_main.c')
-rw-r--r--drivers/staging/unisys/visorhba/visorhba_main.c95
1 files changed, 51 insertions, 44 deletions
diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c
index 0ce92c8..6997b16 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -28,9 +28,9 @@
/* The Send and Receive Buffers of the IO Queue may both be full */
-#define IOS_ERROR_THRESHOLD 1000
-#define MAX_PENDING_REQUESTS (MIN_NUMSIGNALS * 2)
-#define VISORHBA_ERROR_COUNT 30
+#define IOS_ERROR_THRESHOLD 1000
+#define MAX_PENDING_REQUESTS (MIN_NUMSIGNALS * 2)
+#define VISORHBA_ERROR_COUNT 30
static struct dentry *visorhba_debugfs_dir;
@@ -101,12 +101,13 @@ struct visorhba_devices_open {
struct visorhba_devdata *devdata;
};
-#define for_each_vdisk_match(iter, list, match) \
+#define for_each_vdisk_match(iter, list, match) \
for (iter = &list->head; iter->next; iter = iter->next) \
- if ((iter->channel == match->channel) && \
- (iter->id == match->id) && \
+ if ((iter->channel == match->channel) && \
+ (iter->id == match->id) && \
(iter->lun == match->lun))
-/**
+
+/*
* visor_thread_start - starts a thread for the device
* @threadfn: Function the thread starts
* @thrcontext: Context to pass to the thread, i.e. devdata
@@ -130,7 +131,7 @@ static struct task_struct *visor_thread_start
return task;
}
-/**
+/*
* visor_thread_stop - stops the thread if it is running
*/
static void visor_thread_stop(struct task_struct *task)
@@ -140,7 +141,7 @@ static void visor_thread_stop(struct task_struct *task)
kthread_stop(task);
}
-/**
+/*
* add_scsipending_entry - save off io command that is pending in
* Service Partition
* @devdata: Pointer to devdata
@@ -183,8 +184,8 @@ static int add_scsipending_entry(struct visorhba_devdata *devdata,
return insert_location;
}
-/**
- * del_scsipending_enty - removes an entry from the pending array
+/*
+ * del_scsipending_ent - removes an entry from the pending array
* @devdata: Device holding the pending array
* @del: Entry to remove
*
@@ -210,9 +211,9 @@ static void *del_scsipending_ent(struct visorhba_devdata *devdata,
return sent;
}
-/**
+/*
* get_scsipending_cmdrsp - return the cmdrsp stored in a pending entry
- * #ddata: Device holding the pending array
+ * @ddata: Device holding the pending array
* @ent: Entry that stores the cmdrsp
*
* Each scsipending entry has a cmdrsp in it. The cmdrsp is only valid
@@ -228,7 +229,7 @@ static struct uiscmdrsp *get_scsipending_cmdrsp(struct visorhba_devdata *ddata,
return NULL;
}
-/**
+/*
* simple_idr_get - associate a provided pointer with an int value
* 1 <= value <= INT_MAX, and return this int value;
* the pointer value can be obtained later by passing
@@ -253,7 +254,7 @@ static unsigned int simple_idr_get(struct idr *idrtable, void *p,
return (unsigned int)(id); /* idr_alloc() guarantees > 0 */
}
-/**
+/*
* setup_scsitaskmgmt_handles - stash the necessary handles so that the
* completion processing logic for a taskmgmt
* cmd will be able to find who to wake up
@@ -271,7 +272,7 @@ static void setup_scsitaskmgmt_handles(struct idr *idrtable, spinlock_t *lock,
simple_idr_get(idrtable, result, lock);
}
-/**
+/*
* cleanup_scsitaskmgmt_handles - forget handles created by
* setup_scsitaskmgmt_handles()
*/
@@ -284,7 +285,7 @@ static void cleanup_scsitaskmgmt_handles(struct idr *idrtable,
idr_remove(idrtable, cmdrsp->scsitaskmgmt.notifyresult_handle);
}
-/**
+/*
* forward_taskmgmt_command - send taskmegmt command to the Service
* Partition
* @tasktype: Type of taskmgmt command
@@ -363,7 +364,7 @@ err_del_scsipending_ent:
return FAILED;
}
-/**
+/*
* visorhba_abort_handler - Send TASK_MGMT_ABORT_TASK
* @scsicmd: The scsicmd that needs aborted
*
@@ -388,7 +389,7 @@ static int visorhba_abort_handler(struct scsi_cmnd *scsicmd)
return forward_taskmgmt_command(TASK_MGMT_ABORT_TASK, scsicmd);
}
-/**
+/*
* visorhba_device_reset_handler - Send TASK_MGMT_LUN_RESET
* @scsicmd: The scsicmd that needs aborted
*
@@ -412,7 +413,7 @@ static int visorhba_device_reset_handler(struct scsi_cmnd *scsicmd)
return forward_taskmgmt_command(TASK_MGMT_LUN_RESET, scsicmd);
}
-/**
+/*
* visorhba_bus_reset_handler - Send TASK_MGMT_TARGET_RESET for each
* target on the bus
* @scsicmd: The scsicmd that needs aborted
@@ -436,7 +437,7 @@ static int visorhba_bus_reset_handler(struct scsi_cmnd *scsicmd)
return forward_taskmgmt_command(TASK_MGMT_BUS_RESET, scsicmd);
}
-/**
+/*
* visorhba_host_reset_handler - Not supported
* @scsicmd: The scsicmd that needs aborted
*
@@ -450,7 +451,7 @@ visorhba_host_reset_handler(struct scsi_cmnd *scsicmd)
return SUCCESS;
}
-/**
+/*
* visorhba_get_info
* @shp: Scsi host that is requesting information
*
@@ -462,7 +463,7 @@ static const char *visorhba_get_info(struct Scsi_Host *shp)
return "visorhba";
}
-/**
+/*
* visorhba_queue_command_lck -- queues command to the Service Partition
* @scsicmd: Command to be queued
* @vsiorhba_cmnd_done: Done command to call when scsicmd is returned
@@ -553,7 +554,7 @@ static DEF_SCSI_QCMD(visorhba_queue_command)
#define visorhba_queue_command visorhba_queue_command_lck
#endif
-/**
+/*
* visorhba_slave_alloc - called when new disk is discovered
* @scsidev: New disk
*
@@ -590,7 +591,7 @@ static int visorhba_slave_alloc(struct scsi_device *scsidev)
return 0;
}
-/**
+/*
* visorhba_slave_destroy - disk is going away
* @scsidev: scsi device going away
*
@@ -633,7 +634,7 @@ static struct scsi_host_template visorhba_driver_template = {
.use_clustering = ENABLE_CLUSTERING,
};
-/**
+/*
* info_debugfs_show - debugfs interface to dump visorhba states
*
* This presents a file in the debugfs tree named:
@@ -677,7 +678,7 @@ static const struct file_operations info_debugfs_fops = {
.release = single_release,
};
-/**
+/*
* complete_taskmgmt_command - complete task management
* @cmdrsp: Response from the IOVM
*
@@ -685,8 +686,8 @@ static const struct file_operations info_debugfs_fops = {
* command. Wake up anyone waiting for it.
* Returns void
*/
-static inline void complete_taskmgmt_command
-(struct idr *idrtable, struct uiscmdrsp *cmdrsp, int result)
+static void complete_taskmgmt_command(struct idr *idrtable,
+ struct uiscmdrsp *cmdrsp, int result)
{
wait_queue_head_t *wq =
idr_find(idrtable, cmdrsp->scsitaskmgmt.notify_handle);
@@ -706,7 +707,7 @@ static inline void complete_taskmgmt_command
wake_up_all(wq);
}
-/**
+/*
* visorhba_serverdown_complete - Called when we are done cleaning up
* from serverdown
* @work: work structure for this serverdown request
@@ -756,7 +757,7 @@ static void visorhba_serverdown_complete(struct visorhba_devdata *devdata)
devdata->serverchangingstate = false;
}
-/**
+/*
* visorhba_serverdown - Got notified that the IOVM is down
* @devdata: visorhba that is being serviced by downed IOVM.
*
@@ -775,7 +776,7 @@ static int visorhba_serverdown(struct visorhba_devdata *devdata)
return 0;
}
-/**
+/*
* do_scsi_linuxstat - scsi command returned linuxstat
* @cmdrsp: response from IOVM
* @scsicmd: Command issued.
@@ -826,7 +827,7 @@ static int set_no_disk_inquiry_result(unsigned char *buf,
return 0;
}
-/**
+/*
* do_scsi_nolinuxstat - scsi command didn't have linuxstat
* @cmdrsp: response from IOVM
* @scsicmd: Command issued.
@@ -838,7 +839,7 @@ static void
do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
{
struct scsi_device *scsidev;
- unsigned char buf[36];
+ unsigned char *buf;
struct scatterlist *sg;
unsigned int i;
char *this_page;
@@ -853,6 +854,10 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
if (cmdrsp->scsi.no_disk_result == 0)
return;
+ buf = kzalloc(sizeof(char) * 36, GFP_KERNEL);
+ if (!buf)
+ return;
+
/* Linux scsi code wants a device at Lun 0
* to issue report luns, but we don't want
* a disk there so we'll present a processor
@@ -864,6 +869,7 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
if (scsi_sg_count(scsicmd) == 0) {
memcpy(scsi_sglist(scsicmd), buf,
cmdrsp->scsi.bufflen);
+ kfree(buf);
return;
}
@@ -875,6 +881,7 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
memcpy(this_page, buf + bufind, sg[i].length);
kunmap_atomic(this_page_orig);
}
+ kfree(buf);
} else {
devdata = (struct visorhba_devdata *)scsidev->host->hostdata;
for_each_vdisk_match(vdisk, devdata, scsidev) {
@@ -887,7 +894,7 @@ do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
}
}
-/**
+/*
* complete_scsi_command - complete a scsi command
* @uiscmdrsp: Response from Service Partition
* @scsicmd: The scsi command
@@ -909,7 +916,7 @@ complete_scsi_command(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
scsicmd->scsi_done(scsicmd);
}
-/**
+/*
* drain_queue - pull responses out of iochannel
* @cmdrsp: Response from the IOSP
* @devdata: device that owns this iochannel
@@ -951,7 +958,7 @@ drain_queue(struct uiscmdrsp *cmdrsp, struct visorhba_devdata *devdata)
}
}
-/**
+/*
* process_incoming_rsps - Process responses from IOSP
* @v: void pointer to visorhba_devdata
*
@@ -983,7 +990,7 @@ static int process_incoming_rsps(void *v)
return 0;
}
-/**
+/*
* visorhba_pause - function to handle visorbus pause messages
* @dev: device that is pausing.
* @complete_func: function to call when finished
@@ -1003,7 +1010,7 @@ static int visorhba_pause(struct visor_device *dev,
return 0;
}
-/**
+/*
* visorhba_resume - function called when the IO Service Partition is back
* @dev: device that is pausing.
* @complete_func: function to call when finished
@@ -1033,7 +1040,7 @@ static int visorhba_resume(struct visor_device *dev,
return 0;
}
-/**
+/*
* visorhba_probe - device has been discovered, do acquire
* @dev: visor_device that was discovered
*
@@ -1132,7 +1139,7 @@ err_scsi_host_put:
return err;
}
-/**
+/*
* visorhba_remove - remove a visorhba device
* @dev: Device to remove
*
@@ -1174,7 +1181,7 @@ static struct visor_driver visorhba_driver = {
.channel_interrupt = NULL,
};
-/**
+/*
* visorhba_init - driver init routine
*
* Initialize the visorhba driver and register it with visorbus
@@ -1200,8 +1207,8 @@ cleanup_debugfs:
return rc;
}
-/**
- * visorhba_cleanup - driver exit routine
+/*
+ * visorhba_exit - driver exit routine
*
* Unregister driver from the bus and free up memory.
*/
OpenPOWER on IntegriCloud