From: Binoy Jayan Date: Thu, 8 Jun 2017 10:07:31 +0000 (+0530) Subject: scsi: esas2r: Replace semaphore fs_api_semaphore with mutex X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=249cf320bd5dd3490252cb9f3cdef41f7d1caacc;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git scsi: esas2r: Replace semaphore fs_api_semaphore with mutex The semaphore 'fs_api_semaphore' is used as a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan Reviewed-by: Arnd Bergmann Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h index c5013de964e6..1da6407ee142 100644 --- a/drivers/scsi/esas2r/esas2r.h +++ b/drivers/scsi/esas2r/esas2r.h @@ -946,7 +946,7 @@ struct esas2r_adapter { struct esas2r_mem_desc *vrq_mds; int num_vrqs; struct mutex fm_api_mutex; - struct semaphore fs_api_semaphore; + struct mutex fs_api_mutex; struct semaphore nvram_semaphore; struct atto_ioctl *local_atto_ioctl; u8 fw_coredump_buff[ESAS2R_FWCOREDUMP_SZ]; diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c index ad85b33ab6b4..5b14dd29b764 100644 --- a/drivers/scsi/esas2r/esas2r_init.c +++ b/drivers/scsi/esas2r/esas2r_init.c @@ -328,7 +328,7 @@ int esas2r_init_adapter(struct Scsi_Host *host, struct pci_dev *pcid, spin_lock_init(&a->request_lock); spin_lock_init(&a->fw_event_lock); mutex_init(&a->fm_api_mutex); - sema_init(&a->fs_api_semaphore, 1); + mutex_init(&a->fs_api_mutex); sema_init(&a->nvram_semaphore, 1); esas2r_fw_event_off(a); diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c index c6b041a9f007..97623002908f 100644 --- a/drivers/scsi/esas2r/esas2r_ioctl.c +++ b/drivers/scsi/esas2r/esas2r_ioctl.c @@ -1962,7 +1962,7 @@ int esas2r_read_fs(struct esas2r_adapter *a, char *buf, long off, int count) (struct esas2r_ioctl_fs *)a->fs_api_buffer; /* If another flash request is already in progress, return. */ - if (down_interruptible(&a->fs_api_semaphore)) { + if (mutex_lock_interruptible(&a->fs_api_mutex)) { busy: fs->status = ATTO_STS_OUT_OF_RSRC; return -EBUSY; @@ -1978,7 +1978,7 @@ busy: rq = esas2r_alloc_request(a); if (rq == NULL) { esas2r_debug("esas2r_read_fs: out of requests"); - up(&a->fs_api_semaphore); + mutex_unlock(&a->fs_api_mutex); goto busy; } @@ -2006,7 +2006,7 @@ busy: ; dont_wait: /* Free the request and keep going */ - up(&a->fs_api_semaphore); + mutex_unlock(&a->fs_api_mutex); esas2r_free_request(a, (struct esas2r_request *)rq); /* Pick up possible error code from above */