Commit cf8b8975 authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Linus Torvalds

[PATCH] sem2mutex: drivers/ide

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: default avatarArjan van de Ven <arjan@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Acked-by: default avatarBartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 81861d78
...@@ -313,6 +313,7 @@ ...@@ -313,6 +313,7 @@
#include <linux/cdrom.h> #include <linux/cdrom.h>
#include <linux/ide.h> #include <linux/ide.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/mutex.h>
#include <scsi/scsi.h> /* For SCSI -> ATAPI command conversion */ #include <scsi/scsi.h> /* For SCSI -> ATAPI command conversion */
...@@ -324,7 +325,7 @@ ...@@ -324,7 +325,7 @@
#include "ide-cd.h" #include "ide-cd.h"
static DECLARE_MUTEX(idecd_ref_sem); static DEFINE_MUTEX(idecd_ref_mutex);
#define to_ide_cd(obj) container_of(obj, struct cdrom_info, kref) #define to_ide_cd(obj) container_of(obj, struct cdrom_info, kref)
...@@ -335,11 +336,11 @@ static struct cdrom_info *ide_cd_get(struct gendisk *disk) ...@@ -335,11 +336,11 @@ static struct cdrom_info *ide_cd_get(struct gendisk *disk)
{ {
struct cdrom_info *cd = NULL; struct cdrom_info *cd = NULL;
down(&idecd_ref_sem); mutex_lock(&idecd_ref_mutex);
cd = ide_cd_g(disk); cd = ide_cd_g(disk);
if (cd) if (cd)
kref_get(&cd->kref); kref_get(&cd->kref);
up(&idecd_ref_sem); mutex_unlock(&idecd_ref_mutex);
return cd; return cd;
} }
...@@ -347,9 +348,9 @@ static void ide_cd_release(struct kref *); ...@@ -347,9 +348,9 @@ static void ide_cd_release(struct kref *);
static void ide_cd_put(struct cdrom_info *cd) static void ide_cd_put(struct cdrom_info *cd)
{ {
down(&idecd_ref_sem); mutex_lock(&idecd_ref_mutex);
kref_put(&cd->kref, ide_cd_release); kref_put(&cd->kref, ide_cd_release);
up(&idecd_ref_sem); mutex_unlock(&idecd_ref_mutex);
} }
/**************************************************************************** /****************************************************************************
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include <linux/genhd.h> #include <linux/genhd.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/mutex.h>
#define _IDE_DISK #define _IDE_DISK
...@@ -78,7 +79,7 @@ struct ide_disk_obj { ...@@ -78,7 +79,7 @@ struct ide_disk_obj {
struct kref kref; struct kref kref;
}; };
static DECLARE_MUTEX(idedisk_ref_sem); static DEFINE_MUTEX(idedisk_ref_mutex);
#define to_ide_disk(obj) container_of(obj, struct ide_disk_obj, kref) #define to_ide_disk(obj) container_of(obj, struct ide_disk_obj, kref)
...@@ -89,11 +90,11 @@ static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) ...@@ -89,11 +90,11 @@ static struct ide_disk_obj *ide_disk_get(struct gendisk *disk)
{ {
struct ide_disk_obj *idkp = NULL; struct ide_disk_obj *idkp = NULL;
down(&idedisk_ref_sem); mutex_lock(&idedisk_ref_mutex);
idkp = ide_disk_g(disk); idkp = ide_disk_g(disk);
if (idkp) if (idkp)
kref_get(&idkp->kref); kref_get(&idkp->kref);
up(&idedisk_ref_sem); mutex_unlock(&idedisk_ref_mutex);
return idkp; return idkp;
} }
...@@ -101,9 +102,9 @@ static void ide_disk_release(struct kref *); ...@@ -101,9 +102,9 @@ static void ide_disk_release(struct kref *);
static void ide_disk_put(struct ide_disk_obj *idkp) static void ide_disk_put(struct ide_disk_obj *idkp)
{ {
down(&idedisk_ref_sem); mutex_lock(&idedisk_ref_mutex);
kref_put(&idkp->kref, ide_disk_release); kref_put(&idkp->kref, ide_disk_release);
up(&idedisk_ref_sem); mutex_unlock(&idedisk_ref_mutex);
} }
/* /*
......
...@@ -98,6 +98,7 @@ ...@@ -98,6 +98,7 @@
#include <linux/cdrom.h> #include <linux/cdrom.h>
#include <linux/ide.h> #include <linux/ide.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/mutex.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/irq.h> #include <asm/irq.h>
...@@ -517,7 +518,7 @@ typedef struct { ...@@ -517,7 +518,7 @@ typedef struct {
u8 reserved[4]; u8 reserved[4];
} idefloppy_mode_parameter_header_t; } idefloppy_mode_parameter_header_t;
static DECLARE_MUTEX(idefloppy_ref_sem); static DEFINE_MUTEX(idefloppy_ref_mutex);
#define to_ide_floppy(obj) container_of(obj, struct ide_floppy_obj, kref) #define to_ide_floppy(obj) container_of(obj, struct ide_floppy_obj, kref)
...@@ -528,11 +529,11 @@ static struct ide_floppy_obj *ide_floppy_get(struct gendisk *disk) ...@@ -528,11 +529,11 @@ static struct ide_floppy_obj *ide_floppy_get(struct gendisk *disk)
{ {
struct ide_floppy_obj *floppy = NULL; struct ide_floppy_obj *floppy = NULL;
down(&idefloppy_ref_sem); mutex_lock(&idefloppy_ref_mutex);
floppy = ide_floppy_g(disk); floppy = ide_floppy_g(disk);
if (floppy) if (floppy)
kref_get(&floppy->kref); kref_get(&floppy->kref);
up(&idefloppy_ref_sem); mutex_unlock(&idefloppy_ref_mutex);
return floppy; return floppy;
} }
...@@ -540,9 +541,9 @@ static void ide_floppy_release(struct kref *); ...@@ -540,9 +541,9 @@ static void ide_floppy_release(struct kref *);
static void ide_floppy_put(struct ide_floppy_obj *floppy) static void ide_floppy_put(struct ide_floppy_obj *floppy)
{ {
down(&idefloppy_ref_sem); mutex_lock(&idefloppy_ref_mutex);
kref_put(&floppy->kref, ide_floppy_release); kref_put(&floppy->kref, ide_floppy_release);
up(&idefloppy_ref_sem); mutex_unlock(&idefloppy_ref_mutex);
} }
/* /*
......
...@@ -443,6 +443,7 @@ ...@@ -443,6 +443,7 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/mutex.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/irq.h> #include <asm/irq.h>
...@@ -1011,7 +1012,7 @@ typedef struct ide_tape_obj { ...@@ -1011,7 +1012,7 @@ typedef struct ide_tape_obj {
int debug_level; int debug_level;
} idetape_tape_t; } idetape_tape_t;
static DECLARE_MUTEX(idetape_ref_sem); static DEFINE_MUTEX(idetape_ref_mutex);
static struct class *idetape_sysfs_class; static struct class *idetape_sysfs_class;
...@@ -1024,11 +1025,11 @@ static struct ide_tape_obj *ide_tape_get(struct gendisk *disk) ...@@ -1024,11 +1025,11 @@ static struct ide_tape_obj *ide_tape_get(struct gendisk *disk)
{ {
struct ide_tape_obj *tape = NULL; struct ide_tape_obj *tape = NULL;
down(&idetape_ref_sem); mutex_lock(&idetape_ref_mutex);
tape = ide_tape_g(disk); tape = ide_tape_g(disk);
if (tape) if (tape)
kref_get(&tape->kref); kref_get(&tape->kref);
up(&idetape_ref_sem); mutex_unlock(&idetape_ref_mutex);
return tape; return tape;
} }
...@@ -1036,9 +1037,9 @@ static void ide_tape_release(struct kref *); ...@@ -1036,9 +1037,9 @@ static void ide_tape_release(struct kref *);
static void ide_tape_put(struct ide_tape_obj *tape) static void ide_tape_put(struct ide_tape_obj *tape)
{ {
down(&idetape_ref_sem); mutex_lock(&idetape_ref_mutex);
kref_put(&tape->kref, ide_tape_release); kref_put(&tape->kref, ide_tape_release);
up(&idetape_ref_sem); mutex_unlock(&idetape_ref_mutex);
} }
/* /*
...@@ -1290,11 +1291,11 @@ static struct ide_tape_obj *ide_tape_chrdev_get(unsigned int i) ...@@ -1290,11 +1291,11 @@ static struct ide_tape_obj *ide_tape_chrdev_get(unsigned int i)
{ {
struct ide_tape_obj *tape = NULL; struct ide_tape_obj *tape = NULL;
down(&idetape_ref_sem); mutex_lock(&idetape_ref_mutex);
tape = idetape_devs[i]; tape = idetape_devs[i];
if (tape) if (tape)
kref_get(&tape->kref); kref_get(&tape->kref);
up(&idetape_ref_sem); mutex_unlock(&idetape_ref_mutex);
return tape; return tape;
} }
...@@ -4870,11 +4871,11 @@ static int ide_tape_probe(ide_drive_t *drive) ...@@ -4870,11 +4871,11 @@ static int ide_tape_probe(ide_drive_t *drive)
drive->driver_data = tape; drive->driver_data = tape;
down(&idetape_ref_sem); mutex_lock(&idetape_ref_mutex);
for (minor = 0; idetape_devs[minor]; minor++) for (minor = 0; idetape_devs[minor]; minor++)
; ;
idetape_devs[minor] = tape; idetape_devs[minor] = tape;
up(&idetape_ref_sem); mutex_unlock(&idetape_ref_mutex);
idetape_setup(drive, tape, minor); idetape_setup(drive, tape, minor);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment