26 Apr, 2011

1 commit

  • It turns out that some PCI devices are only found to be
    wakeup-capable during registration, in which case, when
    device_set_wakeup_capable() is called, device_is_registered() already
    returns 'true' for the given device, but dpm_sysfs_add() hasn't been
    called for it yet. This leads to situations in which the device's
    power.can_wakeup flag is not set as requested because of failing
    wakeup_sysfs_add() and its wakeup-related sysfs files are not
    created, although they should be present. This is a post-2.6.38
    regression introduced by commit cb8f51bdadb7969139c2e39c2defd4cde98c1
    (PM: Do not create wakeup sysfs files for devices that cannot wake
    up).

    To work around this problem initialize the device's power.entry
    field to an empty list head and make device_set_wakeup_capable()
    check if it is still empty before attempting to add the devices
    wakeup-related sysfs files with wakeup_sysfs_add(). Namely, if
    power.entry is still empty at this point, device_pm_add() hasn't been
    called yet for the device and its wakeup-related files will be
    created later, so device_set_wakeup_capable() doesn't have to create
    them.

    Reported-and-tested-by: Tino Keitel
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

20 Apr, 2011

1 commit

  • Device suspend/resume infrastructure is used not only by the suspend
    and hibernate code in kernel/power, but also by APM, Xen and the
    kexec jump feature. However, commit 40dc166cb5dddbd36aa4ad11c03915ea
    (PM / Core: Introduce struct syscore_ops for core subsystems PM)
    failed to add syscore_suspend() and syscore_resume() calls to that
    code, which generally leads to breakage when the features in question
    are used.

    To fix this problem, add the missing syscore_suspend() and
    syscore_resume() calls to arch/x86/kernel/apm_32.c, kernel/kexec.c
    and drivers/xen/manage.c.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman
    Acked-by: Ian Campbell

    Rafael J. Wysocki
     

13 Apr, 2011

1 commit


12 Apr, 2011

2 commits

  • In order for MFD drivers to fetch their cell pointer but also their
    platform data one, an mfd cell pointer is added to the platform_device
    structure.
    That allows all MFD sub devices drivers to be MFD agnostic, unless
    they really need to access their MFD cell data. Most of them don't,
    especially the ones for IPs used by both MFD and non MFD SoCs.

    Cc: Grant Likely
    Acked-by: Greg KH
    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     
  • Xen save/restore is going to use hibernate device callbacks for
    quiescing devices and putting them back to normal operations and it
    would need to select CONFIG_HIBERNATION for this purpose. However,
    that also would cause the hibernate interfaces for user space to be
    enabled, which might confuse user space, because the Xen kernels
    don't support hibernation. Moreover, it would be wasteful, as it
    would make the Xen kernels include a substantial amount of code that
    they would never use.

    To address this issue introduce new power management Kconfig option
    CONFIG_HIBERNATE_CALLBACKS, such that it will only select the code
    that is necessary for the hibernate device callbacks to work and make
    CONFIG_HIBERNATION select it. Then, Xen save/restore will be able to
    select CONFIG_HIBERNATE_CALLBACKS without dragging the entire
    hibernate code along with it.

    Signed-off-by: Rafael J. Wysocki
    Tested-by: Shriram Rajagopalan

    Rafael J. Wysocki
     

31 Mar, 2011

1 commit


24 Mar, 2011

1 commit

  • Introduce Kconfig option allowing architectures where sysdev
    operations used during system suspend, resume and shutdown have been
    completely replaced with struct sycore_ops operations to avoid
    building sysdev code that will never be used.

    Make callbacks in struct sys_device and struct sysdev_driver depend
    on ARCH_NO_SYSDEV_OPS to allows us to verify if all of the references
    have been actually removed from the code the given architecture
    depends on.

    Make x86 select ARCH_NO_SYSDEV_OPS.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

17 Mar, 2011

