From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: akpm@linux-foundation.org
Cc: linuxppc-dev@ozlabs.org, paulus@samba.org, dwalker@mvista.com
Subject: Re: [patch 4/5] macintosh: media bay: semaphore to mutex
Date: Tue, 10 Jun 2008 09:39:53 +1000 [thread overview]
Message-ID: <1213054793.25745.7.camel@pasglop> (raw)
In-Reply-To: <200806092326.m59NQ9rm014227@imap1.linux-foundation.org>
On Mon, 2008-06-09 at 16:26 -0700, akpm@linux-foundation.org wrote:
> From: Daniel Walker <dwalker@mvista.com>
>
> Signed-off-by: Daniel Walker <dwalker@mvista.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
> drivers/macintosh/mediabay.c | 27 ++++++++++++++-------------
> 1 file changed, 14 insertions(+), 13 deletions(-)
>
> diff -puN drivers/macintosh/mediabay.c~macintosh-media-bay-semaphore-to-mutex drivers/macintosh/mediabay.c
> --- a/drivers/macintosh/mediabay.c~macintosh-media-bay-semaphore-to-mutex
> +++ a/drivers/macintosh/mediabay.c
> @@ -21,6 +21,7 @@
> #include <linux/init.h>
> #include <linux/ide.h>
> #include <linux/kthread.h>
> +#include <linux/mutex.h>
> #include <asm/prom.h>
> #include <asm/pgtable.h>
> #include <asm/io.h>
> @@ -77,7 +78,7 @@ struct media_bay_info {
> int index;
> int cached_gpio;
> int sleeping;
> - struct semaphore lock;
> + struct mutex lock;
> #ifdef CONFIG_BLK_DEV_IDE_PMAC
> ide_hwif_t *cd_port;
> void __iomem *cd_base;
> @@ -459,27 +460,27 @@ int media_bay_set_ide_infos(struct devic
> if (bay->mdev && which_bay == bay->mdev->ofdev.node) {
> int timeout = 5000, index = hwif->index;
>
> - down(&bay->lock);
> + mutex_lock(&bay->lock);
>
> bay->cd_port = hwif;
> bay->cd_base = (void __iomem *) base;
> bay->cd_irq = irq;
>
> if ((MB_CD != bay->content_id) || bay->state != mb_up) {
> - up(&bay->lock);
> + mutex_unlock(&bay->lock);
> return 0;
> }
> printk(KERN_DEBUG "Registered ide%d for media bay %d\n", index, i);
> do {
> if (MB_IDE_READY(i)) {
> bay->cd_index = index;
> - up(&bay->lock);
> + mutex_unlock(&bay->lock);
> return 0;
> }
> mdelay(1);
> } while(--timeout);
> printk(KERN_DEBUG "Timeount waiting IDE in bay %d\n", i);
> - up(&bay->lock);
> + mutex_unlock(&bay->lock);
> return -ENODEV;
> }
> }
> @@ -616,10 +617,10 @@ static int media_bay_task(void *x)
>
> while (!kthread_should_stop()) {
> for (i = 0; i < media_bay_count; ++i) {
> - down(&media_bays[i].lock);
> + mutex_lock(&media_bays[i].lock);
> if (!media_bays[i].sleeping)
> media_bay_step(i);
> - up(&media_bays[i].lock);
> + mutex_unlock(&media_bays[i].lock);
> }
>
> msleep_interruptible(MB_POLL_DELAY);
> @@ -659,7 +660,7 @@ static int __devinit media_bay_attach(st
> bay->index = i;
> bay->ops = match->data;
> bay->sleeping = 0;
> - init_MUTEX(&bay->lock);
> + mutex_init(&bay->lock);
>
> /* Init HW probing */
> if (bay->ops->init)
> @@ -697,10 +698,10 @@ static int media_bay_suspend(struct maci
>
> if (state.event != mdev->ofdev.dev.power.power_state.event
> && (state.event & PM_EVENT_SLEEP)) {
> - down(&bay->lock);
> + mutex_lock(&bay->lock);
> bay->sleeping = 1;
> set_mb_power(bay, 0);
> - up(&bay->lock);
> + mutex_unlock(&bay->lock);
> msleep(MB_POLL_DELAY);
> mdev->ofdev.dev.power.power_state = state;
> }
> @@ -719,12 +720,12 @@ static int media_bay_resume(struct macio
> they seem to help the 3400 get it right.
> */
> /* Force MB power to 0 */
> - down(&bay->lock);
> + mutex_lock(&bay->lock);
> set_mb_power(bay, 0);
> msleep(MB_POWER_DELAY);
> if (bay->ops->content(bay) != bay->content_id) {
> printk("mediabay%d: content changed during sleep...\n", bay->index);
> - up(&bay->lock);
> + mutex_unlock(&bay->lock);
> return 0;
> }
> set_mb_power(bay, 1);
> @@ -740,7 +741,7 @@ static int media_bay_resume(struct macio
> } while((bay->state != mb_empty) &&
> (bay->state != mb_up));
> bay->sleeping = 0;
> - up(&bay->lock);
> + mutex_unlock(&bay->lock);
> }
> return 0;
> }
> _
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
prev parent reply other threads:[~2008-06-09 23:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-09 23:26 [patch 4/5] macintosh: media bay: semaphore to mutex akpm
2008-06-09 23:39 ` Benjamin Herrenschmidt [this message]
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=1213054793.25745.7.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=akpm@linux-foundation.org \
--cc=dwalker@mvista.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).