Commit 82023bb7 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pm+acpi-2-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more ACPI and power management updates from Rafael Wysocki:

 - ACPI-based device hotplug fixes for issues introduced recently and a
   fix for an older error code path bug in the ACPI PCI host bridge
   driver

 - Fix for recently broken OMAP cpufreq build from Viresh Kumar

 - Fix for a recent hibernation regression related to s2disk

 - Fix for a locking-related regression in the ACPI EC driver from
   Puneet Kumar

 - System suspend error code path fix related to runtime PM and runtime
   PM documentation update from Ulf Hansson

 - cpufreq's conservative governor fix from Xiaoguang Chen

 - New processor IDs for intel_idle and turbostat and removal of an
   obsolete Kconfig option from Len Brown

 - New device IDs for the ACPI LPSS (Low-Power Subsystem) driver and
   ACPI-based PCI hotplug (ACPIPHP) cleanup from Mika Westerberg

 - Removal of several ACPI video DMI blacklist entries that are not
   necessary any more from Aaron Lu

 - Rework of the ACPI companion representation in struct device and code
   cleanup related to that change from Rafael J Wysocki, Lan Tianyu and
   Jarkko Nikula

 - Fixes for assigning names to ACPI-enumerated I2C and SPI devices from
   Jarkko Nikula

* tag 'pm+acpi-2-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (24 commits)
  PCI / hotplug / ACPI: Drop unused acpiphp_debug declaration
  ACPI / scan: Set flags.match_driver in acpi_bus_scan_fixed()
  ACPI / PCI root: Clear driver_data before failing enumeration
  ACPI / hotplug: Fix PCI host bridge hot removal
  ACPI / hotplug: Fix acpi_bus_get_device() return value check
  cpufreq: governor: Remove fossil comment in the cpufreq_governor_dbs()
  ACPI / video: clean up DMI table for initial black screen problem
  ACPI / EC: Ensure lock is acquired before accessing ec struct members
  PM / Hibernate: Do not crash kernel in free_basic_memory_bitmaps()
  ACPI / AC: Remove struct acpi_device pointer from struct acpi_ac
  spi: Use stable dev_name for ACPI enumerated SPI slaves
  i2c: Use stable dev_name for ACPI enumerated I2C slaves
  ACPI: Provide acpi_dev_name accessor for struct acpi_device device name
  ACPI / bind: Use (put|get)_device() on ACPI device objects too
  ACPI: Eliminate the DEVICE_ACPI_HANDLE() macro
  ACPI / driver core: Store an ACPI device pointer in struct acpi_dev_node
  cpufreq: OMAP: Fix compilation error 'r & ret undeclared'
  PM / Runtime: Fix error path for prepare
  PM / Runtime: Update documentation around probe|remove|suspend
  cpufreq: conservative: set requested_freq to policy max when it is over policy max
  ...
