aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/megaraid/megaraid_sas.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/megaraid/megaraid_sas.c')
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 3c32e69afcd9..511ed52a5807 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -35,6 +35,7 @@
35#include <asm/uaccess.h> 35#include <asm/uaccess.h>
36#include <linux/fs.h> 36#include <linux/fs.h>
37#include <linux/compat.h> 37#include <linux/compat.h>
38#include <linux/mutex.h>
38 39
39#include <scsi/scsi.h> 40#include <scsi/scsi.h>
40#include <scsi/scsi_cmnd.h> 41#include <scsi/scsi_cmnd.h>
@@ -72,7 +73,7 @@ MODULE_DEVICE_TABLE(pci, megasas_pci_table);
72static int megasas_mgmt_majorno; 73static int megasas_mgmt_majorno;
73static struct megasas_mgmt_info megasas_mgmt_info; 74static struct megasas_mgmt_info megasas_mgmt_info;
74static struct fasync_struct *megasas_async_queue; 75static struct fasync_struct *megasas_async_queue;
75static DECLARE_MUTEX(megasas_async_queue_mutex); 76static DEFINE_MUTEX(megasas_async_queue_mutex);
76 77
77/** 78/**
78 * megasas_get_cmd - Get a command from the free pool 79 * megasas_get_cmd - Get a command from the free pool
@@ -80,7 +81,7 @@ static DECLARE_MUTEX(megasas_async_queue_mutex);
80 * 81 *
81 * Returns a free command from the pool 82 * Returns a free command from the pool
82 */ 83 */
83static inline struct megasas_cmd *megasas_get_cmd(struct megasas_instance 84static struct megasas_cmd *megasas_get_cmd(struct megasas_instance
84 *instance) 85 *instance)
85{ 86{
86 unsigned long flags; 87 unsigned long flags;
@@ -262,7 +263,7 @@ megasas_issue_blocked_abort_cmd(struct megasas_instance *instance,
262 * If successful, this function returns the number of SG elements. Otherwise, 263 * If successful, this function returns the number of SG elements. Otherwise,
263 * it returnes -1. 264 * it returnes -1.
264 */ 265 */
265static inline int 266static int
266megasas_make_sgl32(struct megasas_instance *instance, struct scsi_cmnd *scp, 267megasas_make_sgl32(struct megasas_instance *instance, struct scsi_cmnd *scp,
267 union megasas_sgl *mfi_sgl) 268 union megasas_sgl *mfi_sgl)
268{ 269{
@@ -310,7 +311,7 @@ megasas_make_sgl32(struct megasas_instance *instance, struct scsi_cmnd *scp,
310 * If successful, this function returns the number of SG elements. Otherwise, 311 * If successful, this function returns the number of SG elements. Otherwise,
311 * it returnes -1. 312 * it returnes -1.
312 */ 313 */
313static inline int 314static int
314megasas_make_sgl64(struct megasas_instance *instance, struct scsi_cmnd *scp, 315megasas_make_sgl64(struct megasas_instance *instance, struct scsi_cmnd *scp,
315 union megasas_sgl *mfi_sgl) 316 union megasas_sgl *mfi_sgl)
316{ 317{
@@ -359,7 +360,7 @@ megasas_make_sgl64(struct megasas_instance *instance, struct scsi_cmnd *scp,
359 * This function prepares CDB commands. These are typcially pass-through 360 * This function prepares CDB commands. These are typcially pass-through
360 * commands to the devices. 361 * commands to the devices.
361 */ 362 */
362static inline int 363static int
363megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp, 364megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp,
364 struct megasas_cmd *cmd) 365 struct megasas_cmd *cmd)
365{ 366{
@@ -440,7 +441,7 @@ megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp,
440 * 441 *
441 * Frames (and accompanying SGLs) for regular SCSI IOs use this function. 442 * Frames (and accompanying SGLs) for regular SCSI IOs use this function.
442 */ 443 */
443static inline int 444static int
444megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp, 445megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp,
445 struct megasas_cmd *cmd) 446 struct megasas_cmd *cmd)
446{ 447{
@@ -562,7 +563,7 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp,
562 * @scp: SCSI command 563 * @scp: SCSI command
563 * @frame_count: [OUT] Number of frames used to prepare this command 564 * @frame_count: [OUT] Number of frames used to prepare this command
564 */ 565 */
565static inline struct megasas_cmd *megasas_build_cmd(struct megasas_instance 566static struct megasas_cmd *megasas_build_cmd(struct megasas_instance
566 *instance, 567 *instance,
567 struct scsi_cmnd *scp, 568 struct scsi_cmnd *scp,
568 int *frame_count) 569 int *frame_count)
@@ -913,7 +914,7 @@ megasas_complete_abort(struct megasas_instance *instance,
913 * @instance: Adapter soft state 914 * @instance: Adapter soft state
914 * @cmd: Completed command 915 * @cmd: Completed command
915 */ 916 */
916static inline void 917static void
917megasas_unmap_sgbuf(struct megasas_instance *instance, struct megasas_cmd *cmd) 918megasas_unmap_sgbuf(struct megasas_instance *instance, struct megasas_cmd *cmd)
918{ 919{
919 dma_addr_t buf_h; 920 dma_addr_t buf_h;
@@ -957,7 +958,7 @@ megasas_unmap_sgbuf(struct megasas_instance *instance, struct megasas_cmd *cmd)
957 * an alternate status (as in the case of aborted 958 * an alternate status (as in the case of aborted
958 * commands) 959 * commands)
959 */ 960 */
960static inline void 961static void
961megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, 962megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
962 u8 alt_status) 963 u8 alt_status)
963{ 964{
@@ -1104,7 +1105,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
1104 * SCSI mid-layer instead of the status 1105 * SCSI mid-layer instead of the status
1105 * returned by the FW 1106 * returned by the FW
1106 */ 1107 */
1107static inline int 1108static int
1108megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status) 1109megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status)
1109{ 1110{
1110 u32 status; 1111 u32 status;
@@ -2362,11 +2363,11 @@ static int megasas_mgmt_fasync(int fd, struct file *filep, int mode)
2362{ 2363{
2363 int rc; 2364 int rc;
2364 2365
2365 down(&megasas_async_queue_mutex); 2366 mutex_lock(&megasas_async_queue_mutex);
2366 2367
2367 rc = fasync_helper(fd, filep, mode, &megasas_async_queue); 2368 rc = fasync_helper(fd, filep, mode, &megasas_async_queue);
2368 2369
2369 up(&megasas_async_queue_mutex); 2370 mutex_unlock(&megasas_async_queue_mutex);
2370 2371
2371 if (rc >= 0) { 2372 if (rc >= 0) {
2372 /* For sanity check when we get ioctl */ 2373 /* For sanity check when we get ioctl */