1 commit

  • …/gregkh/driver-core-2.6

    * 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (50 commits)
    printk: do not mangle valid userspace syslog prefixes
    efivars: Add Documentation
    efivars: Expose efivars functionality to external drivers.
    efivars: Parameterize operations.
    efivars: Split out variable registration
    efivars: parameterize efivars
    efivars: Make efivars bin_attributes dynamic
    efivars: move efivars globals into struct efivars
    drivers:misc: ti-st: fix debugging code
    kref: Fix typo in kref documentation
    UIO: add PRUSS UIO driver support
    Fix spelling mistakes in Documentation/zh_CN/SubmittingPatches
    firmware: Fix unaligned memory accesses in dmi-sysfs
    firmware: Add documentation for /sys/firmware/dmi
    firmware: Expose DMI type 15 System Event Log
    firmware: Break out system_event_log in dmi-sysfs
    firmware: Basic dmi-sysfs support
    firmware: Add DMI entry types to the headers
    Driver core: convert platform_{get,set}_drvdata to static inline functions
    Translate linux-2.6/Documentation/magic-number.txt into Chinese
    ...

    Linus Torvalds
     

15 Mar, 2011

11 commits

  • Some subsystems need to carry out suspend/resume and shutdown
    operations with one CPU on-line and interrupts disabled. The only
    way to register such operations is to define a sysdev class and
    a sysdev specifically for this purpose which is cumbersome and
    inefficient. Moreover, the arguments taken by sysdev suspend,
    resume and shutdown callbacks are practically never necessary.

    For this reason, introduce a simpler interface allowing subsystems
    to register operations to be executed very late during system suspend
    and shutdown and very early during resume in the form of
    strcut syscore_ops objects.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • opp_find_freq_exact() documentation has is_available instead
    of available. This also fixes warning with the kernel-doc:
    scripts/kernel-doc drivers/base/power/opp.c >/dev/null
    Warning(drivers/base/power/opp.c:246): No description found for parameter 'available'
    Warning(drivers/base/power/opp.c:246): Excess function parameter 'is_available' description in 'opp_find_freq_exact'

    Signed-off-by: Nishanth Menon
    Signed-off-by: Rafael J. Wysocki

    Nishanth Menon
     
  • The code handling system-wide power transitions (eg. suspend-to-RAM)
    can in theory execute callbacks provided by the device's bus type,
    device type and class in each phase of the power transition. In
    turn, the runtime PM core code only calls one of those callbacks at
    a time, preferring bus type callbacks to device type or class
    callbacks and device type callbacks to class callbacks.

    It seems reasonable to make them both behave in the same way in that
    respect. Moreover, even though a device may belong to two subsystems
    (eg. bus type and device class) simultaneously, in practice power
    management callbacks for system-wide power transitions are always
    provided by only one of them (ie. if the bus type callbacks are
    defined, the device class ones are not and vice versa). Thus it is
    possible to modify the code handling system-wide power transitions
    so that it follows the core runtime PM code (ie. treats the
    subsystem callbacks as mutually exclusive).

    On the other hand, the core runtime PM code will choose to execute,
    for example, a runtime suspend callback provided by the device type
    even if the bus type's struct dev_pm_ops object exists, but the
    runtime_suspend pointer in it happens to be NULL. This is confusing,
    because it may lead to the execution of callbacks from different
    subsystems during different operations (eg. the bus type suspend
    callback may be executed during runtime suspend of the device, while
    the device type callback will be executed during system suspend).

    Make all of the power management code treat subsystem callbacks in
    a consistent way, such that:
    (1) If the device's type is defined (eg. dev->type is not NULL)
    and its pm pointer is not NULL, the callbacks from dev->type->pm
    will be used.
    (2) If dev->type is NULL or dev->type->pm is NULL, but the device's
    class is defined (eg. dev->class is not NULL) and its pm pointer
    is not NULL, the callbacks from dev->class->pm will be used.
    (3) If dev->type is NULL or dev->type->pm is NULL and dev->class is
    NULL or dev->class->pm is NULL, the callbacks from dev->bus->pm
    will be used provided that both dev->bus and dev->bus->pm are
    not NULL.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Kevin Hilman
    Reasoning-sounds-sane-to: Grant Likely
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • The platform bus type is often used to handle Systems-on-a-Chip (SoC)
    where all devices are represented by objects of type struct
    platform_device. In those cases the same "platform" device driver
    may be used with multiple different system configurations, but the
    actions needed to put the devices it handles into a low-power state
    and back into the full-power state may depend on the design of the
    given SoC. The driver, however, cannot possibly include all the
    information necessary for the power management of its device on all
    the systems it is used with. Moreover, the device hierarchy in its
    current form also is not suitable for representing this kind of
    information.

    The patch below attempts to address this problem by introducing
    objects of type struct dev_power_domain that can be used for
    representing power domains within a SoC. Every struct
    dev_power_domain object provides a sets of device power
    management callbacks that can be used to perform what's needed for
    device power management in addition to the operations carried out by
    the device's driver and subsystem.

    Namely, if a struct dev_power_domain object is pointed to by the
    pwr_domain field in a struct device, the callbacks provided by its
    ops member will be executed in addition to the corresponding
    callbacks provided by the device's subsystem and driver during all
    power transitions.

    Signed-off-by: Rafael J. Wysocki
    Tested-and-acked-by: Kevin Hilman

    Rafael J. Wysocki
     
  • The dpm_prepare() function increments the runtime PM reference
    counters of all devices to prevent pm_runtime_suspend() from
    executing subsystem-level callbacks. However, this was supposed to
    guard against a specific race condition that cannot happen, because
    the power management workqueue is freezable, so pm_runtime_suspend()
    can only be called synchronously during system suspend and we can
    rely on subsystems and device drivers to avoid doing that
    unnecessarily.

    Make dpm_prepare() drop the runtime PM reference to each device
    after making sure that runtime resume is not pending for it.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Kevin Hilman

    Rafael J. Wysocki
     
  • After redefining CONFIG_PM to depend on (CONFIG_PM_SLEEP ||
    CONFIG_PM_RUNTIME) the CONFIG_PM_OPS option is redundant and can be
    replaced with CONFIG_PM.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • Currently, wakeup sysfs attributes are created for all devices,
    regardless of whether or not they are wakeup-capable. This is
    excessive and complicates wakeup device identification from user
    space (i.e. to identify wakeup-capable devices user space has to read
    /sys/devices/.../power/wakeup for all devices and see if they are not
    empty).

    Fix this issue by avoiding to create wakeup sysfs files for devices
    that cannot wake up the system from sleep states (i.e. whose
    power.can_wakeup flags are unset during registration) and modify
    device_set_wakeup_capable() so that it adds (or removes) the relevant
    sysfs attributes if a device's wakeup capability status is changed.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • printk()s without a priority level default to KERN_WARNING. To reduce
    noise at KERN_WARNING, this patch sets the priority level appriopriately
    for unleveled printks()s. This should be useful to folks that look at
    dmesg warnings closely.

    Changed these messages to pr_info().

    Signed-off-by: Mandeep Singh Baines
    Signed-off-by: Rafael J. Wysocki

    Mandeep Singh Baines
     
  • Since pm_save_wakeup_count() has just been changed to clear
    events_check_enabled unconditionally before checking if there are
    any new wakeup events registered since the last read from
    /sys/power/wakeup_count, the detection of wakeup events during
    suspend may be disabled, after it's been enabled, by writing a
    "wrong" value back to /sys/power/wakeup_count. For this reason,
    it is not necessary to update events_check_enabled in
    pm_get_wakeup_count() any more.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • According to Documentation/ABI/testing/sysfs-power, the
    /sys/power/wakeup_count interface should only make the kernel react
    to wakeup events during suspend if the last write to it has been
    successful. However, if /sys/power/wakeup_count is written to two
    times in a row, where the first write is successful and the second
    is not, the kernel will still react to wakeup events during suspend
    due to a bug in pm_save_wakeup_count().

    Fix the bug by making pm_save_wakeup_count() clear
    events_check_enabled unconditionally before checking if there are
    any new wakeup events registered since the previous read from
    /sys/power/wakeup_count.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     
  • The memory barrier in wakeup_source_deactivate() is supposed to
    prevent the callers of pm_wakeup_pending() and pm_get_wakeup_count()
    from seeing the new value of events_in_progress (0, in particular)
    and the old value of event_count at the same time. However, if
    wakeup_source_deactivate() is executed by CPU0 and, for instance,
    pm_wakeup_pending() is executed by CPU1, where both processors can
    reorder operations, the memory barrier in wakeup_source_deactivate()
    doesn't affect CPU1 which can reorder reads. In that case CPU1 may
    very well decide to fetch event_count before it's modified and
    events_in_progress after it's been updated, so pm_wakeup_pending()
    may fail to detect a wakeup event. This issue can be addressed by
    using a single atomic variable to store both events_in_progress
    and event_count, so that they can be updated together in a single
    atomic operation.

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

