Skip to content

Commit

Permalink
ACPI: Eliminate the DEVICE_ACPI_HANDLE() macro
Browse files Browse the repository at this point in the history
Since DEVICE_ACPI_HANDLE() is now literally identical to
ACPI_HANDLE(), replace it with the latter everywhere and drop its
definition from include/acpi.h.

Signed-off-by: Rafael J. Wysocki <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
rafaeljw committed Nov 14, 2013
1 parent 7b19981 commit 3a83f99
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 44 deletions.
8 changes: 4 additions & 4 deletions drivers/acpi/device_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,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)
{
acpi_handle handle = DEVICE_ACPI_HANDLE(dev);
acpi_handle handle = ACPI_HANDLE(dev);
struct acpi_device *adev;
int ret, d_min, d_max;

Expand Down Expand Up @@ -652,7 +652,7 @@ int acpi_pm_device_run_wake(struct device *phys_dev, bool enable)
if (!device_run_wake(phys_dev))
return -EINVAL;

handle = DEVICE_ACPI_HANDLE(phys_dev);
handle = ACPI_HANDLE(phys_dev);
if (!handle || acpi_bus_get_device(handle, &adev)) {
dev_dbg(phys_dev, "ACPI handle without context in %s!\n",
__func__);
Expand Down Expand Up @@ -696,7 +696,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
if (!device_can_wakeup(dev))
return -EINVAL;

handle = DEVICE_ACPI_HANDLE(dev);
handle = ACPI_HANDLE(dev);
if (!handle || acpi_bus_get_device(handle, &adev)) {
dev_dbg(dev, "ACPI handle without context in %s!\n", __func__);
return -ENODEV;
Expand All @@ -718,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)
{
acpi_handle handle = DEVICE_ACPI_HANDLE(dev);
acpi_handle handle = ACPI_HANDLE(dev);
struct acpi_device *adev;

return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/intel_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ static bool intel_dsm_pci_probe(struct pci_dev *pdev)
acpi_handle dhandle;
int ret;

dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);
dhandle = ACPI_HANDLE(&pdev->dev);
if (!dhandle)
return false;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/intel_opregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ static void intel_didl_outputs(struct drm_device *dev)
u32 temp;
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))
return;

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ mxm_shadow_dsm(struct nouveau_mxm *mxm, u8 version)
acpi_handle handle;
int ret;

handle = DEVICE_ACPI_HANDLE(&device->pdev->dev);
handle = ACPI_HANDLE(&device->pdev->dev);
if (!handle)
return false;

Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/nouveau/nouveau_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev)
acpi_handle dhandle;
int retval = 0;

dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);
dhandle = ACPI_HANDLE(&pdev->dev);
if (!dhandle)
return false;

Expand Down Expand Up @@ -404,7 +404,7 @@ bool nouveau_acpi_rom_supported(struct pci_dev *pdev)
if (!nouveau_dsm_priv.dsm_detected && !nouveau_dsm_priv.optimus_detected)
return false;

dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);
dhandle = ACPI_HANDLE(&pdev->dev);
if (!dhandle)
return false;

Expand Down Expand Up @@ -438,7 +438,7 @@ nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector)
return NULL;
}

handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev);
handle = ACPI_HANDLE(&dev->pdev->dev);
if (!handle)
return NULL;

Expand Down
8 changes: 4 additions & 4 deletions drivers/gpu/drm/radeon/radeon_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ int radeon_atif_handler(struct radeon_device *rdev,
return NOTIFY_DONE;

/* 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);

if (count <= 0)
Expand Down Expand Up @@ -556,7 +556,7 @@ int radeon_acpi_pcie_notify_device_ready(struct radeon_device *rdev)
struct radeon_atcs *atcs = &rdev->atcs;

/* Get the device handle */
handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev);
handle = ACPI_HANDLE(&rdev->pdev->dev);
if (!handle)
return -EINVAL;

Expand Down Expand Up @@ -596,7 +596,7 @@ int radeon_acpi_pcie_performance_request(struct radeon_device *rdev,
u32 retry = 3;

/* Get the device handle */
handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev);
handle = ACPI_HANDLE(&rdev->pdev->dev);
if (!handle)
return -EINVAL;

Expand Down Expand Up @@ -699,7 +699,7 @@ int radeon_acpi_init(struct radeon_device *rdev)
int ret;

/* 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 */
if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle)
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/radeon/radeon_atpx_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
acpi_handle dhandle, atpx_handle;
acpi_status status;

dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);
dhandle = ACPI_HANDLE(&pdev->dev);
if (!dhandle)
return false;

Expand Down Expand Up @@ -488,7 +488,7 @@ static int radeon_atpx_init(void)
*/
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;
else
return VGA_SWITCHEROO_DIS;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/radeon/radeon_bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
return false;

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)
continue;

Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/ide-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,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);

dev_handle = DEVICE_ACPI_HANDLE(dev);
dev_handle = ACPI_HANDLE(dev);
if (!dev_handle) {
DEBPRINT("no acpi handle for device\n");
goto err;
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/hotplug/acpi_pcihp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}

handle = DEVICE_ACPI_HANDLE(&pdev->dev);
handle = ACPI_HANDLE(&pdev->dev);
if (!handle) {
/*
* This hotplug controller was not listed in the ACPI name
Expand Down
4 changes: 2 additions & 2 deletions drivers/pci/hotplug/pciehp_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ int pciehp_acpi_slot_detection_check(struct pci_dev *dev)
{
if (slot_detection_mode != PCIEHP_DETECT_ACPI)
return 0;
if (acpi_pci_detect_ejectable(DEVICE_ACPI_HANDLE(&dev->dev)))
if (acpi_pci_detect_ejectable(ACPI_HANDLE(&dev->dev)))
return 0;
return -ENODEV;
}
Expand Down Expand Up @@ -96,7 +96,7 @@ static int __init dummy_probe(struct pcie_device *dev)
dup_slot_id++;
}
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))
acpi_slot_detected = 1;
return -ENODEV; /* dummy driver always returns error */
Expand Down
2 changes: 1 addition & 1 deletion drivers/pci/ioapic.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static int ioapic_probe(struct pci_dev *dev, const struct pci_device_id *ent)
char *type;
struct resource *res;

handle = DEVICE_ACPI_HANDLE(&dev->dev);
handle = ACPI_HANDLE(&dev->dev);
if (!handle)
return -EINVAL;

Expand Down
6 changes: 3 additions & 3 deletions drivers/pci/pci-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev);
acpi_handle handle = ACPI_HANDLE(&dev->dev);

return handle ? acpi_bus_power_manageable(handle) : false;
}

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[] = {
[PCI_D0] = ACPI_STATE_D0,
[PCI_D1] = ACPI_STATE_D1,
Expand Down Expand Up @@ -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)
{
acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev);
acpi_handle handle = ACPI_HANDLE(&dev->dev);

return handle ? acpi_bus_can_wakeup(handle) : false;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/pci/pci-label.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ device_has_dsm(struct device *dev)
acpi_handle handle;
struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};

handle = DEVICE_ACPI_HANDLE(dev);
handle = ACPI_HANDLE(dev);

if (!handle)
return FALSE;
Expand Down Expand Up @@ -295,7 +295,7 @@ acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf)
acpi_handle handle;
int length;

handle = DEVICE_ACPI_HANDLE(dev);
handle = ACPI_HANDLE(dev);

if (!handle)
return -1;
Expand All @@ -316,7 +316,7 @@ acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf)
acpi_handle handle;
int length;

handle = DEVICE_ACPI_HANDLE(dev);
handle = ACPI_HANDLE(dev);

if (!handle)
return -1;
Expand Down
2 changes: 1 addition & 1 deletion drivers/platform/x86/apple-gmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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->dhandle = DEVICE_ACPI_HANDLE(&pnp->dev);
gmux_data->dhandle = ACPI_HANDLE(&pnp->dev);
if (!gmux_data->dhandle) {
pr_err("Cannot find acpi handle for pnp device %s\n",
dev_name(&pnp->dev));
Expand Down
10 changes: 5 additions & 5 deletions drivers/pnp/pnpacpi/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev)

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)) {
dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
return -ENODEV;
Expand Down Expand Up @@ -122,7 +122,7 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)

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)) {
dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
return 0;
Expand All @@ -144,7 +144,7 @@ static bool pnpacpi_can_wakeup(struct pnp_dev *dev)
struct acpi_device *acpi_dev;
acpi_handle handle;

handle = DEVICE_ACPI_HANDLE(&dev->dev);
handle = ACPI_HANDLE(&dev->dev);
if (!handle || acpi_bus_get_device(handle, &acpi_dev)) {
dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
return false;
Expand All @@ -159,7 +159,7 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
acpi_handle handle;
int error = 0;

handle = DEVICE_ACPI_HANDLE(&dev->dev);
handle = ACPI_HANDLE(&dev->dev);
if (!handle || acpi_bus_get_device(handle, &acpi_dev)) {
dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
return 0;
Expand Down Expand Up @@ -194,7 +194,7 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
static int pnpacpi_resume(struct pnp_dev *dev)
{
struct acpi_device *acpi_dev;
acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev);
acpi_handle handle = ACPI_HANDLE(&dev->dev);
int error = 0;

if (!handle || acpi_bus_get_device(handle, &acpi_dev)) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -5501,6 +5501,6 @@ acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev,
if (!hub)
return NULL;

return DEVICE_ACPI_HANDLE(&hub->ports[port1 - 1]->dev);
return ACPI_HANDLE(&hub->ports[port1 - 1]->dev);
}
#endif
4 changes: 2 additions & 2 deletions drivers/usb/core/usb-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
}

/* 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);
if (!*handle)
return -ENODEV;
Expand All @@ -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,
port_num);
*handle = acpi_get_child(DEVICE_ACPI_HANDLE(&udev->dev),
*handle = acpi_get_child(ACPI_HANDLE(&udev->dev),
raw_port_num);
if (!*handle)
return -ENODEV;
Expand Down
6 changes: 3 additions & 3 deletions drivers/xen/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ static int xen_add_device(struct device *dev)
add.flags = XEN_PCI_DEV_EXTFN;

#ifdef CONFIG_ACPI
handle = DEVICE_ACPI_HANDLE(&pci_dev->dev);
handle = ACPI_HANDLE(&pci_dev->dev);
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
if (!handle && pci_dev->is_virtfn)
handle = DEVICE_ACPI_HANDLE(physfn->bus->bridge);
handle = ACPI_HANDLE(physfn->bus->bridge);
#endif
if (handle) {
acpi_status status;
Expand Down
2 changes: 0 additions & 2 deletions include/linux/acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,6 @@ static inline bool acpi_driver_match_device(struct device *dev,

#endif /* !CONFIG_ACPI */

#define DEVICE_ACPI_HANDLE(dev) ACPI_HANDLE(dev)

#ifdef CONFIG_ACPI
void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
u32 pm1a_ctrl, u32 pm1b_ctrl));
Expand Down
4 changes: 2 additions & 2 deletions include/linux/pci-acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
while (!pci_is_root_bus(pbus))
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)
Expand All @@ -39,7 +39,7 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
else
dev = &pbus->self->dev;

return DEVICE_ACPI_HANDLE(dev);
return ACPI_HANDLE(dev);
}

void acpi_pci_add_bus(struct pci_bus *bus);
Expand Down

0 comments on commit 3a83f99

Please sign in to comment.