Pull sem2mutex into release branch
authorLen Brown <len.brown@intel.com>
Fri, 16 Jun 2006 01:31:47 +0000 (21:31 -0400)
committerLen Brown <len.brown@intel.com>
Fri, 16 Jun 2006 01:31:47 +0000 (21:31 -0400)
1  2 
drivers/acpi/processor_perflib.c
drivers/acpi/scan.c

index f36db22ce1aeb9b745ee815f6266779f31e98945,7c6f97e9c72734b57ff48499c9e0254bff20fc70..44a7b168e0ec04437f562df4de3bcbe826ed012a
@@@ -34,6 -34,7 +34,7 @@@
  #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF
  #include <linux/proc_fs.h>
  #include <linux/seq_file.h>
+ #include <linux/mutex.h>
  
  #include <asm/uaccess.h>
  #endif
@@@ -48,7 -49,7 +49,7 @@@
  #define _COMPONENT            ACPI_PROCESSOR_COMPONENT
  ACPI_MODULE_NAME("acpi_processor")
  
- static DECLARE_MUTEX(performance_sem);
+ static DEFINE_MUTEX(performance_mutex);
  
  /*
   * _PPC support is implemented as a CPUfreq policy notifier:
@@@ -72,7 -73,7 +73,7 @@@ static int acpi_processor_ppc_notifier(
        struct acpi_processor *pr;
        unsigned int ppc = 0;
  
-       down(&performance_sem);
+       mutex_lock(&performance_mutex);
  
        if (event != CPUFREQ_INCOMPATIBLE)
                goto out;
@@@ -93,7 -94,7 +94,7 @@@
                                     core_frequency * 1000);
  
        out:
-       up(&performance_sem);
+       mutex_unlock(&performance_mutex);
  
        return 0;
  }
@@@ -564,32 -565,30 +565,32 @@@ acpi_processor_register_performance(str
        if (!(acpi_processor_ppc_status & PPC_REGISTERED))
                return_VALUE(-EINVAL);
  
-       down(&performance_sem);
+       mutex_lock(&performance_mutex);
  
        pr = processors[cpu];
        if (!pr) {
-               up(&performance_sem);
+               mutex_unlock(&performance_mutex);
                return_VALUE(-ENODEV);
        }
  
        if (pr->performance) {
-               up(&performance_sem);
+               mutex_unlock(&performance_mutex);
                return_VALUE(-EBUSY);
        }
  
 +      WARN_ON(!performance);
 +
        pr->performance = performance;
  
        if (acpi_processor_get_performance_info(pr)) {
                pr->performance = NULL;
-               up(&performance_sem);
+               mutex_unlock(&performance_mutex);
                return_VALUE(-EIO);
        }
  
        acpi_cpufreq_add_file(pr);
  
-       up(&performance_sem);
+       mutex_unlock(&performance_mutex);
        return_VALUE(0);
  }
  
@@@ -603,21 -602,20 +604,21 @@@ acpi_processor_unregister_performance(s
  
        ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance");
  
-       down(&performance_sem);
+       mutex_lock(&performance_mutex);
  
        pr = processors[cpu];
        if (!pr) {
-               up(&performance_sem);
+               mutex_unlock(&performance_mutex);
                return_VOID;
        }
  
 -      kfree(pr->performance->states);
 +      if (pr->performance)
 +              kfree(pr->performance->states);
        pr->performance = NULL;
  
        acpi_cpufreq_remove_file(pr);
  
-       up(&performance_sem);
+       mutex_unlock(&performance_mutex);
  
        return_VOID;
  }
diff --combined drivers/acpi/scan.c
index fc676ac0e3edbbce6c71e0a1964c7ddccd42a7b0,2cb3b0916ebae70afad1f4a48844915638bf1476..fe3693de7ba3c3908f172550464c41623445d83c
@@@ -142,7 -142,7 +142,7 @@@ static void acpi_device_register(struc
        create_sysfs_device_files(device);
  }
  
 -static int acpi_device_unregister(struct acpi_device *device, int type)
 +static void acpi_device_unregister(struct acpi_device *device, int type)
  {
        spin_lock(&acpi_device_lock);
        if (device->parent) {
        acpi_detach_data(device->handle, acpi_bus_data_handler);
        remove_sysfs_device_files(device);
        kobject_unregister(&device->kobj);
 -      return 0;
  }
  
  void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context)
@@@ -233,9 -234,12 +233,9 @@@ static int acpi_bus_get_power_flags(str
  
  int acpi_match_ids(struct acpi_device *device, char *ids)
  {
 -      int error = 0;
 -      struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 -
        if (device->flags.hardware_id)
                if (strstr(ids, device->pnp.hardware_id))
 -                      goto Done;
 +                      return 0;
  
        if (device->flags.compatible_ids) {
                struct acpi_compatible_id_list *cid_list = device->pnp.cid_list;
                /* compare multiple _CID entries against driver ids */
                for (i = 0; i < cid_list->count; i++) {
                        if (strstr(ids, cid_list->id[i].value))
 -                              goto Done;
 +                              return 0;
                }
        }
 -      error = -ENOENT;
 -
 -      Done:
 -      if (buffer.pointer)
 -              acpi_os_free(buffer.pointer);
 -      return error;
 +      return -ENOENT;
  }
  
  static acpi_status