04 Feb, 2011

8 commits

  • The original macro worked only when applied to variables named 'dev'.
    While this could have been fixed by simply renaming the macro argument,
    a more type-safe replacement by an inline function is preferred.

    Signed-off-by: Ferenc Wagner
    Signed-off-by: Greg Kroah-Hartman

    Ferenc Wagner
     
  • As a follow-on to the recent patches I submitted that allowed for a sysfs
    memory block to span multiple memory sections, we should also update the
    probe routine to online all of the memory sections in a memory block. Without
    this patch the current code will only add a single memory section. I think
    the probe routine should add all of the memory sections in the specified memory
    block so that its behavior is in line with memory hotplug actions through
    the sysfs interfaces.

    This patch applies on top of the previous sysfs memory updates to allow
    a sysfs directory o span multiple memory sections.

    https://lkml.org/lkml/2011/1/20/245

    Signed-off-by: Nathan Fontenot
    Signed-off-by: Greg Kroah-Hartman

    Nathan Fontenot
     
  • Update the 'phys_index' property of a the memory_block struct to be
    called start_section_nr, and add a end_section_nr property. The
    data tracked here is the same but the updated naming is more in line
    with what is stored here, namely the first and last section number
    that the memory block spans.

    The names presented to userspace remain the same, phys_index for
    start_section_nr and end_phys_index for end_section_nr, to avoid breaking
    anything in userspace.

    This also updates the node sysfs code to be aware of the new capability for
    a memory block to contain multiple memory sections and be aware of the memory
    block structure name changes (start_section_nr). This requires an additional
    parameter to unregister_mem_sect_under_nodes so that we know which memory
    section of the memory block to unregister.

    Signed-off-by: Nathan Fontenot
    Reviewed-by: Robin Holt
    Reviewed-by: KAMEZAWA Hiroyuki
    Signed-off-by: Greg Kroah-Hartman

    Nathan Fontenot
     
  • Update the memory sysfs code such that each sysfs memory directory is now
    considered a memory block that can span multiple memory sections per
    memory block. The default size of each memory block is SECTION_SIZE_BITS
    to maintain the current behavior of having a single memory section per
    memory block (i.e. one sysfs directory per memory section).

    For architectures that want to have memory blocks span multiple
    memory sections they need only define their own memory_block_size_bytes()
    routine.

    Update the memory hotplug documentation to reflect the new behaviors of
    memory blocks reflected in sysfs.

    Signed-off-by: Nathan Fontenot
    Reviewed-by: Robin Holt
    Reviewed-by: KAMEZAWA Hiroyuki
    Signed-off-by: Greg Kroah-Hartman

    Nathan Fontenot
     
  • When encountering an error while executing the driver's ->add method, we
    should cancel registration and unwind what we've regged so far. The low
    level ->add methods do return proper error codes but those aren't looked
    at in sysdev_driver_register(). Fix that by sharing the unregistering
    code.

    Signed-off-by: Borislav Petkov
    Signed-off-by: Greg Kroah-Hartman

    Borislav Petkov
     
  • Use gcc's __func__ instead of the function name.

    Signed-off-by: Borislav Petkov
    Signed-off-by: Greg Kroah-Hartman

    Borislav Petkov
     
  • Some place in firmware_class.c using "int uevent" define, but others use "bool
    uevent".
    This patch replace all int uevent define to bool.

    Signed-off-by: Bob Liu
    Acked-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Bob Liu
     
  • Add text, courtesy of Kay Sievers, that provides some background on
    device_rename() and why it shouldn't be used.

    Signed-off-by: Timur Tabi
    Signed-off-by: Greg Kroah-Hartman

    Timur Tabi
     