parents e6d69a60 ed6a8254
...@@ -547,13 +547,11 @@ helper functions described in Section 4. In that case, pm_runtime_resume() ...@@ -547,13 +547,11 @@ helper functions described in Section 4. In that case, pm_runtime_resume()
should be used. Of course, for this purpose the device's runtime PM has to be should be used. Of course, for this purpose the device's runtime PM has to be
enabled earlier by calling pm_runtime_enable(). enabled earlier by calling pm_runtime_enable().
If the device bus type's or driver's ->probe() callback runs It may be desirable to suspend the device once ->probe() has finished.
pm_runtime_suspend() or pm_runtime_idle() or their asynchronous counterparts, Therefore the driver core uses the asyncronous pm_request_idle() to submit a
they will fail returning -EAGAIN, because the device's usage counter is request to execute the subsystem-level idle callback for the device at that
incremented by the driver core before executing ->probe(). Still, it may be time. A driver that makes use of the runtime autosuspend feature, may want to
desirable to suspend the device as soon as ->probe() has finished, so the driver update the last busy mark before returning from ->probe().
core uses pm_runtime_put_sync() to invoke the subsystem-level idle callback for
the device at that time.
Moreover, the driver core prevents runtime PM callbacks from racing with the bus Moreover, the driver core prevents runtime PM callbacks from racing with the bus
notifier callback in __device_release_driver(), which is necessary, because the notifier callback in __device_release_driver(), which is necessary, because the
...@@ -656,7 +654,7 @@ out the following operations: ...@@ -656,7 +654,7 @@ out the following operations:
__pm_runtime_disable() with 'false' as the second argument for every device __pm_runtime_disable() with 'false' as the second argument for every device
right before executing the subsystem-level .suspend_late() callback for it. right before executing the subsystem-level .suspend_late() callback for it.
* During system resume it calls pm_runtime_enable() and pm_runtime_put_sync() * During system resume it calls pm_runtime_enable() and pm_runtime_put()
for every device right after executing the subsystem-level .resume_early() for every device right after executing the subsystem-level .resume_early()
callback and right after executing the subsystem-level .resume() callback callback and right after executing the subsystem-level .resume() callback
for it, respectively. for it, respectively.
......
...@@ -1992,7 +1992,7 @@ sba_connect_bus(struct pci_bus *bus) ...@@ -1992,7 +1992,7 @@ sba_connect_bus(struct pci_bus *bus)
if (PCI_CONTROLLER(bus)->iommu) if (PCI_CONTROLLER(bus)->iommu)
return; return;
handle = PCI_CONTROLLER(bus)->acpi_handle; handle = acpi_device_handle(PCI_CONTROLLER(bus)->companion);
if (!handle) if (!handle)
return; return;
......
...@@ -95,7 +95,7 @@ struct iospace_resource { ...@@ -95,7 +95,7 @@ struct iospace_resource {
}; };
struct pci_controller { struct pci_controller {
void *acpi_handle; struct acpi_device *companion;
void *iommu; void *iommu;
int segment; int segment;
int node; /* nearest node with memory or -1 for global allocation */ int node; /* nearest node with memory or -1 for global allocation */
......
...@@ -436,9 +436,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) ...@@ -436,9 +436,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
if (!controller) if (!controller)
return NULL; return NULL;
controller->acpi_handle = device->handle; controller->companion = device;
pxm = acpi_get_pxm(controller->acpi_handle); pxm = acpi_get_pxm(device->handle);
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
if (pxm >= 0) if (pxm >= 0)
controller->node = pxm_to_node(pxm); controller->node = pxm_to_node(pxm);
...@@ -489,7 +489,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) ...@@ -489,7 +489,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
{ {
struct pci_controller *controller = bridge->bus->sysdata; struct pci_controller *controller = bridge->bus->sysdata;
ACPI_HANDLE_SET(&bridge->dev, controller->acpi_handle); ACPI_COMPANION_SET(&bridge->dev, controller->companion);
return 0; return 0;
} }
......
...@@ -132,7 +132,7 @@ sn_get_bussoft_ptr(struct pci_bus *bus) ...@@ -132,7 +132,7 @@ sn_get_bussoft_ptr(struct pci_bus *bus)
struct acpi_resource_vendor_typed *vendor; struct acpi_resource_vendor_typed *vendor;
handle = PCI_CONTROLLER(bus)->acpi_handle; handle = acpi_device_handle(PCI_CONTROLLER(bus)->companion);
status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS, status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS,
&sn_uuid, &buffer); &sn_uuid, &buffer);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
...@@ -360,7 +360,7 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info, ...@@ -360,7 +360,7 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info,
acpi_status status; acpi_status status;
struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
rootbus_handle = PCI_CONTROLLER(dev)->acpi_handle; rootbus_handle = acpi_device_handle(PCI_CONTROLLER(dev)->companion);
status = acpi_evaluate_integer(rootbus_handle, METHOD_NAME__SEG, NULL, status = acpi_evaluate_integer(rootbus_handle, METHOD_NAME__SEG, NULL,
&segment); &segment);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
......
...@@ -15,7 +15,7 @@ struct pci_sysdata { ...@@ -15,7 +15,7 @@ struct pci_sysdata {
int domain; /* PCI domain */ int domain; /* PCI domain */
int node; /* NUMA node */ int node; /* NUMA node */
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
void *acpi; /* ACPI-specific data */ struct acpi_device *companion; /* ACPI companion device */
#endif #endif
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
void *iommu; /* IOMMU private data */ void *iommu; /* IOMMU private data */
......
...@@ -147,6 +147,8 @@ ...@@ -147,6 +147,8 @@
#define MSR_PP1_ENERGY_STATUS 0x00000641 #define MSR_PP1_ENERGY_STATUS 0x00000641
#define MSR_PP1_POLICY 0x00000642 #define MSR_PP1_POLICY 0x00000642
#define MSR_CORE_C1_RES 0x00000660
#define MSR_AMD64_MC0_MASK 0xc0010044 #define MSR_AMD64_MC0_MASK 0xc0010044
#define MSR_IA32_MCx_CTL(x) (MSR_IA32_MC0_CTL + 4*(x)) #define MSR_IA32_MCx_CTL(x) (MSR_IA32_MC0_CTL + 4*(x))
......
...@@ -518,7 +518,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) ...@@ -518,7 +518,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
sd = &info->sd; sd = &info->sd;
sd->domain = domain; sd->domain = domain;
sd->node = node; sd->node = node;
sd->acpi = device->handle; sd->companion = device;
/* /*
* Maybe the desired pci bus has been already scanned. In such case * Maybe the desired pci bus has been already scanned. In such case
* it is unnecessary to scan the pci bus with the given domain,busnum. * it is unnecessary to scan the pci bus with the given domain,busnum.
...@@ -589,7 +589,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) ...@@ -589,7 +589,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
{ {
struct pci_sysdata *sd = bridge->bus->sysdata; struct pci_sysdata *sd = bridge->bus->sysdata;
ACPI_HANDLE_SET(&bridge->dev, sd->acpi); ACPI_COMPANION_SET(&bridge->dev, sd->companion);
return 0; return 0;
} }
......
...@@ -235,17 +235,6 @@ config ACPI_INITRD_TABLE_OVERRIDE ...@@ -235,17 +235,6 @@ config ACPI_INITRD_TABLE_OVERRIDE
initrd, therefore it's safe to say Y. initrd, therefore it's safe to say Y.
See Documentation/acpi/initrd_table_override.txt for details See Documentation/acpi/initrd_table_override.txt for details
config ACPI_BLACKLIST_YEAR
int "Disable ACPI for systems before Jan 1st this year" if X86_32
default 0
help
Enter a 4-digit year, e.g., 2001, to disable ACPI by default
on platforms with DMI BIOS date before January 1st that year.
"acpi=force" can be used to override this mechanism.
Enter 0 to disable this mechanism and allow ACPI to
run by default no matter what the year. (default)
config ACPI_DEBUG config ACPI_DEBUG
bool "Debug Statements" bool "Debug Statements"
default n default n
......
...@@ -56,7 +56,6 @@ static int ac_sleep_before_get_state_ms; ...@@ -56,7 +56,6 @@ static int ac_sleep_before_get_state_ms;
struct acpi_ac { struct acpi_ac {
struct power_supply charger; struct power_supply charger;
struct acpi_device *adev;
struct platform_device *pdev; struct platform_device *pdev;
unsigned long long state; unsigned long long state;
}; };
...@@ -70,8 +69,9 @@ struct acpi_ac { ...@@ -70,8 +69,9 @@ struct acpi_ac {
static int acpi_ac_get_state(struct acpi_ac *ac) static int acpi_ac_get_state(struct acpi_ac *ac)
{ {
acpi_status status; acpi_status status;
acpi_handle handle = ACPI_HANDLE(&ac->pdev->dev);
status = acpi_evaluate_integer(ac->adev->handle, "_PSR", NULL, status = acpi_evaluate_integer(handle, "_PSR", NULL,
&ac->state); &ac->state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, ACPI_EXCEPTION((AE_INFO, status,
...@@ -119,6 +119,7 @@ static enum power_supply_property ac_props[] = { ...@@ -119,6 +119,7 @@ static enum power_supply_property ac_props[] = {
static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data) static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data)
{ {
struct acpi_ac *ac = data; struct acpi_ac *ac = data;
struct acpi_device *adev;
if (!ac) if (!ac)
return; return;
...@@ -141,10 +142,11 @@ static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data) ...@@ -141,10 +142,11 @@ static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data)
msleep(ac_sleep_before_get_state_ms); msleep(ac_sleep_before_get_state_ms);
acpi_ac_get_state(ac); acpi_ac_get_state(ac);
acpi_bus_generate_netlink_event(ac->adev->pnp.device_class, adev = ACPI_COMPANION(&ac->pdev->dev);
acpi_bus_generate_netlink_event(adev->pnp.device_class,
dev_name(&ac->pdev->dev), dev_name(&ac->pdev->dev),
event, (u32) ac->state); event, (u32) ac->state);
acpi_notifier_call_chain(ac->adev, event, (u32) ac->state); acpi_notifier_call_chain(adev, event, (u32) ac->state);
kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
} }
...@@ -178,8 +180,8 @@ static int acpi_ac_probe(struct platform_device *pdev) ...@@ -178,8 +180,8 @@ static int acpi_ac_probe(struct platform_device *pdev)
if (!pdev) if (!pdev)
return -EINVAL; return -EINVAL;
result = acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev); adev = ACPI_COMPANION(&pdev->dev);
if (result) if (!adev)
return -ENODEV; return -ENODEV;
ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL); ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
...@@ -188,7 +190,6 @@ static int acpi_ac_probe(struct platform_device *pdev) ...@@ -188,7 +190,6 @@ static int acpi_ac_probe(struct platform_device *pdev)
strcpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME); strcpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME);
strcpy(acpi_device_class(adev), ACPI_AC_CLASS); strcpy(acpi_device_class(adev), ACPI_AC_CLASS);
ac->adev = adev;
ac->pdev = pdev; ac->pdev = pdev;
platform_set_drvdata(pdev, ac); platform_set_drvdata(pdev, ac);
......
...@@ -163,6 +163,15 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = { ...@@ -163,6 +163,15 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
{ "80860F41", (unsigned long)&byt_i2c_dev_desc }, { "80860F41", (unsigned long)&byt_i2c_dev_desc },
{ "INT33B2", }, { "INT33B2", },
{ "INT3430", (unsigned long)&lpt_dev_desc },
{ "INT3431", (unsigned long)&lpt_dev_desc },
{ "INT3432", (unsigned long)&lpt_dev_desc },
{ "INT3433", (unsigned long)&lpt_dev_desc },
{ "INT3434", (unsigned long)&lpt_uart_dev_desc },
{ "INT3435", (unsigned long)&lpt_uart_dev_desc },
{ "INT3436", (unsigned long)&lpt_sdio_dev_desc },
{ "INT3437", },
{ } { }
}; };
......
...@@ -111,7 +111,7 @@ int acpi_create_platform_device(struct acpi_device *adev, ...@@ -111,7 +111,7 @@ int acpi_create_platform_device(struct acpi_device *adev,
pdevinfo.id = -1; pdevinfo.id = -1;
pdevinfo.res = resources; pdevinfo.res = resources;
pdevinfo.num_res = count; pdevinfo.num_res = count;
pdevinfo.acpi_node.handle = adev->handle; pdevinfo.acpi_node.companion = adev;
pdev = platform_device_register_full(&pdevinfo); pdev = platform_device_register_full(&pdevinfo);
if (IS_ERR(pdev)) { if (IS_ERR(pdev)) {
dev_err(&adev->dev, "platform device creation failed: %ld\n", dev_err(&adev->dev, "platform device creation failed: %ld\n",
......
...@@ -75,39 +75,6 @@ static struct acpi_blacklist_item acpi_blacklist[] __initdata = { ...@@ -75,39 +75,6 @@ static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
{""} {""}
}; };
#if CONFIG_ACPI_BLACKLIST_YEAR
static int __init blacklist_by_year(void)
{
int year;
/* Doesn't exist? Likely an old system */
if (!dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL)) {
printk(KERN_ERR PREFIX "no DMI BIOS year, "
"acpi=force is required to enable ACPI\n" );
return 1;
}
/* 0? Likely a buggy new BIOS */
if (year == 0) {
printk(KERN_ERR PREFIX "DMI BIOS year==0, "
"assuming ACPI-capable machine\n" );
return 0;
}
if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
"acpi=force is required to enable ACPI\n",
year, CONFIG_ACPI_BLACKLIST_YEAR);
return 1;
}
return 0;
}
#else
static inline int blacklist_by_year(void)
{
return 0;
}
#endif
int __init acpi_blacklisted(void) int __init acpi_blacklisted(void)
{ {
int i = 0; int i = 0;
...@@ -166,8 +133,6 @@ int __init acpi_blacklisted(void) ...@@ -166,8 +133,6 @@ int __init acpi_blacklisted(void)
} }
} }
blacklisted += blacklist_by_year();
dmi_check_system(acpi_osi_dmi_table); dmi_check_system(acpi_osi_dmi_table);
return blacklisted; return blacklisted;
......
...@@ -22,16 +22,12 @@ ...@@ -22,16 +22,12 @@
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/ */
#include <linux/device.h> #include <linux/acpi.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/pm_qos.h> #include <linux/pm_qos.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <acpi/acpi.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#include "internal.h" #include "internal.h"
#define _COMPONENT ACPI_POWER_COMPONENT #define _COMPONENT ACPI_POWER_COMPONENT
...@@ -548,7 +544,7 @@ static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev, ...@@ -548,7 +544,7 @@ static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev,
*/ */
int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in)
{ {
acpi_handle handle = DEVICE_ACPI_HANDLE(dev); acpi_handle handle = ACPI_HANDLE(dev);
struct acpi_device *adev; struct acpi_device *adev;
int ret, d_min, d_max; int ret, d_min, d_max;
...@@ -656,7 +652,7 @@ int acpi_pm_device_run_wake(struct device *phys_dev, bool enable) ...@@ -656,7 +652,7 @@ int acpi_pm_device_run_wake(struct device *phys_dev, bool enable)
if (!device_run_wake(phys_dev)) if (!device_run_wake(phys_dev))
return -EINVAL; return -EINVAL;
handle = DEVICE_ACPI_HANDLE(phys_dev); handle = ACPI_HANDLE(phys_dev);
if (!handle || acpi_bus_get_device(handle, &adev)) { if (!handle || acpi_bus_get_device(handle, &adev)) {
dev_dbg(phys_dev, "ACPI handle without context in %s!\n", dev_dbg(phys_dev, "ACPI handle without context in %s!\n",
__func__); __func__);
...@@ -700,7 +696,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable) ...@@ -700,7 +696,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
if (!device_can_wakeup(dev)) if (!device_can_wakeup(dev))
return -EINVAL; return -EINVAL;
handle = DEVICE_ACPI_HANDLE(dev); handle = ACPI_HANDLE(dev);
if (!handle || acpi_bus_get_device(handle, &adev)) { if (!handle || acpi_bus_get_device(handle, &adev)) {
dev_dbg(dev, "ACPI handle without context in %s!\n", __func__); dev_dbg(dev, "ACPI handle without context in %s!\n", __func__);
return -ENODEV; return -ENODEV;
...@@ -722,7 +718,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable) ...@@ -722,7 +718,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
*/ */
struct acpi_device *acpi_dev_pm_get_node(struct device *dev) struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
{ {
acpi_handle handle = DEVICE_ACPI_HANDLE(dev); acpi_handle handle = ACPI_HANDLE(dev);
struct acpi_device *adev; struct acpi_device *adev;
return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL; return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL;
......
...@@ -173,9 +173,10 @@ static void start_transaction(struct acpi_ec *ec) ...@@ -173,9 +173,10 @@ static void start_transaction(struct acpi_ec *ec)
static void advance_transaction(struct acpi_ec *ec, u8 status) static void advance_transaction(struct acpi_ec *ec, u8 status)
{ {
unsigned long flags; unsigned long flags;
struct transaction *t = ec->curr; struct transaction *t;
spin_lock_irqsave(&ec->lock, flags); spin_lock_irqsave(&ec->lock, flags);
t = ec->curr;
if (!t) if (!t)
goto unlock; goto unlock;
if (t->wlen > t->wi) { if (t->wlen > t->wi) {
......
...@@ -197,30 +197,28 @@ static void acpi_physnode_link_name(char *buf, unsigned int node_id) ...@@ -197,30 +197,28 @@ static void acpi_physnode_link_name(char *buf, unsigned int node_id)
int acpi_bind_one(struct device *dev, acpi_handle handle) int acpi_bind_one(struct device *dev, acpi_handle handle)
{ {
struct acpi_device *acpi_dev; struct acpi_device *acpi_dev = NULL;
acpi_status status;
struct acpi_device_physical_node *physical_node, *pn; struct acpi_device_physical_node *physical_node, *pn;
char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; char physical_node_name[PHYSICAL_NODE_NAME_SIZE];
struct list_head *physnode_list; struct list_head *physnode_list;
unsigned int node_id; unsigned int node_id;
int retval = -EINVAL; int retval = -EINVAL;
if (ACPI_HANDLE(dev)) { if (ACPI_COMPANION(dev)) {
if (handle) { if (handle) {
dev_warn(dev, "ACPI handle is already set\n"); dev_warn(dev, "ACPI companion already set\n");
return -EINVAL; return -EINVAL;
} else { } else {
handle = ACPI_HANDLE(dev); acpi_dev = ACPI_COMPANION(dev);
} }
} else {
acpi_bus_get_device(handle, &acpi_dev);
} }
if (!handle) if (!acpi_dev)
return -EINVAL; return -EINVAL;
get_device(&acpi_dev->dev);
get_device(dev); get_device(dev);
status = acpi_bus_get_device(handle, &acpi_dev);
if (ACPI_FAILURE(status))
goto err;
physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL); physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL);
if (!physical_node) { if (!physical_node) {
retval = -ENOMEM; retval = -ENOMEM;
...@@ -242,10 +240,11 @@ int acpi_bind_one(struct device *dev, acpi_handle handle) ...@@ -242,10 +240,11 @@ int acpi_bind_one(struct device *dev, acpi_handle handle)
dev_warn(dev, "Already associated with ACPI node\n"); dev_warn(dev, "Already associated with ACPI node\n");
kfree(physical_node); kfree(physical_node);
if (ACPI_HANDLE(dev) != handle) if (ACPI_COMPANION(dev) != acpi_dev)
goto err; goto err;
put_device(dev); put_device(dev);
put_device(&acpi_dev->dev);
return 0; return 0;
} }
if (pn->node_id == node_id) { if (pn->node_id == node_id) {
...@@ -259,8 +258,8 @@ int acpi_bind_one(struct device *dev, acpi_handle handle) ...@@ -259,8 +258,8 @@ int acpi_bind_one(struct device *dev, acpi_handle handle)
list_add(&physical_node->node, physnode_list); list_add(&physical_node->node, physnode_list);
acpi_dev->physical_node_count++; acpi_dev->physical_node_count++;
if (!ACPI_HANDLE(dev)) if (!ACPI_COMPANION(dev))
ACPI_HANDLE_SET(dev, acpi_dev->handle); ACPI_COMPANION_SET(dev, acpi_dev);
acpi_physnode_link_name(physical_node_name, node_id); acpi_physnode_link_name(physical_node_name, node_id);
retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
...@@ -283,27 +282,21 @@ int acpi_bind_one(struct device *dev, acpi_handle handle) ...@@ -283,27 +282,21 @@ int acpi_bind_one(struct device *dev, acpi_handle handle)
return 0; return 0;
err: err:
ACPI_HANDLE_SET(dev, NULL); ACPI_COMPANION_SET(dev, NULL);
put_device(dev); put_device(dev);
put_device(&acpi_dev->dev);
return retval; return retval;
} }
EXPORT_SYMBOL_GPL(acpi_bind_one); EXPORT_SYMBOL_GPL(acpi_bind_one);
int acpi_unbind_one(struct device *dev) int acpi_unbind_one(struct device *dev)
{ {
struct acpi_device *acpi_dev = ACPI_COMPANION(dev);
struct acpi_device_physical_node *entry; struct acpi_device_physical_node *entry;
struct acpi_device *acpi_dev;
acpi_status status;
if (!ACPI_HANDLE(dev)) if (!acpi_dev)
return 0; return 0;
status = acpi_bus_get_device(ACPI_HANDLE(dev), &acpi_dev);
if (ACPI_FAILURE(status)) {
dev_err(dev, "Oops, ACPI handle corrupt in %s()\n", __func__);
return -EINVAL;
}
mutex_lock(&acpi_dev->physical_node_lock); mutex_lock(&acpi_dev->physical_node_lock);
list_for_each_entry(entry, &acpi_dev->physical_node_list, node) list_for_each_entry(entry, &acpi_dev->physical_node_list, node)
...@@ -316,9 +309,10 @@ int acpi_unbind_one(struct device *dev) ...@@ -316,9 +309,10 @@ int acpi_unbind_one(struct device *dev)
acpi_physnode_link_name(physnode_name, entry->node_id); acpi_physnode_link_name(physnode_name, entry->node_id);
sysfs_remove_link(&acpi_dev->dev.kobj, physnode_name); sysfs_remove_link(&acpi_dev->dev.kobj, physnode_name);
sysfs_remove_link(&dev->kobj, "firmware_node"); sysfs_remove_link(&dev->kobj, "firmware_node");
ACPI_HANDLE_SET(dev, NULL); ACPI_COMPANION_SET(dev, NULL);
/* acpi_bind_one() increase refcnt by one. */ /* Drop references taken by acpi_bind_one(). */
put_device(dev); put_device(dev);
put_device(&acpi_dev->dev);
kfree(entry); kfree(entry);
break; break;
} }
...@@ -328,6 +322,15 @@ int acpi_unbind_one(struct device *dev) ...@@ -328,6 +322,15 @@ int acpi_unbind_one(struct device *dev)
} }
EXPORT_SYMBOL_GPL(acpi_unbind_one); EXPORT_SYMBOL_GPL(acpi_unbind_one);
void acpi_preset_companion(struct device *dev, acpi_handle parent, u64 addr)
{
struct acpi_device *adev;
if (!acpi_bus_get_device(acpi_get_child(parent, addr), &adev))
ACPI_COMPANION_SET(dev, adev);
}
EXPORT_SYMBOL_GPL(acpi_preset_companion);
static int acpi_platform_notify(struct device *dev) static int acpi_platform_notify(struct device *dev)
{ {
struct acpi_bus_type *type = acpi_get_bus_type(dev); struct acpi_bus_type *type = acpi_get_bus_type(dev);
......
...@@ -575,6 +575,7 @@ static int acpi_pci_root_add(struct acpi_device *device, ...@@ -575,6 +575,7 @@ static int acpi_pci_root_add(struct acpi_device *device,
dev_err(&device->dev, dev_err(&device->dev,
"Bus %04x:%02x not present in PCI namespace\n", "Bus %04x:%02x not present in PCI namespace\n",
root->segment, (unsigned int)root->secondary.start); root->segment, (unsigned int)root->secondary.start);
device->driver_data = NULL;
result = -ENODEV; result = -ENODEV;
goto end; goto end;
} }
......
...@@ -289,24 +289,17 @@ void acpi_bus_device_eject(void *data, u32 ost_src) ...@@ -289,24 +289,17 @@ void acpi_bus_device_eject(void *data, u32 ost_src)
{ {
struct acpi_device *device = data; struct acpi_device *device = data;
acpi_handle handle = device->handle; acpi_handle handle = device->handle;
struct acpi_scan_handler *handler;
u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE;
int error; int error;
lock_device_hotplug(); lock_device_hotplug();
mutex_lock(&acpi_scan_lock); mutex_lock(&acpi_scan_lock);
handler = device->handler;
if (!handler || !handler->hotplug.enabled) {
put_device(&device->dev);
goto err_support;
}
if (ost_src == ACPI_NOTIFY_EJECT_REQUEST) if (ost_src == ACPI_NOTIFY_EJECT_REQUEST)
acpi_evaluate_hotplug_ost(handle, ACPI_NOTIFY_EJECT_REQUEST, acpi_evaluate_hotplug_ost(handle, ACPI_NOTIFY_EJECT_REQUEST,
ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
if (handler->hotplug.mode == AHM_CONTAINER) if (device->handler && device->handler->hotplug.mode == AHM_CONTAINER)
kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
error = acpi_scan_hot_remove(device); error = acpi_scan_hot_remove(device);
...@@ -411,8 +404,7 @@ static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data) ...@@ -411,8 +404,7 @@ static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data)
break; break;
case ACPI_NOTIFY_EJECT_REQUEST: case ACPI_NOTIFY_EJECT_REQUEST:
acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n"); acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n");
status = acpi_bus_get_device(handle, &adev); if (acpi_bus_get_device(handle, &adev))
if (ACPI_FAILURE(status))
goto err_out; goto err_out;
get_device(&adev->dev); get_device(&adev->dev);
...@@ -1997,6 +1989,7 @@ static int acpi_bus_scan_fixed(void) ...@@ -1997,6 +1989,7 @@ static int acpi_bus_scan_fixed(void)
if (result) if (result)
return result; return result;
device->flags.match_driver = true;
result = device_attach(&device->dev); result = device_attach(&device->dev);
if (result < 0) if (result < 0)
return result; return result;
...@@ -2013,6 +2006,7 @@ static int acpi_bus_scan_fixed(void) ...@@ -2013,6 +2006,7 @@ static int acpi_bus_scan_fixed(void)
if (result) if (result)
return result; return result;
device->flags.match_driver = true;
result = device_attach(&device->dev); result = device_attach(&device->dev);
} }
......
...@@ -81,13 +81,6 @@ module_param(brightness_switch_enabled, bool, 0644); ...@@ -81,13 +81,6 @@ module_param(brightness_switch_enabled, bool, 0644);
static bool allow_duplicates; static bool allow_duplicates;
module_param(allow_duplicates, bool, 0644); module_param(allow_duplicates, bool, 0644);
/*
* Some BIOSes claim they use minimum backlight at boot,
* and this may bring dimming screen after boot
*/
static bool use_bios_initial_backlight = 1;
module_param(use_bios_initial_backlight, bool, 0644);
/* /*
* For Windows 8 systems: if set ture and the GPU driver has * For Windows 8 systems: if set ture and the GPU driver has
* registered a backlight interface, skip registering ACPI video's. * registered a backlight interface, skip registering ACPI video's.
...@@ -406,12 +399,6 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d) ...@@ -406,12 +399,6 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
return 0; return 0;
} }
static int video_ignore_initial_backlight(const struct dmi_system_id *d)
{
use_bios_initial_backlight = 0;
return 0;
}
static struct dmi_system_id video_dmi_table[] __initdata = { static struct dmi_system_id video_dmi_table[] __initdata = {
/* /*
* Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
...@@ -456,54 +443,6 @@ static struct dmi_system_id video_dmi_table[] __initdata = { ...@@ -456,54 +443,6 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"), DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"),
}, },
}, },
{
.callback = video_ignore_initial_backlight,
.ident = "HP Folio 13-2000",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP Folio 13 - 2000 Notebook PC"),
},
},
{
.callback = video_ignore_initial_backlight,
.ident = "Fujitsu E753",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "FUJITSU"),
DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E753"),
},
},
{
.callback = video_ignore_initial_backlight,
.ident = "HP Pavilion dm4",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dm4 Notebook PC"),
},
},
{
.callback = video_ignore_initial_backlight,
.ident = "HP Pavilion g6 Notebook PC",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion g6 Notebook PC"),
},
},
{
.callback = video_ignore_initial_backlight,
.ident = "HP 1000 Notebook PC",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP 1000 Notebook PC"),
},
},
{
.callback = video_ignore_initial_backlight,
.ident = "HP Pavilion m4",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion m4 Notebook PC"),
},
},
{} {}
}; };
...@@ -839,20 +778,18 @@ acpi_video_init_brightness(struct acpi_video_device *device) ...@@ -839,20 +778,18 @@ acpi_video_init_brightness(struct acpi_video_device *device)
if (!device->cap._BQC) if (!device->cap._BQC)
goto set_level; goto set_level;
if (use_bios_initial_backlight) { level = acpi_video_bqc_value_to_level(device, level_old);
level = acpi_video_bqc_value_to_level(device, level_old); /*
/* * On some buggy laptops, _BQC returns an uninitialized
* On some buggy laptops, _BQC returns an uninitialized * value when invoked for the first time, i.e.
* value when invoked for the first time, i.e. * level_old is invalid (no matter whether it's a level
* level_old is invalid (no matter whether it's a level * or an index). Set the backlight to max_level in this case.
* or an index). Set the backlight to max_level in this case. */
*/ for (i = 2; i < br->count; i++)
for (i = 2; i < br->count; i++) if (level == br->levels[i])
if (level == br->levels[i]) break;
break; if (i == br->count || !level)
if (i == br->count || !level) level = max_level;
level = max_level;
}
set_level: set_level:
result = acpi_video_device_lcd_set_level(device, level); result = acpi_video_device_lcd_set_level(device, level);
......
...@@ -185,7 +185,7 @@ void ata_acpi_bind_port(struct ata_port *ap) ...@@ -185,7 +185,7 @@ void ata_acpi_bind_port(struct ata_port *ap)
if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_handle) if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_handle)
return; return;
ACPI_HANDLE_SET(&ap->tdev, acpi_get_child(host_handle, ap->port_no)); acpi_preset_companion(&ap->tdev, host_handle, ap->port_no);
if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0) if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0)
ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; ap->pflags |= ATA_PFLAG_INIT_GTM_VALID;
...@@ -222,7 +222,7 @@ void ata_acpi_bind_dev(struct ata_device *dev) ...@@ -222,7 +222,7 @@ void ata_acpi_bind_dev(struct ata_device *dev)
parent_handle = port_handle; parent_handle = port_handle;
} }
ACPI_HANDLE_SET(&dev->tdev, acpi_get_child(parent_handle, adr)); acpi_preset_companion(&dev->tdev, parent_handle, adr);
register_hotplug_dock_device(ata_dev_acpi_handle(dev), register_hotplug_dock_device(ata_dev_acpi_handle(dev),
&ata_acpi_dev_dock_ops, dev, NULL, NULL); &ata_acpi_dev_dock_ops, dev, NULL, NULL);
......
...@@ -432,7 +432,7 @@ struct platform_device *platform_device_register_full( ...@@ -432,7 +432,7 @@ struct platform_device *platform_device_register_full(
goto err_alloc; goto err_alloc;
pdev->dev.parent = pdevinfo->parent; pdev->dev.parent = pdevinfo->parent;
ACPI_HANDLE_SET(&pdev->dev, pdevinfo->acpi_node.handle); ACPI_COMPANION_SET(&pdev->dev, pdevinfo->acpi_node.companion);
if (pdevinfo->dma_mask) { if (pdevinfo->dma_mask) {
/* /*
...@@ -463,7 +463,7 @@ struct platform_device *platform_device_register_full( ...@@ -463,7 +463,7 @@ struct platform_device *platform_device_register_full(
ret = platform_device_add(pdev); ret = platform_device_add(pdev);
if (ret) { if (ret) {
err: err:
ACPI_HANDLE_SET(&pdev->dev, NULL); ACPI_COMPANION_SET(&pdev->dev, NULL);
kfree(pdev->dev.dma_mask); kfree(pdev->dev.dma_mask);
err_alloc: err_alloc:
......
...@@ -1350,6 +1350,9 @@ static int device_prepare(struct device *dev, pm_message_t state) ...@@ -1350,6 +1350,9 @@ static int device_prepare(struct device *dev, pm_message_t state)
device_unlock(dev); device_unlock(dev);
if (error)
pm_runtime_put(dev);
return error; return error;
} }
......
...@@ -68,6 +68,9 @@ static void cs_check_cpu(int cpu, unsigned int load) ...@@ -68,6 +68,9 @@ static void cs_check_cpu(int cpu, unsigned int load)
dbs_info->requested_freq += get_freq_target(cs_tuners, policy); dbs_info->requested_freq += get_freq_target(cs_tuners, policy);
if (dbs_info->requested_freq > policy->max)
dbs_info->requested_freq = policy->max;
__cpufreq_driver_target(policy, dbs_info->requested_freq, __cpufreq_driver_target(policy, dbs_info->requested_freq,
CPUFREQ_RELATION_H); CPUFREQ_RELATION_H);
return; return;
......
...@@ -328,10 +328,6 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, ...@@ -328,10 +328,6 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
dbs_data->cdata->gov_dbs_timer); dbs_data->cdata->gov_dbs_timer);
} }
/*
* conservative does not implement micro like ondemand
* governor, thus we are bound to jiffes/HZ
*/
if (dbs_data->cdata->governor == GOV_CONSERVATIVE) { if (dbs_data->cdata->governor == GOV_CONSERVATIVE) {
cs_dbs_info->down_skip = 0; cs_dbs_info->down_skip = 0;
cs_dbs_info->enable = 1; cs_dbs_info->enable = 1;
......
...@@ -53,6 +53,7 @@ static unsigned int omap_getspeed(unsigned int cpu) ...@@ -53,6 +53,7 @@ static unsigned int omap_getspeed(unsigned int cpu)
static int omap_target(struct cpufreq_policy *policy, unsigned int index) static int omap_target(struct cpufreq_policy *policy, unsigned int index)
{ {
int r, ret;
struct dev_pm_opp *opp; struct dev_pm_opp *opp;
unsigned long freq, volt = 0, volt_old = 0, tol = 0; unsigned long freq, volt = 0, volt_old = 0, tol = 0;
unsigned int old_freq, new_freq; unsigned int old_freq, new_freq;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/acpi_gpio.h> #include <linux/acpi_gpio.h>
#include <linux/idr.h> #include <linux/idr.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/acpi.h>
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include <trace/events/gpio.h> #include <trace/events/gpio.h>
......
...@@ -196,7 +196,7 @@ static bool intel_dsm_pci_probe(struct pci_dev *pdev) ...@@ -196,7 +196,7 @@ static bool intel_dsm_pci_probe(struct pci_dev *pdev)
acpi_handle dhandle; acpi_handle dhandle;
int ret; int ret;
dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); dhandle = ACPI_HANDLE(&pdev->dev);
if (!dhandle) if (!dhandle)
return false; return false;
......
...@@ -638,7 +638,7 @@ static void intel_didl_outputs(struct drm_device *dev) ...@@ -638,7 +638,7 @@ static void intel_didl_outputs(struct drm_device *dev)
u32 temp; u32 temp;
int i = 0; int i = 0;
handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev); handle = ACPI_HANDLE(&dev->pdev->dev);
if (!handle || acpi_bus_get_device(handle, &acpi_dev)) if (!handle || acpi_bus_get_device(handle, &acpi_dev))
return; return;
......
...@@ -116,7 +116,7 @@ mxm_shadow_dsm(struct nouveau_mxm *mxm, u8 version) ...@@ -116,7 +116,7 @@ mxm_shadow_dsm(struct nouveau_mxm *mxm, u8 version)
acpi_handle handle; acpi_handle handle;
int ret; int ret;
handle = DEVICE_ACPI_HANDLE(&device->pdev->dev); handle = ACPI_HANDLE(&device->pdev->dev);
if (!handle) if (!handle)
return false; return false;
......
...@@ -256,7 +256,7 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev) ...@@ -256,7 +256,7 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev)
acpi_handle dhandle; acpi_handle dhandle;
int retval = 0; int retval = 0;
dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); dhandle = ACPI_HANDLE(&pdev->dev);
if (!dhandle) if (!dhandle)
return false; return false;
...@@ -414,7 +414,7 @@ bool nouveau_acpi_rom_supported(struct pci_dev *pdev) ...@@ -414,7 +414,7 @@ bool nouveau_acpi_rom_supported(struct pci_dev *pdev)
if (!nouveau_dsm_priv.dsm_detected && !nouveau_dsm_priv.optimus_detected) if (!nouveau_dsm_priv.dsm_detected && !nouveau_dsm_priv.optimus_detected)
return false; return false;
dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); dhandle = ACPI_HANDLE(&pdev->dev);
if (!dhandle) if (!dhandle)
return false; return false;
...@@ -448,7 +448,7 @@ nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) ...@@ -448,7 +448,7 @@ nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector)
return NULL; return NULL;
} }
handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev); handle = ACPI_HANDLE(&dev->pdev->dev);
if (!handle) if (!handle)
return NULL; return NULL;
......
...@@ -369,7 +369,7 @@ int radeon_atif_handler(struct radeon_device *rdev, ...@@ -369,7 +369,7 @@ int radeon_atif_handler(struct radeon_device *rdev,
return NOTIFY_DONE; return NOTIFY_DONE;
/* Check pending SBIOS requests */ /* Check pending SBIOS requests */
handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); handle = ACPI_HANDLE(&rdev->pdev->dev);
count = radeon_atif_get_sbios_requests(handle, &req); count = radeon_atif_get_sbios_requests(handle, &req);
if (count <= 0) if (count <= 0)
...@@ -556,7 +556,7 @@ int radeon_acpi_pcie_notify_device_ready(struct radeon_device *rdev) ...@@ -556,7 +556,7 @@ int radeon_acpi_pcie_notify_device_ready(struct radeon_device *rdev)
struct radeon_atcs *atcs = &rdev->atcs; struct radeon_atcs *atcs = &rdev->atcs;
/* Get the device handle */ /* Get the device handle */
handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); handle = ACPI_HANDLE(&rdev->pdev->dev);
if (!handle) if (!handle)
return -EINVAL; return -EINVAL;
...@@ -596,7 +596,7 @@ int radeon_acpi_pcie_performance_request(struct radeon_device *rdev, ...@@ -596,7 +596,7 @@ int radeon_acpi_pcie_performance_request(struct radeon_device *rdev,
u32 retry = 3; u32 retry = 3;
/* Get the device handle */ /* Get the device handle */
handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); handle = ACPI_HANDLE(&rdev->pdev->dev);
if (!handle) if (!handle)
return -EINVAL; return -EINVAL;
...@@ -699,7 +699,7 @@ int radeon_acpi_init(struct radeon_device *rdev) ...@@ -699,7 +699,7 @@ int radeon_acpi_init(struct radeon_device *rdev)
int ret; int ret;
/* Get the device handle */ /* Get the device handle */
handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); handle = ACPI_HANDLE(&rdev->pdev->dev);
/* No need to proceed if we're sure that ATIF is not supported */ /* No need to proceed if we're sure that ATIF is not supported */
if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle) if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle)
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
*/ */
#include <linux/vga_switcheroo.h> #include <linux/vga_switcheroo.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <acpi/acpi.h> #include <linux/acpi.h>
#include <acpi/acpi_bus.h>
#include <linux/pci.h> #include <linux/pci.h>
#include "radeon_acpi.h" #include "radeon_acpi.h"
...@@ -447,7 +446,7 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) ...@@ -447,7 +446,7 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
acpi_handle dhandle, atpx_handle; acpi_handle dhandle, atpx_handle;
acpi_status status; acpi_status status;
dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); dhandle = ACPI_HANDLE(&pdev->dev);
if (!dhandle) if (!dhandle)
return false; return false;
...@@ -493,7 +492,7 @@ static int radeon_atpx_init(void) ...@@ -493,7 +492,7 @@ static int radeon_atpx_init(void)
*/ */
static int radeon_atpx_get_client_id(struct pci_dev *pdev) static int radeon_atpx_get_client_id(struct pci_dev *pdev)
{ {
if (radeon_atpx_priv.dhandle == DEVICE_ACPI_HANDLE(&pdev->dev)) if (radeon_atpx_priv.dhandle == ACPI_HANDLE(&pdev->dev))
return VGA_SWITCHEROO_IGD; return VGA_SWITCHEROO_IGD;
else else
return VGA_SWITCHEROO_DIS; return VGA_SWITCHEROO_DIS;
......
...@@ -185,7 +185,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev) ...@@ -185,7 +185,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
return false; return false;
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); dhandle = ACPI_HANDLE(&pdev->dev);
if (!dhandle) if (!dhandle)
continue; continue;
......
...@@ -1008,7 +1008,7 @@ static int i2c_hid_probe(struct i2c_client *client, ...@@ -1008,7 +1008,7 @@ static int i2c_hid_probe(struct i2c_client *client,
hid->hid_get_raw_report = i2c_hid_get_raw_report; hid->hid_get_raw_report = i2c_hid_get_raw_report;
hid->hid_output_raw_report = i2c_hid_output_raw_report; hid->hid_output_raw_report = i2c_hid_output_raw_report;
hid->dev.parent = &client->dev; hid->dev.parent = &client->dev;
ACPI_HANDLE_SET(&hid->dev, ACPI_HANDLE(&client->dev)); ACPI_COMPANION_SET(&hid->dev, ACPI_COMPANION(&client->dev));
hid->bus = BUS_I2C; hid->bus = BUS_I2C;
hid->version = le16_to_cpu(ihid->hdesc.bcdVersion); hid->version = le16_to_cpu(ihid->hdesc.bcdVersion);
hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID); hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID);
......
...@@ -615,6 +615,22 @@ void i2c_unlock_adapter(struct i2c_adapter *adapter) ...@@ -615,6 +615,22 @@ void i2c_unlock_adapter(struct i2c_adapter *adapter)
} }
EXPORT_SYMBOL_GPL(i2c_unlock_adapter); EXPORT_SYMBOL_GPL(i2c_unlock_adapter);
static void i2c_dev_set_name(struct i2c_adapter *adap,
struct i2c_client *client)
{
struct acpi_device *adev = ACPI_COMPANION(&client->dev);
if (adev) {
dev_set_name(&client->dev, "i2c-%s", acpi_dev_name(adev));
return;
}
/* For 10-bit clients, add an arbitrary offset to avoid collisions */
dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap),
client->addr | ((client->flags & I2C_CLIENT_TEN)
? 0xa000 : 0));
}
/** /**
* i2c_new_device - instantiate an i2c device * i2c_new_device - instantiate an i2c device
* @adap: the adapter managing the device * @adap: the adapter managing the device
...@@ -671,12 +687,9 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) ...@@ -671,12 +687,9 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
client->dev.bus = &i2c_bus_type; client->dev.bus = &i2c_bus_type;
client->dev.type = &i2c_client_type; client->dev.type = &i2c_client_type;
client->dev.of_node = info->of_node; client->dev.of_node = info->of_node;
ACPI_HANDLE_SET(&client->dev, info->acpi_node.handle); ACPI_COMPANION_SET(&client->dev, info->acpi_node.companion);
/* For 10-bit clients, add an arbitrary offset to avoid collisions */ i2c_dev_set_name(adap, client);
dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap),
client->addr | ((client->flags & I2C_CLIENT_TEN)
? 0xa000 : 0));
status = device_register(&client->dev); status = device_register(&client->dev);
if (status) if (status)
goto out_err; goto out_err;
...@@ -1100,7 +1113,7 @@ static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level, ...@@ -1100,7 +1113,7 @@ static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level,
return AE_OK; return AE_OK;
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
info.acpi_node.handle = handle; info.acpi_node.companion = adev;
info.irq = -1; info.irq = -1;
INIT_LIST_HEAD(&resource_list); INIT_LIST_HEAD(&resource_list);
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* Copyright (C) 2006 Hannes Reinecke * Copyright (C) 2006 Hannes Reinecke
*/ */
#include <linux/acpi.h>
#include <linux/ata.h> #include <linux/ata.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h> #include <linux/device.h>
...@@ -19,8 +20,6 @@ ...@@ -19,8 +20,6 @@
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/module.h> #include <linux/module.h>
#include <acpi/acpi_bus.h>
#define REGS_PER_GTF 7 #define REGS_PER_GTF 7
struct GTM_buffer { struct GTM_buffer {
...@@ -128,7 +127,7 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, ...@@ -128,7 +127,7 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle,
DEBPRINT("ENTER: pci %02x:%02x.%01x\n", bus, devnum, func); DEBPRINT("ENTER: pci %02x:%02x.%01x\n", bus, devnum, func);
dev_handle = DEVICE_ACPI_HANDLE(dev); dev_handle = ACPI_HANDLE(dev);
if (!dev_handle) { if (!dev_handle) {
DEBPRINT("no acpi handle for device\n"); DEBPRINT("no acpi handle for device\n");
goto err; goto err;
......
/* /*
* intel_idle.c - native hardware idle loop for modern Intel processors * intel_idle.c - native hardware idle loop for modern Intel processors
* *
* Copyright (c) 2010, Intel Corporation. * Copyright (c) 2013, Intel Corporation.
* Len Brown <len.brown@intel.com> * Len Brown <len.brown@intel.com>
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
...@@ -329,6 +329,22 @@ static struct cpuidle_state atom_cstates[] __initdata = { ...@@ -329,6 +329,22 @@ static struct cpuidle_state atom_cstates[] __initdata = {
{ {
.enter = NULL } .enter = NULL }
}; };
static struct cpuidle_state avn_cstates[CPUIDLE_STATE_MAX] = {
{
.name = "C1-AVN",
.desc = "MWAIT 0x00",
.flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID,
.exit_latency = 2,
.target_residency = 2,
.enter = &intel_idle },
{
.name = "C6-AVN",
.desc = "MWAIT 0x51",
.flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
.exit_latency = 15,
.target_residency = 45,
.enter = &intel_idle },
};
/** /**
* intel_idle * intel_idle
...@@ -462,6 +478,11 @@ static const struct idle_cpu idle_cpu_hsw = { ...@@ -462,6 +478,11 @@ static const struct idle_cpu idle_cpu_hsw = {
.disable_promotion_to_c1e = true, .disable_promotion_to_c1e = true,
}; };
static const struct idle_cpu idle_cpu_avn = {
.state_table = avn_cstates,
.disable_promotion_to_c1e = true,
};
#define ICPU(model, cpu) \ #define ICPU(model, cpu) \
{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (unsigned long)&cpu } { X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (unsigned long)&cpu }
...@@ -483,6 +504,7 @@ static const struct x86_cpu_id intel_idle_ids[] = { ...@@ -483,6 +504,7 @@ static const struct x86_cpu_id intel_idle_ids[] = {
ICPU(0x3f, idle_cpu_hsw), ICPU(0x3f, idle_cpu_hsw),
ICPU(0x45, idle_cpu_hsw), ICPU(0x45, idle_cpu_hsw),
ICPU(0x46, idle_cpu_hsw), ICPU(0x46, idle_cpu_hsw),
ICPU(0x4D, idle_cpu_avn),
{} {}
}; };
MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids); MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids);
......
...@@ -308,8 +308,7 @@ static void sdio_acpi_set_handle(struct sdio_func *func) ...@@ -308,8 +308,7 @@ static void sdio_acpi_set_handle(struct sdio_func *func)
struct mmc_host *host = func->card->host; struct mmc_host *host = func->card->host;
u64 addr = (host->slotno << 16) | func->num; u64 addr = (host->slotno << 16) | func->num;
ACPI_HANDLE_SET(&func->dev, acpi_preset_companion(&func->dev, ACPI_HANDLE(host->parent), addr);
acpi_get_child(ACPI_HANDLE(host->parent), addr));
} }
#else #else
static inline void sdio_acpi_set_handle(struct sdio_func *func) {} static inline void sdio_acpi_set_handle(struct sdio_func *func) {}
......
...@@ -367,7 +367,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags) ...@@ -367,7 +367,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags)
string = (struct acpi_buffer){ ACPI_ALLOCATE_BUFFER, NULL }; string = (struct acpi_buffer){ ACPI_ALLOCATE_BUFFER, NULL };
} }
handle = DEVICE_ACPI_HANDLE(&pdev->dev); handle = ACPI_HANDLE(&pdev->dev);
if (!handle) { if (!handle) {
/* /*
* This hotplug controller was not listed in the ACPI name * This hotplug controller was not listed in the ACPI name
......
...@@ -176,7 +176,6 @@ u8 acpiphp_get_latch_status(struct acpiphp_slot *slot); ...@@ -176,7 +176,6 @@ u8 acpiphp_get_latch_status(struct acpiphp_slot *slot);
u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot); u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot);
/* variables */ /* variables */
extern bool acpiphp_debug;
extern bool acpiphp_disabled; extern bool acpiphp_disabled;
#endif /* _ACPIPHP_H */ #endif /* _ACPIPHP_H */
...@@ -54,7 +54,7 @@ int pciehp_acpi_slot_detection_check(struct pci_dev *dev) ...@@ -54,7 +54,7 @@ int pciehp_acpi_slot_detection_check(struct pci_dev *dev)
{ {
if (slot_detection_mode != PCIEHP_DETECT_ACPI) if (slot_detection_mode != PCIEHP_DETECT_ACPI)
return 0; return 0;
if (acpi_pci_detect_ejectable(DEVICE_ACPI_HANDLE(&dev->dev))) if (acpi_pci_detect_ejectable(ACPI_HANDLE(&dev->dev)))
return 0; return 0;
return -ENODEV; return -ENODEV;
} }
...@@ -96,7 +96,7 @@ static int __init dummy_probe(struct pcie_device *dev) ...@@ -96,7 +96,7 @@ static int __init dummy_probe(struct pcie_device *dev)
dup_slot_id++; dup_slot_id++;
} }
list_add_tail(&slot->list, &dummy_slots); list_add_tail(&slot->list, &dummy_slots);
handle = DEVICE_ACPI_HANDLE(&pdev->dev); handle = ACPI_HANDLE(&pdev->dev);
if (!acpi_slot_detected && acpi_pci_detect_ejectable(handle)) if (!acpi_slot_detected && acpi_pci_detect_ejectable(handle))
acpi_slot_detected = 1; acpi_slot_detected = 1;
return -ENODEV; /* dummy driver always returns error */ return -ENODEV; /* dummy driver always returns error */
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* Work to add BIOS PROM support was completed by Mike Habeck. * Work to add BIOS PROM support was completed by Mike Habeck.
*/ */
#include <linux/acpi.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -29,7 +30,6 @@ ...@@ -29,7 +30,6 @@
#include <asm/sn/sn_feature_sets.h> #include <asm/sn/sn_feature_sets.h>
#include <asm/sn/sn_sal.h> #include <asm/sn/sn_sal.h>
#include <asm/sn/types.h> #include <asm/sn/types.h>
#include <linux/acpi.h>
#include <asm/sn/acpi.h> #include <asm/sn/acpi.h>
#include "../pci.h" #include "../pci.h"
...@@ -414,7 +414,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) ...@@ -414,7 +414,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
acpi_handle rethandle; acpi_handle rethandle;
acpi_status ret; acpi_status ret;
phandle = PCI_CONTROLLER(slot->pci_bus)->acpi_handle; phandle = acpi_device_handle(PCI_CONTROLLER(slot->pci_bus)->companion);
if (acpi_bus_get_device(phandle, &pdevice)) { if (acpi_bus_get_device(phandle, &pdevice)) {
dev_dbg(&slot->pci_bus->self->dev, dev_dbg(&slot->pci_bus->self->dev,
...@@ -495,7 +495,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot) ...@@ -495,7 +495,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
/* free the ACPI resources for the slot */ /* free the ACPI resources for the slot */
if (SN_ACPI_BASE_SUPPORT() && if (SN_ACPI_BASE_SUPPORT() &&
PCI_CONTROLLER(slot->pci_bus)->acpi_handle) { PCI_CONTROLLER(slot->pci_bus)->companion) {
unsigned long long adr; unsigned long long adr;
struct acpi_device *device; struct acpi_device *device;
acpi_handle phandle; acpi_handle phandle;
...@@ -504,7 +504,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot) ...@@ -504,7 +504,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
acpi_status ret; acpi_status ret;
/* Get the rootbus node pointer */ /* Get the rootbus node pointer */
phandle = PCI_CONTROLLER(slot->pci_bus)->acpi_handle; phandle = acpi_device_handle(PCI_CONTROLLER(slot->pci_bus)->companion);
acpi_scan_lock_acquire(); acpi_scan_lock_acquire();
/* /*
......
...@@ -37,7 +37,7 @@ static int ioapic_probe(struct pci_dev *dev, const struct pci_device_id *ent) ...@@ -37,7 +37,7 @@ static int ioapic_probe(struct pci_dev *dev, const struct pci_device_id *ent)
char *type; char *type;
struct resource *res; struct resource *res;
handle = DEVICE_ACPI_HANDLE(&dev->dev); handle = ACPI_HANDLE(&dev->dev);
if (!handle) if (!handle)
return -EINVAL; return -EINVAL;
......
...@@ -173,14 +173,14 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev) ...@@ -173,14 +173,14 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev)
static bool acpi_pci_power_manageable(struct pci_dev *dev) static bool acpi_pci_power_manageable(struct pci_dev *dev)
{ {
acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); acpi_handle handle = ACPI_HANDLE(&dev->dev);
return handle ? acpi_bus_power_manageable(handle) : false; return handle ? acpi_bus_power_manageable(handle) : false;
} }
static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
{ {
acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); acpi_handle handle = ACPI_HANDLE(&dev->dev);
static const u8 state_conv[] = { static const u8 state_conv[] = {
[PCI_D0] = ACPI_STATE_D0, [PCI_D0] = ACPI_STATE_D0,
[PCI_D1] = ACPI_STATE_D1, [PCI_D1] = ACPI_STATE_D1,
...@@ -217,7 +217,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) ...@@ -217,7 +217,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
static bool acpi_pci_can_wakeup(struct pci_dev *dev) static bool acpi_pci_can_wakeup(struct pci_dev *dev)
{ {
acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); acpi_handle handle = ACPI_HANDLE(&dev->dev);
return handle ? acpi_bus_can_wakeup(handle) : false; return handle ? acpi_bus_can_wakeup(handle) : false;
} }
......
...@@ -263,7 +263,7 @@ device_has_dsm(struct device *dev) ...@@ -263,7 +263,7 @@ device_has_dsm(struct device *dev)
acpi_handle handle; acpi_handle handle;
struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
handle = DEVICE_ACPI_HANDLE(dev); handle = ACPI_HANDLE(dev);
if (!handle) if (!handle)
return FALSE; return FALSE;
...@@ -295,7 +295,7 @@ acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf) ...@@ -295,7 +295,7 @@ acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf)
acpi_handle handle; acpi_handle handle;
int length; int length;
handle = DEVICE_ACPI_HANDLE(dev); handle = ACPI_HANDLE(dev);
if (!handle) if (!handle)
return -1; return -1;
...@@ -316,7 +316,7 @@ acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf) ...@@ -316,7 +316,7 @@ acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf)
acpi_handle handle; acpi_handle handle;
int length; int length;
handle = DEVICE_ACPI_HANDLE(dev); handle = ACPI_HANDLE(dev);
if (!handle) if (!handle)
return -1; return -1;
......
...@@ -519,7 +519,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) ...@@ -519,7 +519,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
gmux_data->power_state = VGA_SWITCHEROO_ON; gmux_data->power_state = VGA_SWITCHEROO_ON;
gmux_data->dhandle = DEVICE_ACPI_HANDLE(&pnp->dev); gmux_data->dhandle = ACPI_HANDLE(&pnp->dev);
if (!gmux_data->dhandle) { if (!gmux_data->dhandle) {
pr_err("Cannot find acpi handle for pnp device %s\n", pr_err("Cannot find acpi handle for pnp device %s\n",
dev_name(&pnp->dev)); dev_name(&pnp->dev));
......
...@@ -89,7 +89,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) ...@@ -89,7 +89,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev)
pnp_dbg(&dev->dev, "set resources\n"); pnp_dbg(&dev->dev, "set resources\n");
handle = DEVICE_ACPI_HANDLE(&dev->dev); handle = ACPI_HANDLE(&dev->dev);
if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { if (!handle || acpi_bus_get_device(handle, &acpi_dev)) {
dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
return -ENODEV; return -ENODEV;
...@@ -122,7 +122,7 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) ...@@ -122,7 +122,7 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
dev_dbg(&dev->dev, "disable resources\n"); dev_dbg(&dev->dev, "disable resources\n");
handle = DEVICE_ACPI_HANDLE(&dev->dev); handle = ACPI_HANDLE(&dev->dev);
if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { if (!handle || acpi_bus_get_device(handle, &acpi_dev)) {
dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
return 0; return 0;
...@@ -144,7 +144,7 @@ static bool pnpacpi_can_wakeup(struct pnp_dev *dev) ...@@ -144,7 +144,7 @@ static bool pnpacpi_can_wakeup(struct pnp_dev *dev)
struct acpi_device *acpi_dev; struct acpi_device *acpi_dev;
acpi_handle handle; acpi_handle handle;
handle = DEVICE_ACPI_HANDLE(&dev->dev); handle = ACPI_HANDLE(&dev->dev);
if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { if (!handle || acpi_bus_get_device(handle, &acpi_dev)) {
dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
return false; return false;
...@@ -159,7 +159,7 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) ...@@ -159,7 +159,7 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
acpi_handle handle; acpi_handle handle;
int error = 0; int error = 0;
handle = DEVICE_ACPI_HANDLE(&dev->dev); handle = ACPI_HANDLE(&dev->dev);
if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { if (!handle || acpi_bus_get_device(handle, &acpi_dev)) {
dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
return 0; return 0;
...@@ -194,7 +194,7 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) ...@@ -194,7 +194,7 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
static int pnpacpi_resume(struct pnp_dev *dev) static int pnpacpi_resume(struct pnp_dev *dev)
{ {
struct acpi_device *acpi_dev; struct acpi_device *acpi_dev;
acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); acpi_handle handle = ACPI_HANDLE(&dev->dev);
int error = 0; int error = 0;
if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { if (!handle || acpi_bus_get_device(handle, &acpi_dev)) {
......
...@@ -357,6 +357,19 @@ struct spi_device *spi_alloc_device(struct spi_master *master) ...@@ -357,6 +357,19 @@ struct spi_device *spi_alloc_device(struct spi_master *master)
} }
EXPORT_SYMBOL_GPL(spi_alloc_device); EXPORT_SYMBOL_GPL(spi_alloc_device);
static void spi_dev_set_name(struct spi_device *spi)
{
struct acpi_device *adev = ACPI_COMPANION(&spi->dev);
if (adev) {
dev_set_name(&spi->dev, "spi-%s", acpi_dev_name(adev));
return;
}
dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->master->dev),
spi->chip_select);
}
/** /**
* spi_add_device - Add spi_device allocated with spi_alloc_device * spi_add_device - Add spi_device allocated with spi_alloc_device
* @spi: spi_device to register * @spi: spi_device to register
...@@ -383,9 +396,7 @@ int spi_add_device(struct spi_device *spi) ...@@ -383,9 +396,7 @@ int spi_add_device(struct spi_device *spi)
} }
/* Set the bus ID string */ /* Set the bus ID string */
dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->master->dev), spi_dev_set_name(spi);
spi->chip_select);
/* We need to make sure there's no other device with this /* We need to make sure there's no other device with this
* chipselect **BEFORE** we call setup(), else we'll trash * chipselect **BEFORE** we call setup(), else we'll trash
...@@ -1144,7 +1155,7 @@ static acpi_status acpi_spi_add_device(acpi_handle handle, u32 level, ...@@ -1144,7 +1155,7 @@ static acpi_status acpi_spi_add_device(acpi_handle handle, u32 level,
return AE_NO_MEMORY; return AE_NO_MEMORY;
} }
ACPI_HANDLE_SET(&spi->dev, handle); ACPI_COMPANION_SET(&spi->dev, adev);
spi->irq = -1; spi->irq = -1;
INIT_LIST_HEAD(&resource_list); INIT_LIST_HEAD(&resource_list);
......
...@@ -5501,6 +5501,6 @@ acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev, ...@@ -5501,6 +5501,6 @@ acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev,
if (!hub) if (!hub)
return NULL; return NULL;
return DEVICE_ACPI_HANDLE(&hub->ports[port1 - 1]->dev); return ACPI_HANDLE(&hub->ports[port1 - 1]->dev);
} }
#endif #endif
...@@ -173,7 +173,7 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle) ...@@ -173,7 +173,7 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
} }
/* root hub's parent is the usb hcd. */ /* root hub's parent is the usb hcd. */
parent_handle = DEVICE_ACPI_HANDLE(dev->parent); parent_handle = ACPI_HANDLE(dev->parent);
*handle = acpi_get_child(parent_handle, udev->portnum); *handle = acpi_get_child(parent_handle, udev->portnum);
if (!*handle) if (!*handle)
return -ENODEV; return -ENODEV;
...@@ -194,7 +194,7 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle) ...@@ -194,7 +194,7 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
raw_port_num = usb_hcd_find_raw_port_number(hcd, raw_port_num = usb_hcd_find_raw_port_number(hcd,
port_num); port_num);
*handle = acpi_get_child(DEVICE_ACPI_HANDLE(&udev->dev), *handle = acpi_get_child(ACPI_HANDLE(&udev->dev),
raw_port_num); raw_port_num);
if (!*handle) if (!*handle)
return -ENODEV; return -ENODEV;
......
...@@ -59,12 +59,12 @@ static int xen_add_device(struct device *dev) ...@@ -59,12 +59,12 @@ static int xen_add_device(struct device *dev)
add.flags = XEN_PCI_DEV_EXTFN; add.flags = XEN_PCI_DEV_EXTFN;
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
handle = DEVICE_ACPI_HANDLE(&pci_dev->dev); handle = ACPI_HANDLE(&pci_dev->dev);
if (!handle && pci_dev->bus->bridge) if (!handle && pci_dev->bus->bridge)
handle = DEVICE_ACPI_HANDLE(pci_dev->bus->bridge); handle = ACPI_HANDLE(pci_dev->bus->bridge);
#ifdef CONFIG_PCI_IOV #ifdef CONFIG_PCI_IOV
if (!handle && pci_dev->is_virtfn) if (!handle && pci_dev->is_virtfn)
handle = DEVICE_ACPI_HANDLE(physfn->bus->bridge); handle = ACPI_HANDLE(physfn->bus->bridge);
#endif #endif
if (handle) { if (handle) {
acpi_status status; acpi_status status;
......
...@@ -431,9 +431,9 @@ static inline acpi_handle acpi_get_child(acpi_handle handle, u64 addr) ...@@ -431,9 +431,9 @@ static inline acpi_handle acpi_get_child(acpi_handle handle, u64 addr)
{ {
return acpi_find_child(handle, addr, false); return acpi_find_child(handle, addr, false);
} }
void acpi_preset_companion(struct device *dev, acpi_handle parent, u64 addr);
int acpi_is_root_bridge(acpi_handle); int acpi_is_root_bridge(acpi_handle);
struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev))
int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
int acpi_disable_wakeup_device_power(struct acpi_device *dev); int acpi_disable_wakeup_device_power(struct acpi_device *dev);
......
...@@ -44,6 +44,20 @@ ...@@ -44,6 +44,20 @@
#include <acpi/acpi_numa.h> #include <acpi/acpi_numa.h>
#include <asm/acpi.h> #include <asm/acpi.h>
static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
{
return adev ? adev->handle : NULL;
}
#define ACPI_COMPANION(dev) ((dev)->acpi_node.companion)
#define ACPI_COMPANION_SET(dev, adev) ACPI_COMPANION(dev) = (adev)
#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
static inline const char *acpi_dev_name(struct acpi_device *adev)
{
return dev_name(&adev->dev);
}
enum acpi_irq_model_id { enum acpi_irq_model_id {
ACPI_IRQ_MODEL_PIC = 0, ACPI_IRQ_MODEL_PIC = 0,
ACPI_IRQ_MODEL_IOAPIC, ACPI_IRQ_MODEL_IOAPIC,
...@@ -401,6 +415,15 @@ static inline bool acpi_driver_match_device(struct device *dev, ...@@ -401,6 +415,15 @@ static inline bool acpi_driver_match_device(struct device *dev,
#define acpi_disabled 1 #define acpi_disabled 1
#define ACPI_COMPANION(dev) (NULL)
#define ACPI_COMPANION_SET(dev, adev) do { } while (0)
#define ACPI_HANDLE(dev) (NULL)
static inline const char *acpi_dev_name(struct acpi_device *adev)
{
return NULL;
}
static inline void acpi_early_init(void) { } static inline void acpi_early_init(void) { }
static inline int early_acpi_boot_init(void) static inline int early_acpi_boot_init(void)
......
...@@ -644,9 +644,11 @@ struct device_dma_parameters { ...@@ -644,9 +644,11 @@ struct device_dma_parameters {
unsigned long segment_boundary_mask; unsigned long segment_boundary_mask;
}; };
struct acpi_device;
struct acpi_dev_node { struct acpi_dev_node {
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
void *handle; struct acpi_device *companion;
#endif #endif
}; };
...@@ -790,14 +792,6 @@ static inline struct device *kobj_to_dev(struct kobject *kobj) ...@@ -790,14 +792,6 @@ static inline struct device *kobj_to_dev(struct kobject *kobj)
return container_of(kobj, struct device, kobj); return container_of(kobj, struct device, kobj);
} }
#ifdef CONFIG_ACPI
#define ACPI_HANDLE(dev) ((dev)->acpi_node.handle)
#define ACPI_HANDLE_SET(dev, _handle_) (dev)->acpi_node.handle = (_handle_)
#else
#define ACPI_HANDLE(dev) (NULL)
#define ACPI_HANDLE_SET(dev, _handle_) do { } while (0)
#endif
/* Get the wakeup routines, which depend on struct device */ /* Get the wakeup routines, which depend on struct device */
#include <linux/pm_wakeup.h> #include <linux/pm_wakeup.h>
......
...@@ -27,7 +27,7 @@ static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) ...@@ -27,7 +27,7 @@ static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
while (!pci_is_root_bus(pbus)) while (!pci_is_root_bus(pbus))
pbus = pbus->parent; pbus = pbus->parent;
return DEVICE_ACPI_HANDLE(pbus->bridge); return ACPI_HANDLE(pbus->bridge);
} }
static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
...@@ -39,7 +39,7 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) ...@@ -39,7 +39,7 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
else else
dev = &pbus->self->dev; dev = &pbus->self->dev;
return DEVICE_ACPI_HANDLE(dev); return ACPI_HANDLE(dev);
} }
void acpi_pci_add_bus(struct pci_bus *bus); void acpi_pci_add_bus(struct pci_bus *bus);
......
...@@ -792,7 +792,8 @@ void free_basic_memory_bitmaps(void) ...@@ -792,7 +792,8 @@ void free_basic_memory_bitmaps(void)
{ {
struct memory_bitmap *bm1, *bm2; struct memory_bitmap *bm1, *bm2;
BUG_ON(!(forbidden_pages_map && free_pages_map)); if (WARN_ON(!(forbidden_pages_map && free_pages_map)))
return;
bm1 = forbidden_pages_map; bm1 = forbidden_pages_map;
bm2 = free_pages_map; bm2 = free_pages_map;
......
...@@ -70,6 +70,7 @@ static int snapshot_open(struct inode *inode, struct file *filp) ...@@ -70,6 +70,7 @@ static int snapshot_open(struct inode *inode, struct file *filp)
data->swap = swsusp_resume_device ? data->swap = swsusp_resume_device ?
swap_type_of(swsusp_resume_device, 0, NULL) : -1; swap_type_of(swsusp_resume_device, 0, NULL) : -1;
data->mode = O_RDONLY; data->mode = O_RDONLY;
data->free_bitmaps = false;
error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
if (error) if (error)
pm_notifier_call_chain(PM_POST_HIBERNATION); pm_notifier_call_chain(PM_POST_HIBERNATION);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment