From patchwork Mon Jun 3 15:49:47 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: 165615 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644374ili; Mon, 3 Jun 2019 08:51:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/bULgnEmpYh7ORyJdR9I/wT6W6GwpvBXuX70ImAowbR9mf2RGjilZBC4bkFyoUlDWx5yd X-Received: by 2002:a17:902:f204:: with SMTP id gn4mr12108960plb.3.1559577097362; Mon, 03 Jun 2019 08:51:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577097; cv=none; d=google.com; s=arc-20160816; b=hiYfLnINUL6uuLrc34H8/HxwC5nEo9VNXr4XU1u+07cy4COOc02Aiy3p6Z1fCH6DFm YdzeABw1KauWlBN4StGim5fhOX848dkpsrU8Q7tL5zyl47cXG//34GNLrL66ZDs47O/0 tpR+RlktqrqO8olYXClZbC5+ZJ3OCQcU6ouz9ptx9MjzVXQILt7N1EdMvRZA2yu2Gdyf bfQi+ddHGgt7xO9dm3fnd4RIJOlTeEK5NOXDzwG3TWFjVXsTbx0py7uCNN95T1OqvWp+ 85WMWzMjot1ZzkuwFaLSODi1K3zbfPVEAJM0d0f81TDgqLUpW9P0OSrc20nShbOuqR+j 5Alw== 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=F2scviFIw6wJyj8zPpKEx7Qxe82QjyMwJGspHdw4jJY=; b=b0U8/15P7bpdzL8nMWw4Mvzfhwg2jpUGA9Q3ou1ts5IhDb8vwQ7zf4x+J8U21h7LgJ VMX43gtKe6nEM7UHu+ITzef8BIN6Qrme3tw9ICsqZ43n198669BfKSsDC+xzKpcnPFch +xuqulaNF7r31qO4jZ3yzPPJimqwUpGQkFfVctecxNRdG649WRNihOI/D4tCCtmf4BZx HzRzIXgj3sMtRRRw8I1gUEpm3RRFLkYxY9XzeeoDdOtKE502qQOgDXBXloqgpaJ9/bKB SExfUjehkUl8Dbm11gw52qESLJc7iLojArnTnSrzUMM68uLbZ+nkBJs0zKrBfSEBLZFn MDKQ== 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 ch7si14962581plb.21.2019.06.03.08.51.37; Mon, 03 Jun 2019 08:51:37 -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 S1729276AbfFCPvg (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:36 -0400 Received: from foss.arm.com ([217.140.101.70]:53740 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729112AbfFCPva (ORCPT ); Mon, 3 Jun 2019 11:51:30 -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 03A461A25; Mon, 3 Jun 2019 08:51:30 -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 17D1A3F246; Mon, 3 Jun 2019 08:51:28 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com Subject: [RFC PATCH 21/57] drivers: Add generic match helper by ACPI_COMPANION device Date: Mon, 3 Jun 2019 16:49:47 +0100 Message-Id: <1559577023-558-22-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559577023-558-1-git-send-email-suzuki.poulose@arm.com> References: <1559577023-558-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: 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 9df812f..db19185 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3335,6 +3335,12 @@ int device_match_of_node(struct device *dev, void *np) } EXPORT_SYMBOL_GPL(device_match_of_node); +int device_match_acpi_dev(struct device *dev, void *adev) +{ + return ACPI_COMPANION(dev) == adev; +} +EXPORT_SYMBOL(device_match_acpi_dev); + int device_match_fwnode(struct device *dev, void *fwnode) { return dev_fwnode(dev) == fwnode; diff --git a/include/linux/device.h b/include/linux/device.h index 83c0745..6ad1a27 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -164,6 +164,7 @@ struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); void subsys_dev_iter_exit(struct subsys_dev_iter *iter); int device_match_of_node(struct device *dev, void *np); +int device_match_acpi_dev(struct device *dev, void *adev); int device_match_fwnode(struct device *dev, void *fwnode); int device_match_devt(struct device *dev, void *pdevt);