From patchwork Fri Jun 14 17:54:20 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: 166900 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2353214ilk; Fri, 14 Jun 2019 10:55:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMMGlUs6Vlulzxsj7EMc9jHwiVaJlhtl76xESfaCFwf3RGhmPOqPo6dcgMpcHy4FLr9ysp X-Received: by 2002:a17:90a:aa0d:: with SMTP id k13mr11691671pjq.53.1560534943794; Fri, 14 Jun 2019 10:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560534943; cv=none; d=google.com; s=arc-20160816; b=gRs1v2Gi09uemH9UrEiu0Ob3i1Z9UjsnNuyeFkHsgo7dKvlzxxrlr7pQVkyC97zE/T 9WCCrqjkn41d9jApPNR1NJO8NHqst76NXWKBagwk/u4dUyDBjRWXn8KymRshgbLoQkfJ 6LGtJDsY3DaNiexi8gjcejvNqIuFBGUZ0ZTHYaPHToYuCB492/zjdoS1uxIdLmVYz7oX Y3rvRmqUrAFfV8wMabVRHKFvpr+AJezBDQSNoDINfUaeVdDedtDVGBx7MCPVOOe4M7XA QKHZsaw/FNzTIHiArAet+ipkFgUESD2DjFcw9aBX4QntqXgmeTFb1SSveJ+Ypasz+xje 5ntA== 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=bdhbIHED1qJJrUzfoe4QyRezW1w6cANL/6hbJSWjxJg=; b=CWlBXpxrUBvJiZ8OoyxeRdBAcWCvZKYLfbKvIOzKShsZmSRyMMYoDNXrY3Vzxu3327 BLjEMsugDOhCDU71Oy6VimcxWnnSSrCdvASnIBt9+M4bg0QaUZix/EkNZZBtdTYd8s0y 9Ns0fsd+3PpriSKCSo16O0Vy8jR8Og/7z/BywQuAOeq8xCpCzk5CRPgxRCk2mJeLKiW/ oeJwdh5hxSFhWlMkyvGbdsWeOykG27N8brNy1s+A4mp9AhTVrwuHZcBJVfaO6SPCVrp9 GhOAPd4SfRK8ap16ctBbKIC4P26UpQno4j2J83FUzn3wLCU63oPIOrEf5AyOImPHG+s9 NEhA== 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 v204si3133934pgb.80.2019.06.14.10.55.43; Fri, 14 Jun 2019 10:55:43 -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 S1727351AbfFNRzm (ORCPT + 17 others); Fri, 14 Jun 2019 13:55:42 -0400 Received: from foss.arm.com ([217.140.110.172]:39702 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727715AbfFNRz2 (ORCPT ); Fri, 14 Jun 2019 13:55:28 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 555EECFC; Fri, 14 Jun 2019 10:55:28 -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 9AB0D3F718; Fri, 14 Jun 2019 10:55:27 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com Subject: [PATCH v2 25/28] drivers: Introduce driver_find_device_by_devt() helper Date: Fri, 14 Jun 2019 18:54:20 +0100 Message-Id: <1560534863-15115-26-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560534863-15115-1-git-send-email-suzuki.poulose@arm.com> References: <1560534863-15115-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 wrapper to driver_find_device() to search for a device by the device type, reusing the generic match function. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose --- include/linux/device.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.7.4 diff --git a/include/linux/device.h b/include/linux/device.h index 2cf49f7..f7f6a43 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -463,6 +463,18 @@ driver_find_device_by_fwnode(struct device_driver *drv, return driver_find_device(drv, NULL, fwnode, device_match_fwnode); } +/** + * driver_find_device_by_devt- device iterator for locating a particular device + * by devt. + * @driver: the driver we're iterating + * @devt: devt pointer to match. + */ +static inline struct device *driver_find_device_by_devt(struct device_driver *drv, + dev_t devt) +{ + return driver_find_device(drv, NULL, &devt, device_match_devt); +} + void driver_deferred_probe_add(struct device *dev); int driver_deferred_probe_check_state(struct device *dev);