1. 03 1月, 2013 16 次提交
    • R
      ACPI / PCI: Move the _PRT setup and cleanup code to pci-acpi.c · 38a9a67a
      Rafael J. Wysocki 提交于
      Move the code related to _PRT setup and removal and to power
      resources from acpi_pci_bind() and acpi_pci_unbind() to the .setup()
      and .cleanup() callbacks in acpi_pci_bus and remove acpi_pci_bind()
      and acpi_pci_unbind() that have no purpose any more.  Accordingly,
      remove the code related to device .bind() and .unbind() operations
      from the ACPI PCI root bridge driver.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      38a9a67a
    • R
      ACPI / PCI: Rework the setup and cleanup of device wakeup · d2e5f0c1
      Rafael J. Wysocki 提交于
      Currently, the ACPI wakeup capability of PCI devices is set up
      in two different places, partially in acpi_pci_bind() where
      runtime wakeup is initialized and partially in
      platform_pci_wakeup_init(), where system wakeup is initialized.
      The cleanup is only done in acpi_pci_unbind() and it only covers
      runtime wakeup.
      
      Use the new .setup() and .cleanup() callbacks in struct acpi_bus_type
      to consolidate that code and do the setup and the cleanup each in one
      place.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      d2e5f0c1
    • R
      ACPI: Add .setup() and .cleanup() callbacks to struct acpi_bus_type · 11909ca1
      Rafael J. Wysocki 提交于
      Add two new callbacks,.setup() and .cleanup(), struct acpi_bus_type
      and modify acpi_platform_notify() to call .setup() after executing
      acpi_bind_one() successfully and acpi_platform_notify_remove() to
      call .cleanup() before running acpi_unbind_one().  This will allow
      the users of struct acpi_bus_type, PCI in particular, to specify
      operations to be executed right after the given device has been
      associated with a companion struct acpi_device and right before
      it's going to be detached from that companion, respectively.
      
      The main motivation is to be able to get rid of acpi_pci_bind()
      and acpi_pci_unbind(), which are horrible horrible stuff.  [In short,
      there are three problems with them: The way they populate the .bind()
      and .unbind() callbacks of ACPI devices is rather less than
      straightforward, they require special hotplug-specific paths to be
      present in the ACPI namespace scanning code and by the time
      acpi_pci_unbind() is called the PCI device object in question may
      not exist any more.]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      11909ca1
    • R
      ACPI: Make acpi_bus_scan() and acpi_bus_add() take only one argument · 0cd6ac52
      Rafael J. Wysocki 提交于
      The callers of acpi_bus_add() usually assume that if it has
      succeeded, then a struct acpi_device object has been attached to
      the handle passed as the first argument.  Unfortunately, however,
      this assumption is wrong, because acpi_bus_scan(), and acpi_bus_add()
      too as a result, may return a pointer to a different struct
      acpi_device object on success (it may be an object corresponding to
      one of the descendant ACPI nodes in the namespace scope below that
      handle).
      
      For this reason, the callers of acpi_bus_add() who care about
      whether or not a struct acpi_device object has been created for
      its first argument need to check that using acpi_bus_get_device()
      anyway, so the second argument of acpi_bus_add() is not really
      useful for them.  The same observation applies to acpi_bus_scan()
      executed directly from acpi_scan_init().
      
      Therefore modify the relevant callers of acpi_bus_add() to check the
      existence of the struct acpi_device in question with the help of
      acpi_bus_get_device() and drop the no longer necessary second
      argument of acpi_bus_add().  Accordingly, modify acpi_scan_init() to
      use acpi_bus_get_device() to get acpi_root and drop the no longer
      needed second argument of acpi_bus_scan().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      0cd6ac52
    • R
      ACPI: Replace ACPI device add_type field with a match_driver flag · 209d3b17
      Rafael J. Wysocki 提交于
      After the removal of the second argument of acpi_bus_scan() there is
      no difference between the ACPI_BUS_ADD_MATCH and ACPI_BUS_ADD_START
      add types, so the add_type field in struct acpi_device may be
      replaced with a single flag.  Do that calling the flag match_driver.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      209d3b17
    • R
      ACPI: Drop the second argument of acpi_bus_scan() · e3863094
      Rafael J. Wysocki 提交于
      After the removal of acpi_start_single_object() and acpi_bus_start()
      the second argument of acpi_bus_scan() is not necessary any more,
      so drop it and update acpi_bus_check_add() accordingly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      e3863094
    • R
      ACPI: Remove the arguments of acpi_bus_add() that are not used · 636458de
      Rafael J. Wysocki 提交于
      Notice that acpi_bus_add() uses only 2 of its 4 arguments and
      redefine its header to match the body.  Update all of its callers as
      necessary and observe that this leads to quite a number of removed
      lines of code (Linus will like that).
      
      Add a kerneldoc comment documenting acpi_bus_add() and wonder how
      its callers make wrong assumptions about the second argument (make
      note to self to take care of that later).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      636458de
    • R
      ACPI: Remove acpi_start_single_object() and acpi_bus_start() · 02f57c67
      Rafael J. Wysocki 提交于
      The ACPI PCI root bridge driver was the only ACPI driver implementing
      the .start() callback, which isn't used by any ACPI drivers any more
      now.
      
      For this reason, acpi_start_single_object() has no purpose any more,
      so remove it and all references to it.  Also remove
      acpi_bus_start_device(), whose only purpose was to call
      acpi_start_single_object().
      
      Moreover, since after the removal of acpi_bus_start_device() the
      only purpose of acpi_bus_start() remains to call
      acpi_update_all_gpes(), move that into acpi_bus_add() and drop
      acpi_bus_start() too, remove its header from acpi_bus.h and
      update all of its former users accordingly.
      
      This change was previously proposed in a different from by
      Yinghai Lu.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      02f57c67
    • R
      ACPI / PCI: Fold acpi_pci_root_start() into acpi_pci_root_add() · 47525cda
      Rafael J. Wysocki 提交于
      Move the code from the ACPI PCI root bridge's .start() callback
      routine, acpi_pci_root_start(), directly into acpi_pci_root_add()
      and drop acpi_pci_root_start().
      
      It is safe to do that, because it is now always guaranteed that
      when struct pci_dev objects are created, their companion struct
      acpi_device objects are already present, so it is not necessary to
      wait for them to be created before calling pci_bus_add_devices().
      
      This change was previously proposed in a different form by
      Yinghai Lu.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      47525cda
    • R
      ACPI: Change the ordering of acpi_bus_check_add() · 4002bf38
      Rafael J. Wysocki 提交于
      If acpi_bus_check_add() is called for a handle already having an
      existing struct acpi_device object attached, it is not necessary to
      check the type and status of the device correspondig to it, so
      change the ordering of acpi_bus_check_add() to avoid that.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      4002bf38
    • R
      ACPI: Replace struct acpi_bus_ops with enum type · a2d06a1a
      Rafael J. Wysocki 提交于
      Notice that one member of struct acpi_bus_ops, acpi_op_add, is not
      used anywhere any more and the relationship between its remaining
      members, acpi_op_match and acpi_op_start, is such that it doesn't
      make sense to set the latter without setting the former at the same
      time.  Therefore, replace struct acpi_bus_ops with new a enum type,
      enum acpi_bus_add_type, with three values, ACPI_BUS_ADD_BASIC,
      ACPI_BUS_ADD_MATCH, ACPI_BUS_ADD_START, corresponding to
      both acpi_op_match and acpi_op_start unset, acpi_op_match set and
      acpi_op_start unset, and both acpi_op_match and acpi_op_start set,
      respectively.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      a2d06a1a
    • R
      ACPI: Reduce the usage of struct acpi_bus_ops · ca7b3c4f
      Rafael J. Wysocki 提交于
      Objects of type struct acpi_bus_ops are currently used to pass
      information between different parts of the ACPI namespace scanning
      code, sometimes in quite convoluted ways.  It turns out that that
      is not necessary in some cases, so simplify the code by reducing
      the utilization of struct acpi_bus_ops objects where clearly
      possible.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      ca7b3c4f
    • R
      ACPI: Make acpi_bus_add() and acpi_bus_start() visibly different · 0fc300b0
      Rafael J. Wysocki 提交于
      The current ACPI namespace scanning code suggests that acpi_bus_add()
      and acpi_bus_start() share some code.  In fact, however, they are
      completely different code paths (except for the initial checks), so
      refactor the code to make that distinction visibly clear.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      0fc300b0
    • R
      ACPI: Change the ordering of PCI root bridge driver registrarion · 92ef2a25
      Rafael J. Wysocki 提交于
      Instead of running acpi_pci_root_init() from a separate subsys
      initcall, call it directly from acpi_scan_init() before scanning the
      ACPI namespace for the first time, so that the PCI root bridge
      driver's .add() routine, acpi_pci_root_start(), is always run
      before binding ACPI drivers or attaching "companion" device objects
      to struct acpi_device objects below the root bridge's device node in
      the ACPI namespace.
      
      The first, simpler reason for doing this is that it makes the
      situation during boot more similar to the situation during hotplug,
      in which the ACPI PCI root bridge driver is always present.
      
      The second reason is that acpi_pci_root_init() causes struct pci_dev
      objects to be created for all PCI devices below the bridge and
      these objects may be necessary for whatever is done with the other
      ACPI device nodes in that namespace scope.  For example, devices
      created by acpi_create_platform_device() sometimes may need to be
      added to the device hierarchy as children of PCI bridges.  For this
      purpose, however, the struct pci_dev objects representing those
      bridges need to exist before the platform devices in question are
      registered.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      92ef2a25
    • R
      ACPI: Separate adding ACPI device objects from probing ACPI drivers · 805d410f
      Rafael J. Wysocki 提交于
      Split the ACPI namespace scanning for devices into two passes, such
      that struct acpi_device objects are registerd in the first pass
      without probing ACPI drivers and the drivers are probed against them
      directly in the second pass.
      
      There are two main reasons for doing that.
      
      First, the ACPI PCI root bridge driver's .add() routine,
      acpi_pci_root_add(), causes struct pci_dev objects to be created for
      all PCI devices under the given root bridge.  Usually, there are
      corresponding ACPI device nodes in the ACPI namespace for some of
      those devices and therefore there should be "companion" struct
      acpi_device objects to attach those struct pci_dev objects to.  These
      struct acpi_device objects should exist when the corresponding
      struct pci_dev objects are created, but that is only guaranteed
      during boot and not during hotplug.  This leads to a number of
      functional differences between the boot and the hotplug cases which
      are not strictly necessary and make the code more complicated.
      
      For example, this forces the ACPI PCI root bridge driver to defer the
      registration of the just created struct pci_dev objects and to use a
      special .start() callback routine, acpi_pci_root_start(), to make
      sure that all of the "companion" struct acpi_device objects will be
      present at PCI devices registration time during hotplug.
      
      If those differences can be eliminated, we will be able to
      consolidate the boot and hotplug code paths for the enumeration and
      registration of PCI devices and to reduce the complexity of that
      code quite a bit.
      
      The second reason is that, in general, it should be possible to
      resolve conflicts of resources assigned by the BIOS to different
      devices represented by ACPI namespace nodes before any drivers bind
      to them and before they are attached to "companion" objects
      representing physical devices (such as struct pci_dev).  However, for
      this purpose we first need to enumerate all ACPI device nodes in the
      given namespace scope.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      805d410f
    • J
      leds: leds-gpio: set devm_gpio_request_one() flags param correctly · 2d7c22f6
      Javier Martinez Canillas 提交于
      commit a99d76f9 leds: leds-gpio: use gpio_request_one
      
      changed the leds-gpio driver to use gpio_request_one() instead
      of gpio_request() + gpio_direction_output()
      
      Unfortunately, it also made a semantic change that breaks the
      leds-gpio driver.
      
      The gpio_request_one() flags parameter was set to:
      
      GPIOF_DIR_OUT | (led_dat->active_low ^ state)
      
      Since GPIOF_DIR_OUT is 0, the final flags value will just be the
      XOR'ed value of led_dat->active_low and state.
      
      This value were used to distinguish between HIGH/LOW output initial
      level and call gpio_direction_output() accordingly.
      
      With this new semantic gpio_request_one() will take the flags value
      of 1 as a configuration of input direction (GPIOF_DIR_IN) and will
      call gpio_direction_input() instead of gpio_direction_output().
      
      int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
      {
      ..
      	if (flags & GPIOF_DIR_IN)
      		err = gpio_direction_input(gpio);
      	else
      		err = gpio_direction_output(gpio,
      				(flags & GPIOF_INIT_HIGH) ? 1 : 0);
      ..
      }
      
      The right semantic is to evaluate led_dat->active_low ^ state and
      set the output initial level explicitly.
      Signed-off-by: NJavier Martinez Canillas <javier.martinez@collabora.co.uk>
      Reported-by: NArnaud Patard <arnaud.patard@rtp-net.org>
      Tested-by: NEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Signed-off-by: NBryan Wu <cooloney@gmail.com>
      2d7c22f6
  2. 02 1月, 2013 4 次提交
  3. 30 12月, 2012 7 次提交
  4. 27 12月, 2012 6 次提交
  5. 24 12月, 2012 1 次提交
    • R
      Partly revert "[media] uvcvideo: Set error_idx properly for extended controls API failures" · 9c016d61
      Rafael J. Wysocki 提交于
      Commit f0ed2ce8 ("[media] uvcvideo: Set error_idx properly for
      extended controls API failures") causes user space to behave incorrectly
      on one of my test machines (there is no sound under KDE 4.9.4 using
      pulseaudio and there is a knotify4 process occupying one of the CPU
      cores 100% of the time).  Reverting that commit entirely fixes the
      problem for me.
      
      However, commit f0ed2ce8 appears to do more than it follows from its
      changelog, because the changelog only says about the changes related to
      ctrls->error_idx, while the commit additionally changes error codes
      returned by various functions in uvc_ctrl.c and uvc_v4l2.c.  It turns
      out that the changes of the returned error codes confuse the user spce,
      so it is sufficient to revert the part of commit f0ed2ce8 not
      mentioned in its changelog to fix the problem.
      
      [ 'ENOENT' is not a valid error return from an ioctl to begin with, and
        I don't understand how anybody ever even thought it would be.  - Linus ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
      Cc: Hans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9c016d61
  6. 23 12月, 2012 6 次提交