Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp926137imm; Tue, 3 Jul 2018 02:25:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcEtgA5i5Y7xewT7MrTsBG9bHBjBvSqWV0+zKLsREfo++GKchK7WoOl6fc6qARxQZyw3XHo X-Received: by 2002:a62:5601:: with SMTP id k1-v6mr28940715pfb.212.1530609909697; Tue, 03 Jul 2018 02:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530609909; cv=none; d=google.com; s=arc-20160816; b=RR2LnqaqhbKtakP9MI0Ci5C+2znpSx+uDqIUua21+/8H09ZzeDh1QbDM4YoYmLObLv hYF8u9X71aMR1JLTF66T2U/sUYo/IDZAEgQ/rFI7UNzUf0eOEFLytgq4kZAc6HQvH30c qD6JuOAVjHJQLdOyrIB6UquFLcfxc2x1tm48BdkMoXCXWjxyBQYRNyBr3uRjyiUB3UTX zewTeQpQzBfK3/KOLl/fcIiOzvZXRYZlWRxh5XzWBWeilnajhE3ijlsD2j6M3o7eRuHz uNKMuPiEyOJzo9H3xp8kRpp4VjUNJK7tVIWbPuanYNYb5ty57HrJGXCj2A8T0bT3L2dd VRlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=6Iu7TZ1mb769VLJMGzyuXq8+1crxGus9llCmVOXsn3A=; b=u/RT2M2u000/DHRW1yvcoEIod8xsJ5HaQRhDfNHMamtQaWLuGDY48jOlJezxTxePGR xk3/nL3d8moBUWzhLTeBwLzWkP1ZGUut1uXRgmzKcuds/l3hIBu7Y9j23IwIYeBgW9Yw FrenlWG0S9qlzCvgO/QuQjExMfvUgICaO2i4S5JRc1Z1l+7DsNa0qcjU9JTwIwpu655k /+cvJzSAECutRPjje6+BZnSo5o/PiYZ9CgWu8+dcNqlopOJ15zDCqCDOHXdcfDU4q02q GZgwTPJHxgQU2jqB277JeeBzstWDSQm5aYsSV4I6NfbzxumtiWvqSq+Sd7VBEYDi/nfa Y6lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=UjIgmeJv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7-v6si674959pgr.31.2018.07.03.02.24.55; Tue, 03 Jul 2018 02:25:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=UjIgmeJv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933668AbeGCJXB (ORCPT + 99 others); Tue, 3 Jul 2018 05:23:01 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:45499 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932388AbeGCJW7 (ORCPT ); Tue, 3 Jul 2018 05:22:59 -0400 Received: by mail-qt0-f194.google.com with SMTP id y5-v6so924640qti.12 for ; Tue, 03 Jul 2018 02:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id; bh=6Iu7TZ1mb769VLJMGzyuXq8+1crxGus9llCmVOXsn3A=; b=UjIgmeJvug3McynvszMzkLeEq3SxImAeNxRVwU5yiDIBO96XWaeVRbtmpWeHoswxD8 9vIZlJziupUty474wG+woIF0psJjconMWRLN7AdWhhmiA8nh1X051CElMbfoMgT3C1lN qEJUxQANXmtCoTuLu8y/h28hjn7ohUK1QJ5FA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6Iu7TZ1mb769VLJMGzyuXq8+1crxGus9llCmVOXsn3A=; b=hBKvj7SBWVmQwwy17VBC0mySi3h/z6xrkXD2YeUWR1a7wp4kDcpg9rqUiU109mKN7+ c0GnTVoNx/grYHfosPCaRg+5X6o3PLuCfQkT+TPJmLwlYfuxkOQQehGEJrlEj1jBvF8l 7+6ocXiQf7GMEC6u8pbZ/Fi/X5rcnVkzYJxd73ZX+bqxZcXcZdWPS7V+ZAo+GLjutZZO dmG+ov1VTc00GaDXj/1AaWKFU1SqD7SW2lDUqm5/1d76ekljRr/z8727HP0MrO70Jpxr KH5jA1xL20BeOdIPrPauGgGXQp65kwdgNI+b9akrIREIJwvIeXW9dSEX5oEcenjucBkY d5rg== X-Gm-Message-State: APt69E0gorTDXRWcAnSzyDwp5fmgK8GV3YBrv+3lmakPw74N7tgsCpwO mlKmY527F0QDiFYzeMH43L7hbA== X-Received: by 2002:a0c:b40c:: with SMTP id u12-v6mr3632356qve.58.1530609778385; Tue, 03 Jul 2018 02:22:58 -0700 (PDT) Received: from mannams-OptiPlex-7010.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id k10-v6sm417856qtm.6.2018.07.03.02.22.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Jul 2018 02:22:57 -0700 (PDT) From: Srinath Mannam To: rafael@kernel.org, lenb@kernel.org, andy.shevchenko@gmail.com Cc: ray.jui@broadcom.com, vladimir.olovyannikov@broadcom.com, vikram.prakash@broadcom.com, scott.branden@broadcom.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Srinath Mannam Subject: [RFC PATCH] ACPI: bus: match of_device_id using acpi device Date: Tue, 3 Jul 2018 14:52:40 +0530 Message-Id: <1530609760-8919-1-git-send-email-srinath.mannam@broadcom.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch provides a function, to get of_device_id after matching with ACPI device _DSD object compatible property in the case driver does not contain acpi_device_id list and driver probe called for ACPI device ID PRP0001 with compatible property match with of_device_id compatible. Signed-off-by: Srinath Mannam --- drivers/acpi/bus.c | 23 +++++++++++++++++++++++ include/linux/acpi.h | 10 ++++++++++ 2 files changed, 33 insertions(+) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 84b4a62..e676bf7 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -830,6 +830,29 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, } EXPORT_SYMBOL_GPL(acpi_match_device); +/** + * acpi_match_of_device_id - Match a struct device in given of_device_id list + * @ids: Array of struct of_device_id object to match against. + * @dev: The device structure to match. + * + * Check if @dev has a valid ACPI handle and if there is a struct acpi_device + * object for that handle and use that object to match against a given list of + * device IDs. + * + * Return a pointer to the first matching ID on success or %NULL on failure. + */ +const +struct of_device_id *acpi_match_of_device_id(const struct of_device_id *ids, + const struct device *dev) +{ + const struct of_device_id *id = NULL; + + __acpi_match_device(acpi_companion_match(dev), NULL, ids, NULL, &id); + return id; +} +EXPORT_SYMBOL_GPL(acpi_match_of_device_id); + + const void *acpi_device_get_match_data(const struct device *dev) { const struct acpi_device_id *match; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 4b35a66..2f24800 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -589,6 +589,10 @@ 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); +const +struct of_device_id *acpi_match_of_device_id(const struct of_device_id *ids, + const struct device *dev); + const void *acpi_device_get_match_data(const struct device *dev); extern bool acpi_driver_match_device(struct device *dev, const struct device_driver *drv); @@ -775,6 +779,12 @@ static inline const struct acpi_device_id *acpi_match_device( return NULL; } +static inline const struct of_device_id *acpi_match_of_device_id( + const struct of_device_id *ids, const struct device *dev) +{ + return NULL; +} + static inline const void *acpi_device_get_match_data(const struct device *dev) { return NULL; -- 2.7.4