Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp635575imm; Wed, 4 Jul 2018 03:24:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpePSydqyIPze1G1Lb/vN2M42qx27DxGo3j/SoOSnycV92wAGPZnMDFJXNr9cPRG3Xx69RcD X-Received: by 2002:a63:ba43:: with SMTP id l3-v6mr1316148pgu.295.1530699852715; Wed, 04 Jul 2018 03:24:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530699852; cv=none; d=google.com; s=arc-20160816; b=G2K+o3c0jS/0W+GwBx7HKWrDUM2hNQtFyc/aHdZiexH84gdjA8b/qAFYxlBbTnJiGo GVvoN3EA/FRWCPnDwH0IryHeq6MZWuAlRuhxuN02HTkm+myrEE5L2BQ1TkvLqR5oRuwX MGd1bi/tF5wdDPACYpEXqUGCtMntYjwiOECYWnmZiGW12HF2VIrgfGoPlJ1BENGEl805 ky2Dpegjb+DWuNB60R+utxtIaurYhX1YHFRIxY6ncw978rjQO4IJs/at+moTEjVnO5Ao 9pAJryvHsCP39xYCtkvDvtyybAHExYyT9sSh5f8wWIpL9L74WaNnAf540Qs268jlaYpV 8CeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:to:subject:date:from :arc-authentication-results; bh=/Q9O7Nmul+OARcLN/vaf5HvAEXg2XTX/XFf+fQGCsx4=; b=uos9aJ0NwWIg7TMndD3JpoowFdpsaGPCKsStrkTY8jmoY+2Ld7ctgfESR8pJRb4phC vFV8+S9jQQYKxnJVI3lv5OEmnpMBWlPEqulGKkz01//UsBOTSribGgUxpqv9AGhd1sX4 yBdgQYNOi8dmMY/n9CbWEcVjjS4Adpc9Fm0hdxN2iw70tYf0DEY/mjluocoPvfEYIP6O pFZP8SjrJFhnb+qT9jAKlyN0H6tuqkDpqNOcQMLXqn/1R/KykD7AGkJI3mGSIMklvqPU 9Xi6OZsXvUBMhSSYCRBNRUmsWpPmpBlZEk6fwrrW2bozu6VK1wxWYsEoZ2oZUu3CBr8l QqVA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l8-v6si2860897pgq.432.2018.07.04.03.23.58; Wed, 04 Jul 2018 03:24:12 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934513AbeGDKWp (ORCPT + 99 others); Wed, 4 Jul 2018 06:22:45 -0400 Received: from mail.steuer-voss.de ([85.183.69.95]:42382 "EHLO mail.steuer-voss.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932538AbeGDKWo (ORCPT ); Wed, 4 Jul 2018 06:22:44 -0400 X-Virus-Scanned: Debian amavisd-new at mail.steuer-voss.de Received: by mail.steuer-voss.de (Postfix, from userid 1000) id 2C00942D43; Wed, 4 Jul 2018 12:22:40 +0200 (CEST) From: Nikolaus Voss Date: Tue, 3 Jul 2018 08:09:24 +0200 Subject: [PATCH] ACPI: bus.c: Let acpi_device_get_match_data() return DT compatibility data To: Sudeep Holla , Ray Jui , Vladimir Olovyannikov , Vikram Prakash , Scott Branden , ACPI Devel Maling List , Linux Kernel Mailing List , Srinath Mannam , nv@vosn.de Message-Id: <20180704102240.2C00942D43@mail.steuer-voss.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When using ACPI with ACPI_DT_NAMESPACE_HID/ PRP0001 HID and referring to of_device_id table "compatible" strings in DSD, a pointer to the corresponding DT table entry should be returned instead of a null pointer. An acpi_device_id match still takes precedence. Signed-off-by: Nikolaus Voss --- drivers/acpi/bus.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 84b4a62018eb..c2deffea842e 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -832,13 +832,18 @@ EXPORT_SYMBOL_GPL(acpi_match_device); const void *acpi_device_get_match_data(const struct device *dev) { - const struct acpi_device_id *match; + const struct acpi_device_id *acpi_id = NULL; + const struct of_device_id *of_id = NULL; + const struct device_driver *drv = dev->driver; - match = acpi_match_device(dev->driver->acpi_match_table, dev); - if (!match) + __acpi_match_device(acpi_companion_match(dev), drv->acpi_match_table, + drv->of_match_table, &acpi_id, &of_id); + if (acpi_id) + return (const void*)acpi_id->driver_data; + else if (of_id) + return (const void*)of_id->data; + else return NULL; - - return (const void *)match->driver_data; } EXPORT_SYMBOL_GPL(acpi_device_get_match_data); -- 2.17.1