From patchwork Wed Jun 5 15:13:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 165895 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp7485601ili; Wed, 5 Jun 2019 08:14:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXZp34oCij2w4NGM9DOicjysqMwaVE9fyuTwxs5fwK1tx06dll0Fsvzoa7O5tpL7JsLukg X-Received: by 2002:a17:902:8c82:: with SMTP id t2mr44245859plo.256.1559747688700; Wed, 05 Jun 2019 08:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559747688; cv=none; d=google.com; s=arc-20160816; b=hXI7JN+HKSy74vztxrTLHpil4EfUvNztGXJ85XBWrHX93w2BRuaytA6cT2lHDqtE7F Rm8HW/bfoUtGb1SHkdliiefQ01i7tnaZP/83M+r5Rcx1rHsxlGkpZzRHi4grBUyLwiqv bJU0w46pBP2JkZ7qSSd+lgFOsssTL9icTfh2zD0wfuXbEDCCoEE0WrQDeo44PhQg48TG o0a7CqJw8I+8jsUAUnNUCd7Ou99smRzKctqzXwujk/H2ixu5UbJ41ynz7VKpjQ0+sJM9 VfS+W/dLtwBhZsbOFD657POQRfjrXW9u3v8LTccn/7tyQAf2vlixZSqrLy0uVP7Uv7SX i5AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=JawPuYwv+r4yQC6mSSi1O7MYW8mZtBQXPtwa5uHGiJg=; b=MpU6ZWkP+ery0eh4Og1nLKqlkglVUqcmUN96Jy7lykKbkPfqwIAyHZhzj2XUryEuxy n05jcZd/oMre/MEUGyzW0vmbaWdT33xS/93ZyHk3v0447UkFvrS7WrirMQK2FLy3erqb NC5glwXCS5zZGqcTOPLJCIO149IsyYDjrCS3Kfk9sSHvqK+IeaIj212Fwu/Zr73bMhsv 9nuECBTFiDnwueDC8pDXhVtIAJIYyopy1dqEKF1F5FIN6AoWKO9D0xwoh/aWscQWbJkU stwiX0jTG4UD9Ydc9mUjVaaMjVIgINVwTOQghbp8/6XN0AY8nenwIFerdH6+Gfhn2Z+H k6GA== 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 o6si22557160pgk.52.2019.06.05.08.14.48; Wed, 05 Jun 2019 08:14:48 -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 S1728585AbfFEPOr (ORCPT + 30 others); Wed, 5 Jun 2019 11:14:47 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33472 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728200AbfFEPOl (ORCPT ); Wed, 5 Jun 2019 11:14:41 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E056715BF; Wed, 5 Jun 2019 08:14:40 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 612923F246; Wed, 5 Jun 2019 08:14:39 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Len Brown , linux-acpi@vger.kernel.org, linux-spi@vger.kernel.org, Mark Brown Subject: [PATCH 07/13] drivers: Add generic match helper by ACPI_COMPANION device Date: Wed, 5 Jun 2019 16:13:44 +0100 Message-Id: <1559747630-28065-8-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559747630-28065-1-git-send-email-suzuki.poulose@arm.com> References: <1559747630-28065-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a generic helper to match a device by the acpi device. Cc: Len Brown Cc: linux-acpi@vger.kernel.org Cc: linux-spi@vger.kernel.org Cc: Mark Brown Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose --- drivers/base/core.c | 6 ++++++ include/linux/device.h | 1 + 2 files changed, 7 insertions(+) -- 2.7.4 diff --git a/drivers/base/core.c b/drivers/base/core.c index b827ca1..597095b 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3346,3 +3346,9 @@ int device_match_devt(struct device *dev, const void *pdevt) return dev->devt == *(dev_t *)pdevt; } EXPORT_SYMBOL_GPL(device_match_devt); + +int device_match_acpi_dev(struct device *dev, const void *adev) +{ + return ACPI_COMPANION(dev) == adev; +} +EXPORT_SYMBOL(device_match_acpi_dev); diff --git a/include/linux/device.h b/include/linux/device.h index f315692..a03b50d 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -166,6 +166,7 @@ void subsys_dev_iter_exit(struct subsys_dev_iter *iter); int device_match_of_node(struct device *dev, const void *np); int device_match_fwnode(struct device *dev, const void *fwnode); int device_match_devt(struct device *dev, const void *pdevt); +int device_match_acpi_dev(struct device *dev, const void *adev); int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data));