@@@ -432,7 -441,10 +432,7 @@@ acpi_eject_store(struct acpi_device *de
        islockable = device->flags.lockable;
        handle = device->handle;
  
 -      if (type == ACPI_TYPE_PROCESSOR)
 -              result = acpi_bus_trim(device, 0);
 -      else
 -              result = acpi_bus_trim(device, 1);
 +      result = acpi_bus_trim(device, 1);
  
        if (!result)
                result = acpi_eject_operation(handle, islockable);
@@@ -459,7 -471,6 +459,6 @@@ static int acpi_bus_get_perf_flags(stru
     -------------------------------------------------------------------------- */
  
  static LIST_HEAD(acpi_bus_drivers);
- static DECLARE_MUTEX(acpi_bus_drivers_lock);
  
  /**
   * acpi_bus_match - match device IDs to driver's supported IDs
@@@ -536,9 -547,10 +535,9 @@@ static int acpi_start_single_object(str
        return_VALUE(result);
  }
  
 -static int acpi_driver_attach(struct acpi_driver *drv)
 +static void acpi_driver_attach(struct acpi_driver *drv)
  {
        struct list_head *node, *next;
 -      int count = 0;
  
        ACPI_FUNCTION_TRACE("acpi_driver_attach");
  
                        if (!acpi_bus_driver_init(dev, drv)) {
                                acpi_start_single_object(dev);
                                atomic_inc(&drv->references);
 -                              count++;
                                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                                                  "Found driver [%s] for device [%s]\n",
                                                  drv->name, dev->pnp.bus_id));
                spin_lock(&acpi_device_lock);
        }
        spin_unlock(&acpi_device_lock);
 -      return_VALUE(count);
  }
  
 -static int acpi_driver_detach(struct acpi_driver *drv)
 +static void acpi_driver_detach(struct acpi_driver *drv)
  {
        struct list_head *node, *next;
  
                }
        }
        spin_unlock(&acpi_device_lock);
 -      return_VALUE(0);
  }
  
  /**
   * @driver: driver being registered
   *
   * Registers a driver with the ACPI bus.  Searches the namespace for all
 - * devices that match the driver's criteria and binds.  Returns the
 - * number of devices that were claimed by the driver, or a negative
 - * error status for failure.
 + * devices that match the driver's criteria and binds.  Returns zero for
 + * success or a negative error status for failure.
   */
  int acpi_bus_register_driver(struct acpi_driver *driver)
  {
 -      int count;
 -
        ACPI_FUNCTION_TRACE("acpi_bus_register_driver");
  
        if (acpi_disabled)
                return_VALUE(-ENODEV);
  
 -      if (!driver)
 -              return_VALUE(-EINVAL);
 -
        spin_lock(&acpi_device_lock);
        list_add_tail(&driver->node, &acpi_bus_drivers);
        spin_unlock(&acpi_device_lock);
 -      count = acpi_driver_attach(driver);
 +      acpi_driver_attach(driver);
  
 -      return_VALUE(count);
 +      return_VALUE(0);
  }
  
  EXPORT_SYMBOL(acpi_bus_register_driver);
   * Unregisters a driver with the ACPI bus.  Searches the namespace for all
   * devices that match the driver's criteria and unbinds.
   */
 -int acpi_bus_unregister_driver(struct acpi_driver *driver)
 +void acpi_bus_unregister_driver(struct acpi_driver *driver)
  {
 -      int error = 0;
 +      acpi_driver_detach(driver);
  
 -      ACPI_FUNCTION_TRACE("acpi_bus_unregister_driver");
 -
 -      if (driver) {
 -              acpi_driver_detach(driver);
 -
 -              if (!atomic_read(&driver->references)) {
 -                      spin_lock(&acpi_device_lock);
 -                      list_del_init(&driver->node);
 -                      spin_unlock(&acpi_device_lock);
 -              }
 -      } else
 -              error = -EINVAL;
 -      return_VALUE(error);
 +      if (!atomic_read(&driver->references)) {
 +              spin_lock(&acpi_device_lock);
 +              list_del_init(&driver->node);
 +              spin_unlock(&acpi_device_lock);
 +      }
 +      return;
  }
  
  EXPORT_SYMBOL(acpi_bus_unregister_driver);