From patchwork Fri Sep 4 13:12:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 7122291 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9E1BF9F36E for ; Fri, 4 Sep 2015 13:12:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C792E2083C for ; Fri, 4 Sep 2015 13:12:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 44B3E2075A for ; Fri, 4 Sep 2015 13:12:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759531AbbIDNMj (ORCPT ); Fri, 4 Sep 2015 09:12:39 -0400 Received: from mga09.intel.com ([134.134.136.24]:17690 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759530AbbIDNMh (ORCPT ); Fri, 4 Sep 2015 09:12:37 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 04 Sep 2015 06:12:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,469,1437462000"; d="scan'208";a="797761800" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.156]) by orsmga002.jf.intel.com with ESMTP; 04 Sep 2015 06:12:35 -0700 From: Jarkko Nikula To: dmaengine@vger.kernel.org Cc: Dan Williams , Vinod Koul , linux-acpi@vger.kernel.org, Jarkko Nikula Subject: [PATCH] acpi-dma: Use ACPI_COMPANION() instead of acpi_bus_get_device() Date: Fri, 4 Sep 2015 16:12:30 +0300 Message-Id: <1441372350-11630-1-git-send-email-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.5.1 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Get pointer to the struct acpi_device by using ACPI_COMPANION() macro. This is more efficient than using ACPI_HANDLE() and acpi_bus_get_device(). Signed-off-by: Jarkko Nikula Acked-by: Rafael J. Wysocki --- drivers/dma/acpi-dma.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/dma/acpi-dma.c b/drivers/dma/acpi-dma.c index 5a635646e05c..04257432c482 100644 --- a/drivers/dma/acpi-dma.c +++ b/drivers/dma/acpi-dma.c @@ -160,10 +160,8 @@ int acpi_dma_controller_register(struct device *dev, return -EINVAL; /* Check if the device was enumerated by ACPI */ - if (!ACPI_HANDLE(dev)) - return -EINVAL; - - if (acpi_bus_get_device(ACPI_HANDLE(dev), &adev)) + adev = ACPI_COMPANION(dev); + if (!adev) return -EINVAL; adma = kzalloc(sizeof(*adma), GFP_KERNEL); @@ -358,10 +356,11 @@ struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev, int found; /* Check if the device was enumerated by ACPI */ - if (!dev || !ACPI_HANDLE(dev)) + if (!dev) return ERR_PTR(-ENODEV); - if (acpi_bus_get_device(ACPI_HANDLE(dev), &adev)) + adev = ACPI_COMPANION(dev); + if (!adev) return ERR_PTR(-ENODEV); memset(&pdata, 0, sizeof(pdata));