From patchwork Wed Dec 13 07:20:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10109407 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EFBCA602C2 for ; Wed, 13 Dec 2017 07:22:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7BA228EBC for ; Wed, 13 Dec 2017 07:22:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC81A28EC1; Wed, 13 Dec 2017 07:22:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 707A328EA2 for ; Wed, 13 Dec 2017 07:22:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=/PNF+zCtdSCSV1Vc8UENtHJkn6qeCItNuklG+eRN7qg=; b=hx2v96ZvooH4VNGDi8myF/hqSY Ss/VMn2yNrv0clQjK30ErdR8BxguQkR1ii3E+eTwFUdXYSpji+q1iw7K6sZsoZloCDdn0x/pwR4FM vM6sn6ftKRs1D3GnVEPY8v2JUKpgkrpGsMpB8FNoK8GxIE256SqNdTbGQ3bvc+Y9WamlrA3PxhcSa PglruCMQHgx3HHY5/aoqTAAN+0b8aJWXWVZ6F5myD+IVvuXtVoWFRovULR3U0KRhyul5reu1iVaj6 +hKtkhSAlRne+cgKGFN9up1ta1nLIPcCyG5iSbcOzTpl0IoVNZXg1Kw3MSJoc1T9VFqY24wDYXH7g rSTUQJwA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eP1Me-0004HM-Fy; Wed, 13 Dec 2017 07:22:00 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eP1M1-0003fg-7o for linux-arm-kernel@lists.infradead.org; Wed, 13 Dec 2017 07:21:24 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 00D6660A17; Wed, 13 Dec 2017 07:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1513149663; bh=7oM5IM21ORg/A2959XN8sfxJrnW4zr8+1zLbE+r5HE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JlhcFYXojaP8kKL+CM1Cnz9iD5MFPuatuavvFrjzWfuwipwqNPTTpH5jWHWbS5v0m 5dOeTEUXdC0rrAz1IQsyu1Zz2dO64oWzoX1Av6EOqsojlxN/oty1XNV11+FrmNxqZK SGFpEQn0ElRv7U8F8BtX/Muq5k9a1XPkTSKXp5WU= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4881A609D1; Wed, 13 Dec 2017 07:21:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1513149662; bh=7oM5IM21ORg/A2959XN8sfxJrnW4zr8+1zLbE+r5HE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g+JTX+MkjqmjGlW2TdY2m9YdY3a6fS1scH+HJ8LS7sUDn829ZcNc/EMZK0zFJdv3q +HklUgwyrF41sBILoMAe1QGaTUte8UlSJ5KVfkhCnvU+E3OKtHvbx77NZ2+OcaWtF/ Qxg5WcQh5wcBv/Z2TpSxWvRkk88NSKjAvuTwOt+g= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4881A609D1 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: dmaengine@vger.kernel.org, timur@codeaurora.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, sakari.ailus@linux.intel.com Subject: [PATCH V8 2/7] ACPI / bus: Introduce acpi_get_match_data() function Date: Wed, 13 Dec 2017 02:20:48 -0500 Message-Id: <1513149653-19451-3-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1513149653-19451-1-git-send-email-okaya@codeaurora.org> References: <1513149653-19451-1-git-send-email-okaya@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171212_232121_874347_25156DF8 X-CRM114-Status: UNSURE ( 9.22 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, "Rafael J. Wysocki" , open list , Sinan Kaya , linux-arm-kernel@lists.infradead.org, Len Brown MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP OF has of_device_get_match_data() function to extract driver specific data structure. Add a similar function for ACPI. Signed-off-by: Sinan Kaya Acked-by: Rafael J. Wysocki --- drivers/acpi/bus.c | 18 ++++++++++++++++++ include/linux/acpi.h | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 4d0979e..f87ed3b 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -785,6 +785,24 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, } EXPORT_SYMBOL_GPL(acpi_match_device); +void *acpi_get_match_data(const struct device *dev) +{ + const struct acpi_device_id *match; + + if (!dev->driver) + return NULL; + + if (!dev->driver->acpi_match_table) + return NULL; + + match = acpi_match_device(dev->driver->acpi_match_table, dev); + if (!match) + return NULL; + + return (void *)match->driver_data; +} +EXPORT_SYMBOL_GPL(acpi_get_match_data); + int acpi_match_device_ids(struct acpi_device *device, const struct acpi_device_id *ids) { diff --git a/include/linux/acpi.h b/include/linux/acpi.h index dc1ebfe..9278737 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -584,6 +584,7 @@ extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, const struct device *dev); +void *acpi_get_match_data(const struct device *dev); extern bool acpi_driver_match_device(struct device *dev, const struct device_driver *drv); int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); @@ -755,6 +756,11 @@ static inline const struct acpi_device_id *acpi_match_device( return NULL; } +static inline void *acpi_get_match_data(const struct device *dev) +{ + return NULL; +} + static inline bool acpi_driver_match_device(struct device *dev, const struct device_driver *drv) {