From: Steven Rostedt <rostedt@goodmis.org>
To: Daniel Walker <dwalker@mvista.com>
Cc: B.Zolnierkiewicz@elka.pw.edu.pl,
LKML <linux-kernel@vger.kernel.org>,
linux-ide@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
Aleksey Makarov <amakarov@dev.rtsoft.ru>
Subject: [PATCH] IDE compat_semaphore to completion
Date: Fri, 25 Nov 2005 16:40:52 -0500 [thread overview]
Message-ID: <1132954852.24417.20.camel@localhost.localdomain> (raw)
In-Reply-To: <1132929218.11915.2.camel@localhost.localdomain>
The following patch is from Montavista. I modified it slightly.
Semaphores are currently being used where it makes more sense for
completions. This patch corrects that.
-- Steve
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Source: MontaVista Software, Inc.
Signed-off-by: Aleksey Makarov <amakarov@ru.mvista.com>
Description:
The patch changes semaphores that are initialized as
locked to complete().
Index: linux-2.6.15-rc2-git5/drivers/ide/ide-probe.c
===================================================================
--- linux-2.6.15-rc2-git5.orig/drivers/ide/ide-probe.c 2005-11-23 07:59:15.000000000 -0500
+++ linux-2.6.15-rc2-git5/drivers/ide/ide-probe.c 2005-11-25 16:15:01.000000000 -0500
@@ -655,7 +655,7 @@
{
ide_hwif_t *hwif = container_of(dev, ide_hwif_t, gendev);
- up(&hwif->gendev_rel_sem);
+ complete(&hwif->gendev_rel_comp);
}
static void hwif_register (ide_hwif_t *hwif)
@@ -1325,7 +1325,7 @@
drive->queue = NULL;
spin_unlock_irq(&ide_lock);
- up(&drive->gendev_rel_sem);
+ complete(&drive->gendev_rel_comp);
}
/*
Index: linux-2.6.15-rc2-git5/drivers/ide/ide.c
===================================================================
--- linux-2.6.15-rc2-git5.orig/drivers/ide/ide.c 2005-11-23 07:59:15.000000000 -0500
+++ linux-2.6.15-rc2-git5/drivers/ide/ide.c 2005-11-25 16:15:01.000000000 -0500
@@ -222,7 +222,7 @@
hwif->mwdma_mask = 0x80; /* disable all mwdma */
hwif->swdma_mask = 0x80; /* disable all swdma */
- sema_init(&hwif->gendev_rel_sem, 0);
+ init_completion(&hwif->gendev_rel_comp);
default_hwif_iops(hwif);
default_hwif_transport(hwif);
@@ -245,7 +245,7 @@
drive->is_flash = 0;
drive->vdma = 0;
INIT_LIST_HEAD(&drive->list);
- sema_init(&drive->gendev_rel_sem, 0);
+ init_completion(&drive->gendev_rel_comp);
}
}
@@ -602,7 +602,7 @@
}
spin_unlock_irq(&ide_lock);
device_unregister(&drive->gendev);
- down(&drive->gendev_rel_sem);
+ wait_for_completion(&drive->gendev_rel_comp);
spin_lock_irq(&ide_lock);
}
hwif->present = 0;
@@ -662,7 +662,7 @@
/* More messed up locking ... */
spin_unlock_irq(&ide_lock);
device_unregister(&hwif->gendev);
- down(&hwif->gendev_rel_sem);
+ wait_for_completion(&hwif->gendev_rel_comp);
/*
* Remove us from the kernel's knowledge
Index: linux-2.6.15-rc2-git5/include/linux/ide.h
===================================================================
--- linux-2.6.15-rc2-git5.orig/include/linux/ide.h 2005-11-23 07:59:21.000000000 -0500
+++ linux-2.6.15-rc2-git5/include/linux/ide.h 2005-11-25 16:25:21.000000000 -0500
@@ -18,6 +18,7 @@
#include <linux/bio.h>
#include <linux/device.h>
#include <linux/pci.h>
+#include <linux/completion.h>
#include <asm/byteorder.h>
#include <asm/system.h>
#include <asm/io.h>
@@ -759,7 +760,7 @@
int crc_count; /* crc counter to reduce drive speed */
struct list_head list;
struct device gendev;
- struct semaphore gendev_rel_sem; /* to deal with device release() */
+ struct completion gendev_rel_comp; /* to deal with device release() */
} ide_drive_t;
#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev)
@@ -915,7 +916,7 @@
unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
struct device gendev;
- struct semaphore gendev_rel_sem; /* To deal with device release() */
+ struct completion gendev_rel_comp; /* To deal with device release() */
void *hwif_data; /* extra hwif data */
next prev parent reply other threads:[~2005-11-25 21:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-25 12:56 [PATCH] 2.6.14-rt15 IDE compat_semaphore to completion Aleksey Makarov
2005-11-25 14:54 ` Ingo Molnar
[not found] ` <1132929218.11915.2.camel@localhost.localdomain>
2005-11-25 21:40 ` Steven Rostedt [this message]
2005-11-25 22:46 ` Steven Rostedt
2005-11-25 22:50 ` [PATCH -rt] convert compat sem in block device sx8 Steven Rostedt
2005-11-25 22:57 ` Steven Rostedt
2005-11-26 12:33 ` Ingo Molnar
2005-11-25 22:53 ` [PATCH -rt] convert watchdog cpu5wdt from compat_sem to completion Steven Rostedt
2005-11-26 12:35 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1132954852.24417.20.camel@localhost.localdomain \
--to=rostedt@goodmis.org \
--cc=B.Zolnierkiewicz@elka.pw.edu.pl \
--cc=akpm@osdl.org \
--cc=amakarov@dev.rtsoft.ru \
--cc=dwalker@mvista.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.