26 Jan, 2011

1 commit

  • This patch (as1445) fixes a bug in the runtime PM core left over from
    the addition of the no_callbacks flag. If this flag is set then it is
    possible for rpm_suspend() to be called in_interrupt, so when
    releasing spinlocks it's important not to re-enable interrupts.

    To avoid an unnecessary save-and-restore of the interrupt flag, the
    patch also inlines a pm_request_idle() call.

    This fixes Bugzilla #27482.

    (The offending code was added in 2.6.37, so it's not necessary to apply
    this to any earlier stable kernels.)

    Signed-off-by: Alan Stern
    Reported-by: tim blechmann
    CC:
    Signed-off-by: Rafael J. Wysocki

    Alan Stern
     

21 Jan, 2011

1 commit

  • The meaning of CONFIG_EMBEDDED has long since been obsoleted; the option
    is used to configure any non-standard kernel with a much larger scope than
    only small devices.

    This patch renames the option to CONFIG_EXPERT in init/Kconfig and fixes
    references to the option throughout the kernel. A new CONFIG_EMBEDDED
    option is added that automatically selects CONFIG_EXPERT when enabled and
    can be used in the future to isolate options that should only be
    considered for embedded systems (RISC architectures, SLOB, etc).

    Calling the option "EXPERT" more accurately represents its intention: only
    expert users who understand the impact of the configuration changes they
    are making should enable it.

    Reviewed-by: Ingo Molnar
    Acked-by: David Woodhouse
    Signed-off-by: David Rientjes
    Cc: Greg KH
    Cc: "David S. Miller"
    Cc: Jens Axboe
    Cc: Arnd Bergmann
    Cc: Robin Holt
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Rientjes
     

