1. 15 Aug, 2013 1 commit
    • Rafael J. Wysocki's avatar
      ACPI / PM: Walk physical_node_list under physical_node_lock · b97f921b
      Rafael J. Wysocki authored
      commit 623cf33cb055b1e81fa47e4fc16789b2c129e31e upstream.
      The list of physical devices corresponding to an ACPI device
      object is walked by acpi_system_wakeup_device_seq_show() and
      physical_device_enable_wakeup() without taking that object's
      physical_node_lock mutex.  Since each of those functions may be
      run at any time as a result of a user space action, the lack of
      appropriate locking in them may lead to a kernel crash if that
      happens during device hot-add or hot-remove involving the device
      object in question.
      Fix the issue by modifying acpi_system_wakeup_device_seq_show() and
      physical_device_enable_wakeup() to use physical_node_lock as
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
  2. 09 Apr, 2013 1 commit
    • Al Viro's avatar
      procfs: new helper - PDE_DATA(inode) · d9dda78b
      Al Viro authored
      The only part of proc_dir_entry the code outside of fs/proc
      really cares about is PDE(inode)->data.  Provide a helper
      for that; static inline for now, eventually will be moved
      to fs/proc, along with the knowledge of struct proc_dir_entry
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
  3. 27 Jan, 2013 1 commit
  4. 22 Nov, 2012 1 commit
  5. 21 Sep, 2012 1 commit
    • Lan Tianyu's avatar
      ACPI: Allow ACPI binding with USB-3.0 hub · 1033f904
      Lan Tianyu authored
      A USB port's position and connectability can't be identified on some boards
      via USB hub registers. ACPI _UPC and _PLD can help to resolve this issue
      and so it is necessary to bind USB with ACPI. This patch is to allow ACPI
      binding with USB-3.0 hub.
      Current ACPI only can bind one struct-device to one ACPI device node.
      This can not work with USB-3.0 hub, because the USB-3.0 hub has two logical
      devices. Each works for USB-2.0 and USB-3.0 devices. In the Linux USB subsystem,
      those two logical hubs are treated as two seperate devices that have two struct
      devices. But in the ACPI DSDT, these two logical hubs share one ACPI device
      node. So there is a requirement to bind multi struct-devices to one ACPI
      device node. This patch is to resolve such problem.
      Following is the ACPI device nodes' description under xhci hcd.
      Device (XHC)
                  Device (RHUB)
                      Device (HSP1)
                      Device (HSP2)
                      Device (HSP3)
                      Device (HSP4)
                      Device (SSP1)
                      Device (SSP2)
                      Device (SSP3)
                      Device (SSP4)
      Topology in the Linux
      	device XHC
      	   USB-2.0 logical hub    USB-3.0 logical hub
      		HSP1			SSP1
      		HSP2			SSP2
      		HSP3			SSP3
      		HSP4			SSP4
      This patch also modifies the output of /proc/acpi/wakeup. One ACPI node
      can be associated with multiple devices:
      XHC		S4	*enabled	pci:0000:00:14.0
      RHUB	S0	disabled	usb:usb1
      			disabled	usb:usb2
      Signed-off-by: default avatarLan Tianyu <tianyu.lan@intel.com>
      Acked-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
  6. 31 Oct, 2011 1 commit
  7. 07 Jan, 2011 2 commits
    • Rafael J. Wysocki's avatar
      ACPI / PM: Use device wakeup flags for handling ACPI wakeup devices · f2b56bc8
      Rafael J. Wysocki authored
      There are ACPI devices (buttons and the laptop lid) that can wake up
      the system from sleep states and have no "physical" companion
      devices.  The ACPI subsystem uses two flags, wakeup.state.enabled and
      wakeup.flags.always_enabled, for handling those devices, but they
      are not accessible through the standard device wakeup infrastructure.
      User space can only control them via the /proc/acpi/wakeup interface
      that is not really convenient (e.g. the way in which devices are
      enabled to wake up the system is not portable between different
      systems, because it requires one to know the devices' "names" used in
      the system's ACPI tables).
      To address this problem, use standard device wakeup flags instead of
      the special ACPI flags for handling those devices.  In particular,
      use device_set_wakeup_capable() to mark the ACPI wakeup devices
      during initialization and use device_set_wakeup_enable() to allow
      or disallow them to wake up the system from sleep states.  Rework
      the /proc/acpi/wakeup interface to take these changes into account.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
    • Rafael J. Wysocki's avatar
      ACPI / PM: Do not enable multiple devices to wake up simultaneously · b014f4f1
      Rafael J. Wysocki authored
      If a device is enabled to wake up the system from sleep states via
      /proc/acpi/wakeup and there are other devices associated with the
      same wakeup GPE, all of these devices are automatically enabled to
      wake up the system.  This isn't correct, because the fact the GPE is
      shared need not imply that wakeup power has to be enabled for all the
      devices at the same time (i.e. it is possible that one device will
      have its wakeup power enabled and it will wake up the system from a
      sleep state if the shared wakeup GPE is enabled, while another device
      having its wakeup power disabled will not wake up the system even
      though the GPE is enabled).  Rework acpi_system_write_wakeup_device()
      so that it only enables wakeup for one device at a time.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
  8. 15 Aug, 2010 1 commit
  9. 04 Feb, 2010 1 commit
  10. 28 Oct, 2009 1 commit
    • Arjan van de Ven's avatar
      ACPI: clean up video.c boundary checks and types · 52a2b11c
      Arjan van de Ven authored
      proc.c and video.c are a bit sloppy around types and style,
      confusing gcc for a new feature that'll be in 2.6.33 and will
      cause a warning on the current code.
      This patch changes
      if  (foo + 1 > sizeof bar)
      if (foo >= sizeof(bar))
      which is more kernel-style.
      it also changes a variable in proc.c to unsigned; it gets assigned
      a value from an unsigned type, and is then only compared for > not
      for negative, so using unsigned is just outright the right type
      Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
  11. 03 Oct, 2009 1 commit
  12. 07 Apr, 2009 1 commit
  13. 27 Mar, 2009 1 commit
    • Bjorn Helgaas's avatar
      ACPI: call acpi_sleep_proc_init() explicitly rather than as initcall · 9cee43e0
      Bjorn Helgaas authored
      This patch makes acpi_init() call acpi_sleep_proc_init() directly.
      Previously, acpi_sleep_proc_init() was a late_initcall (sequence 7),
      apparently to make sure that the /proc hierarchy already exists:
          2003/02/13 12:38:03-06:00 mochel
          acpi sleep: demote sleep proc file creation.
          - Make acpi_sleep_proc_init() a late_initcall(), and not called from
            acpi_sleep_init(). This guarantees that the acpi proc hierarchy is at
            least there when we create the dang file.
      This should no longer be an issue because acpi_bus_init() (called early
      in acpi_init()) creates acpi_root_dir (/proc/acpi).
      Signed-off-by: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
  14. 09 Jan, 2009 2 commits
  15. 31 Dec, 2008 1 commit
  16. 10 Dec, 2008 1 commit
  17. 16 Nov, 2008 1 commit
  18. 07 Nov, 2008 1 commit
    • Kay Sievers's avatar
      ACPI: struct device - replace bus_id with dev_name(), dev_set_name() · 0794469d
      Kay Sievers authored
      This patch is part of a larger patch series which will remove
      the "char bus_id[20]" name string from struct device. The device
      name is managed in the kobject anyway, and without any size
      limitation, and just needlessly copied into "struct device".
      To set and read the device name dev_name(dev) and dev_set_name(dev)
      must be used. If your code uses static kobjects, which it shouldn't
      do, "const char *init_name" can be used to statically provide the
      name the registered device should have. At registration time, the
      init_name field is cleared, to enforce the use of dev_name(dev) to
      access the device name at a later time.
      We need to get rid of all occurrences of bus_id in the entire tree
      to be able to enable the new interface. Please apply this patch,
      and possibly convert any remaining remaining occurrences of bus_id.
      We want to submit a patch to -next, which will remove bus_id from
      "struct device", to find the remaining pieces to convert, and finally
      switch over to the new api, which will remove the 20 bytes array
      and does no longer have a size limitation.
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      Signed-Off-By: default avatarKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
  19. 20 Oct, 2008 1 commit
  20. 04 Oct, 2008 1 commit
  21. 04 Jul, 2008 1 commit
  22. 11 Jun, 2008 1 commit
  23. 29 Apr, 2008 1 commit
  24. 28 Dec, 2007 2 commits
    • Signed-off by Yi Yang's avatar
      ACPI: detect invalid argument written to /proc/acpi/alarm · 975c3025
      Signed-off by Yi Yang authored
      /proc/acpi/alarm can't be set correctly, here is a sample:
      [root@localhost /]# echo "2006 09" > /proc/acpi/alarm
      [root@localhost /]# cat /proc/acpi/alarm
      2007-12-09 09:09:09
      [root@localhost /]# echo "2006 04" > /proc/acpi/alarm
      [root@localhost /]# cat /proc/acpi/alarm
      2007-12-04 04:04:04
      [root@localhost /]#
      Obviously, it is wrong, it should consider it as an invalid input.
      after this patch:
      [root@localhost /]# echo "2008 09" > /proc/acpi/alarm
      -bash: echo: write error: Invalid argument
      [root@localhost /]#
      Signed-off-by: default avatarYi Yang <yi.y.yang@intel.com>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
    • Yi Yang's avatar
      ACPI: /proc/acpi/alarm parsing: handle large numbers properly · 08798029
      Yi Yang authored
      In function acpi_system_write_alarm in file drivers/acpi/sleep/proc.c,
      big sec, min, hr, mo, day and yr are counted twice to get reasonable
      values, that is very superfluous, we can do that only once.
      In additon, /proc/acpi/alarm can set a related value which can be
      specified as YYYY years MM months DD days HH hours MM minutes SS
      senconds, it isn't a date, so you can specify as +0000-00-00 96:00:00
      , that means 3 days later, current code can't handle such a case.
      This patch removes unnecessary code and does with the aforementioned
      Before applying this patch:
      [root@localhost /]# cat /proc/acpi/alarm
      2007-12-00 00:00:00
      [root@localhost /]# echo "0000-00-00 96:180:180" > /proc/acpi/alarm
      [root@localhost /]# cat /proc/acpi/alarm
      0007-12-02 **:**:**
      [root@localhost /]#
      After applying this patch:
      [root@localhost ~]# echo "2007-12-00 00:00:00" > /proc/acpi/alarm
      [root@localhost ~]# cat /proc/acpi/alarm
      2007-12-00 00:00:00
      [root@localhost ~]# echo "0000-00-00 96:180:180" > /proc/acpi/alarm
      [root@localhost ~]# cat /proc/acpi/alarm
      0007-12-04 03:03:00
      [root@localhost ~]#
      Signed-off-by: default avatarYi Yang <yi.y.yang@intel.com>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
  25. 25 Oct, 2007 1 commit
    • Linus Torvalds's avatar
      Fix /proc/acpi/alarm BCD alarm encodings · c67c36e4
      Linus Torvalds authored
      This fixes some totally illogical and wrong code that converts things to
      and from BCD mode essentially randomly, does math on values in BCD mode
      etc etc.  Introduce a few helper functions to make it a bit more obvious
      what is going on, and make sure that we always do all the arithmetic
      (and anythign else, for that matter) in binary, not BCD.
      Tested by Mark Lord, who found the problem originally, and also pushed
      the patch back and reminded me about it.
      Signed-off-by: default avatarMark Lord <mlord@pobox.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  26. 28 Aug, 2007 1 commit
  27. 29 Jul, 2007 3 commits
  28. 24 Jul, 2007 1 commit
    • Len Brown's avatar
      ACPI: Kconfig: fold /proc/acpi/sleep under CONFIG_ACPI_PROCFS · 43532c8a
      Len Brown authored
      /proc/acpi/sleep has had its own "default n" option,
      ACPI_SLEEP_PROC_SLEEP, for many months.
      Time to delete ACPI_SLEEP_PROC_SLEEP.
      Users that still need /proc/acpi/sleep can still get it
      along with the other deprecated /proc/acpi files
      by enabling CONFIG_ACPI_PROCFS.
      Also delete ACPI_SLEEP_PROC_FS, which was an umbrella
      for /proc/acpi/sleep, wakeup, alarm, because it was
      effectively just a synonym for ACPI_SLEEP.
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
  29. 10 May, 2007 1 commit
  30. 09 May, 2007 1 commit
    • Rafael J. Wysocki's avatar
      PM: Separate hibernation code from suspend code · a3d25c27
      Rafael J. Wysocki authored
      [ With Johannes Berg <johannes@sipsolutions.net> ]
      Separate the hibernation (aka suspend to disk code) from the other suspend
      code.  In particular:
       * Remove the definitions related to hibernation from include/linux/pm.h
       * Introduce struct hibernation_ops and a new hibernate() function to hibernate
         the system, defined in include/linux/suspend.h
       * Separate suspend code in kernel/power/main.c from hibernation-related code
         in kernel/power/disk.c and kernel/power/user.c (with the help of
       * Switch ACPI (the only user of pm_ops.pm_disk_mode) to hibernation_ops
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Cc: Greg KH <greg@kroah.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Nigel Cunningham <nigel@nigel.suspend2.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  31. 08 May, 2007 1 commit
  32. 07 May, 2007 1 commit
  33. 25 Apr, 2007 1 commit
    • David Brownell's avatar
      ACPI: make /proc/acpi/wakeup more useful · 8aa55591
      David Brownell authored
      This updates /proc/acpi/wakeup to be more informative, primarily by showing
      the sysfs node associated with each wakeup-enabled device.  Example:
      	Device	S-state	  Status   Sysfs node
      	PCI0	  S4	 disabled  no-bus:pci0000:00
      	PS2M	  S4	 disabled  pnp:00:05
      	PS2K	  S4	 disabled  pnp:00:06
      	UAR1	  S4	 disabled  pnp:00:08
      	USB1	  S3	 disabled  pci:0000:00:03.0
      	USB2	  S3	 disabled  pci:0000:00:03.1
      	USB3	  S3	 disabled
      	USB4	  S3	 disabled  pci:0000:00:03.3
      	S139	  S4	 disabled
      	LAN	  S4	 disabled  pci:0000:00:04.0
      	MDM	  S4	 disabled
      	AUD	  S4	 disabled  pci:0000:00:02.7
      	SLPB	  S4	*enabled
      Eventually this file should be removed, but until then it's almost the only
      way we have to tell how the relevant ACPI tables are broken (and cope).  In
      that example, two devices don't actually exist (USB3, S139), one can't issue
      wakeup events (PCI0), and two seem harmlessly (?) confused (MDM and AUD are
      the same PCI device, but it's the _modem_ that does wake-on-ring).
      In particular, we need to be sure driver model nodes are properly hooked
      up before we can get rid of this ACPI-only interface for wakeup events.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
  34. 03 Feb, 2007 1 commit
  35. 10 Jul, 2006 1 commit