LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Mike Isely <isely@isely.net>
To: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Cc: video4linux-list@redhat.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	akpm@linux-foundation.org, Mike Isely at pobox <isely@pobox.com>
Subject: Re: [PATCH 4/5] pvrusb2: use mutex instead of semaphore
Date: Fri, 27 Apr 2007 08:55:50 -0500 (CDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0704270854500.16942@cnc.isely.net> (raw)
In-Reply-To: <20070427085027.GF4213@traven>


Whoops.  A straggler.

Signed-off-by: Mike Isely <isely@pobox.com>

On Fri, 27 Apr 2007, Matthias Kaehlcke wrote:

> the pvrusb2 driver use a semaphore as mutex. use the mutex API instead
> of the (binary) semaphore
> 
> Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
> 
> --
> diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
> index 9916cf3..ea450b0 100644
> --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
> +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
> @@ -83,7 +83,7 @@ static struct pvr2_string_table pvr2_client_lists[] = {
>  };
>  
>  static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL};
> -static DECLARE_MUTEX(pvr2_unit_sem);
> +static DEFINE_MUTEX(pvr2_unit_mtx);
>  
>  static int ctlchg = 0;
>  static int initusbreset = 1;
> @@ -2069,14 +2069,14 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
>  	hdw->ctl_read_urb = usb_alloc_urb(0,GFP_KERNEL);
>  	if (!hdw->ctl_read_urb) goto fail;
>  
> -	down(&pvr2_unit_sem); do {
> +	mutex_lock(&pvr2_unit_mtx); do {
>  		for (idx = 0; idx < PVR_NUM; idx++) {
>  			if (unit_pointers[idx]) continue;
>  			hdw->unit_number = idx;
>  			unit_pointers[idx] = hdw;
>  			break;
>  		}
> -	} while (0); up(&pvr2_unit_sem);
> +	} while (0); mutex_unlock(&pvr2_unit_mtx);
>  
>  	cnt1 = 0;
>  	cnt2 = scnprintf(hdw->name+cnt1,sizeof(hdw->name)-cnt1,"pvrusb2");
> @@ -2174,13 +2174,13 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw)
>  	}
>  	pvr2_i2c_core_done(hdw);
>  	pvr2_hdw_remove_usb_stuff(hdw);
> -	down(&pvr2_unit_sem); do {
> +	mutex_lock(&pvr2_unit_mtx); do {
>  		if ((hdw->unit_number >= 0) &&
>  		    (hdw->unit_number < PVR_NUM) &&
>  		    (unit_pointers[hdw->unit_number] == hdw)) {
>  			unit_pointers[hdw->unit_number] = NULL;
>  		}
> -	} while (0); up(&pvr2_unit_sem);
> +	} while (0); mutex_unlock(&pvr2_unit_mtx);
>  	kfree(hdw->controls);
>  	kfree(hdw->mpeg_ctrl_info);
>  	kfree(hdw->std_defs);
> 
> 

-- 
                        |         Mike Isely          |     PGP fingerprint
     Spammers Die!!     |                             | 03 54 43 4D 75 E5 CC 92
                        |   isely @ pobox (dot) com   | 71 16 01 E2 B5 F5 C1 E8
                        |                             |

  reply	other threads:[~2007-04-27 14:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-27  8:38 [PATCH 0/5] use mutex instead of semaphore in several drivers Matthias Kaehlcke
2007-04-27  8:43 ` [PATCH 1/5] Power Management: use mutexes instead of semaphores Matthias Kaehlcke
2007-04-28 10:42   ` Pavel Machek
2007-05-04  5:54   ` Andrew Morton
2007-05-04  7:08     ` Matthias Kaehlcke
2007-05-04  7:18       ` Andrew Morton
2007-04-27  8:45 ` [PATCH 2/5] Kcopyd: use mutex instead of semaphore Matthias Kaehlcke
2007-04-27  8:48 ` [PATCH 3/5] sysdev: " Matthias Kaehlcke
2007-04-27  8:50 ` [PATCH 4/5] pvrusb2: " Matthias Kaehlcke
2007-04-27 13:55   ` Mike Isely [this message]
2007-04-27  8:52 ` [PATCH 5/5] scx200: " Matthias Kaehlcke

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=Pine.LNX.4.64.0704270854500.16942@cnc.isely.net \
    --to=isely@isely.net \
    --cc=akpm@linux-foundation.org \
    --cc=isely@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthias.kaehlcke@gmail.com \
    --cc=video4linux-list@redhat.com \
    --subject='Re: [PATCH 4/5] pvrusb2: use mutex instead of semaphore' \
    /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

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).