14 Jan, 2011

2 commits

  • Add hugepage statistics to per-node sysfs meminfo

    Reviewed-by: Rik van Riel
    Signed-off-by: David Rientjes
    Signed-off-by: Andrea Arcangeli
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Rientjes
     
  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits)
    Documentation/trace/events.txt: Remove obsolete sched_signal_send.
    writeback: fix global_dirty_limits comment runtime -> real-time
    ppc: fix comment typo singal -> signal
    drivers: fix comment typo diable -> disable.
    m68k: fix comment typo diable -> disable.
    wireless: comment typo fix diable -> disable.
    media: comment typo fix diable -> disable.
    remove doc for obsolete dynamic-printk kernel-parameter
    remove extraneous 'is' from Documentation/iostats.txt
    Fix spelling milisec -> ms in snd_ps3 module parameter description
    Fix spelling mistakes in comments
    Revert conflicting V4L changes
    i7core_edac: fix typos in comments
    mm/rmap.c: fix comment
    sound, ca0106: Fix assignment to 'channel'.
    hrtimer: fix a typo in comment
    init/Kconfig: fix typo
    anon_inodes: fix wrong function name in comment
    fix comment typos concerning "consistent"
    poll: fix a typo in comment
    ...

    Fix up trivial conflicts in:
    - drivers/net/wireless/iwlwifi/iwl-core.c (moved to iwl-legacy.c)
    - fs/ext4/ext4.h

    Also fix missed 'diabled' typo in drivers/net/bnx2x/bnx2x.h while at it.

    Linus Torvalds
     

11 Jan, 2011

2 commits

  • …/gregkh/driver-core-2.6

    * 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6:
    driver core: Document that device_rename() is only for networking
    sysfs: remove useless test from sysfs_merge_group
    driver-core: merge private parts of class and bus
    driver core: fix whitespace in class_attr_string

    Linus Torvalds
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (34 commits)
    HID: roccat: Update sysfs attribute doc
    HID: roccat: don't use #pragma pack
    HID: roccat: Add support for Roccat Kone[+] v2
    HID: roccat: reduce number of functions in kone and pyra drivers
    HID: roccat: declare meaning of pack pragma usage in driver headers
    HID: roccat: use class for char device for sysfs attribute creation
    sysfs: Introducing binary attributes for struct class
    HID: hidraw: add compatibility ioctl() for 32-bit applications.
    HID: hid-picolcd: Fix memory leak in picolcd_debug_out_report()
    HID: picolcd: fix misuse of logical operation in place of bitop
    HID: usbhid: base runtime PM on modern API
    HID: replace offsets values with their corresponding BTN_* defines
    HID: hid-mosart: support suspend/resume
    HID: hid-mosart: ignore buttons report
    HID: hid-picolcd: don't use flush_scheduled_work()
    HID: simplify an index check in hid_lookup_collection
    HID: Hoist assigns from ifs
    HID: Remove superfluous __inline__
    HID: Use vzalloc for vmalloc/memset(,0...)
    HID: Add and use hid_: dev_ equivalents
    ...

    Linus Torvalds
     

08 Jan, 2011

1 commit


24 Dec, 2010

6 commits