public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Zhang Rui <rui.zhang@intel.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: "Brown, Len" <len.brown@intel.com>, linux-acpi@vger.kernel.org
Subject: Re: [patch 4/8] ACPI: video - convert semaphore to a mutex
Date: Wed, 14 Nov 2007 15:17:55 +0800	[thread overview]
Message-ID: <1195024675.1262.45.camel@acpi-hp.sh.intel.com> (raw)
In-Reply-To: <20071105165012.066394463@anvil.corenet.prv>

On Tue, 2007-11-06 at 00:43 +0800, Dmitry Torokhov wrote:
> ACPI: video - convert semaphore to a mutex
> 
> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Zhang Rui <rui.zhang@intel.com>
> ---
>  drivers/acpi/video.c |   21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> Index: work/drivers/acpi/video.c
> ===================================================================
> --- work.orig/drivers/acpi/video.c
> +++ work/drivers/acpi/video.c
> @@ -29,6 +29,7 @@
>  #include <linux/init.h>
>  #include <linux/types.h>
>  #include <linux/list.h>
> +#include <linux/mutex.h>
>  #include <linux/proc_fs.h>
>  #include <linux/seq_file.h>
>  #include <linux/input.h>
> @@ -135,8 +136,8 @@ struct acpi_video_bus {
>         u8 attached_count;
>         struct acpi_video_bus_cap cap;
>         struct acpi_video_bus_flags flags;
> -       struct semaphore sem;
>         struct list_head video_device_list;
> +       struct mutex device_list_lock;  /* protects video_device_list
> */
>         struct proc_dir_entry *dir;
>         struct input_dev *input;
>         char phys[32];  /* for input device */
> @@ -1436,9 +1437,9 @@ acpi_video_bus_get_one_device(struct acp
>                         return -ENODEV;
>                 }
> 
> -               down(&video->sem);
> +               mutex_lock(&video->device_list_lock);
>                 list_add_tail(&data->entry,
> &video->video_device_list);
> -               up(&video->sem);
> +               mutex_unlock(&video->device_list_lock);
> 
>                 acpi_video_device_add_fs(device);
> 
> @@ -1464,12 +1465,12 @@ static void acpi_video_device_rebind(str
>  {
>         struct acpi_video_device *dev;
> 
> -       down(&video->sem);
> +       mutex_lock(&video->device_list_lock);
> 
>         list_for_each_entry(dev, &video->video_device_list, entry)
>                 acpi_video_device_bind(video, dev);
> 
> -       up(&video->sem);
> +       mutex_unlock(&video->device_list_lock);
>  }
> 
>  /*
> @@ -1601,7 +1602,7 @@ static int acpi_video_switch_output(stru
>         unsigned long state;
>         int status = 0;
> 
> -       down(&video->sem);
> +       mutex_lock(&video->device_list_lock);
> 
>         list_for_each(node, &video->video_device_list) {
>                 dev = container_of(node, struct acpi_video_device,
> entry);
> @@ -1619,7 +1620,7 @@ static int acpi_video_switch_output(stru
>         dev_prev = container_of(node->prev, struct acpi_video_device,
> entry);
> 
>   out:
> -       up(&video->sem);
> +       mutex_unlock(&video->device_list_lock);
> 
>         switch (event) {
>         case ACPI_VIDEO_NOTIFY_CYCLE:
> @@ -1738,7 +1739,7 @@ static int acpi_video_bus_put_devices(st
>         int status;
>         struct acpi_video_device *dev, *next;
> 
> -       down(&video->sem);
> +       mutex_lock(&video->device_list_lock);
> 
>         list_for_each_entry_safe(dev, next, &video->video_device_list,
> entry) {
> 
> @@ -1755,7 +1756,7 @@ static int acpi_video_bus_put_devices(st
>                 kfree(dev);
>         }
> 
> -       up(&video->sem);
> +       mutex_unlock(&video->device_list_lock);
> 
>         return 0;
>  }
> @@ -1924,7 +1925,7 @@ static int acpi_video_bus_add(struct acp
>         if (error)
>                 goto err_free_video;
> 
> -       init_MUTEX(&video->sem);
> +       mutex_init(&video->device_list_lock);
>         INIT_LIST_HEAD(&video->video_device_list);
> 
>         acpi_video_bus_get_devices(video, device);
> 
> --
> Dmitry
> 
> 

  reply	other threads:[~2007-11-14  7:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-05 16:43 [patch 0/8] ACPI Video various cleanups & fixes Dmitry Torokhov
2007-11-05 16:43 ` [patch 1/8] ACPI: video - fit input device into sysfs tree Dmitry Torokhov
2007-11-14  7:17   ` Zhang Rui
2007-11-14 16:49     ` Len Brown
2007-11-05 16:43 ` [patch 2/8] ACPI: video - add missing input_free_device() Dmitry Torokhov
2007-11-14  7:17   ` Zhang Rui
2007-11-14 17:00   ` Len Brown
2007-11-05 16:43 ` [patch 3/8] ACPI: video - remove unsafe uses of list_for_each_safe() Dmitry Torokhov
2007-11-14  7:17   ` Zhang Rui
2007-11-14 17:46   ` Len Brown
2007-11-05 16:43 ` [patch 4/8] ACPI: video - convert semaphore to a mutex Dmitry Torokhov
2007-11-14  7:17   ` Zhang Rui [this message]
2007-11-14 17:18     ` Len Brown
2007-11-05 16:43 ` [patch 5/8] ACPI: video - simplify handling of attached devices Dmitry Torokhov
2007-11-14  7:17   ` Zhang Rui
2007-11-14 17:34     ` Len Brown
2007-11-05 16:43 ` [patch 6/8] ACPI: video - properly handle errors when registering proc elements Dmitry Torokhov
2007-11-14  7:18   ` Zhang Rui
2007-11-14 13:36     ` Henrique de Moraes Holschuh
2007-11-14 15:06       ` Dmitry Torokhov
2007-11-14 17:22         ` Len Brown
2007-11-14 17:38     ` Len Brown
2007-11-05 16:43 ` [patch 7/8] ACPI: video - more cleanups Dmitry Torokhov
2007-11-14  7:18   ` Zhang Rui
2007-11-14 17:42     ` Len Brown
2007-11-14 17:47       ` Len Brown
2007-11-05 16:43 ` [patch 8/8] ACPI: video - fix permissions on some proc entries Dmitry Torokhov
2007-11-14  7:18   ` Zhang Rui
2007-11-14  7:17 ` [patch 0/8] ACPI Video various cleanups & fixes Zhang Rui
2007-11-14 15:04   ` Dmitry Torokhov

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=1195024675.1262.45.camel@acpi-hp.sh.intel.com \
    --to=rui.zhang@intel.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.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