From patchwork Mon Jun 3 15:50:19 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: 165633 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4645563ili; Mon, 3 Jun 2019 08:52:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqznh495TDeTvamf5xmlQtrSBTnyhYIdJPq/Xj8FUEwegowpBr5RO5lasymqzcbbqsgSB5Cx X-Received: by 2002:a17:90a:e17:: with SMTP id v23mr30258284pje.139.1559577165363; Mon, 03 Jun 2019 08:52:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577165; cv=none; d=google.com; s=arc-20160816; b=l6IAej6suFx9CrZqsbu0qNZHBCjqEFAN/Z4b+aB7jruH9uPD+L/1NzqModJAH35e+3 LtlIvMcfQzSXTb1YtvV5rXJzakHi6blbgQ6cbuPank+P71EATQymoH4CkKraeTYfnC1A 0dXKX7oBPnspguRs+W8THdNXYg4K56Il+hTpBxXiWo+0EueqmjzYgEqJpKhv4SMLlzad YrdisPOcYNGmno+eDIpngoaskSmAiBDjocDkItaDu21rf6PQv4FeBBSdoJQw6odVez2Z jSQHBWFpwOw0JRgO86K7yaZPDisjkjYtMT6PfS3QhVGilZHNi/uISwvp/1Ll6E5u6y0h lpBQ== 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=jXzLsbS5PujaA0N/FDc/wG0HSmBOeS8F9E3LkxUAMKo=; b=VqkHrhHX+GVoA3tCHzuH12QT8B48wkYanUiq86ztusBaqDYHzqZcHCQw8bt2cymU0g X9zYAgYo2ciTK0KbsZd5rvwrJVJ5j/UJGSwpmW8et04rTvk3EaCLU85qf/j0yQg4+j3d QgRWH4oNsVWnkfpM2SpuekvhCEuBnwcUDUlKeifXZO8rSEreoA42HGV1lZWeRYvZIUMZ KIf4aaurI1A1X7iC2+RI3INcBgybTdqC1x9wjJB3khJ9wYjg5zWBT+3Y5qWZx/haTK36 CJ7Z6LDoKvsHgQkQ0FiIij5dFZ7O5++2o6QQuWlM3EwMT3aHKxNl25FJySOtKEQD+9Fw POYA== 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 l3si3193510pgl.560.2019.06.03.08.52.45; Mon, 03 Jun 2019 08:52:45 -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 S1729617AbfFCPwo (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:44 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54092 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729585AbfFCPwU (ORCPT ); Mon, 3 Jun 2019 11:52:20 -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 257EC1A25; Mon, 3 Jun 2019 08:52:20 -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 0C5B13F246; Mon, 3 Jun 2019 08:52:18 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, "Rafael J. Wysocki" Subject: [RFC PATCH 53/57] drivers: Introduce bus_find_next_device() helper Date: Mon, 3 Jun 2019 16:50:19 +0100 Message-Id: <1559577023-558-54-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 helper to find the next device on the given bus from a given device iterator position. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose --- include/linux/device.h | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.7.4 diff --git a/include/linux/device.h b/include/linux/device.h index 7ea15e6..528efc0 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -234,6 +234,16 @@ static inline struct device *bus_find_device_by_devt(struct bus_type *bus, return bus_find_device(bus, start, &devt, device_match_devt); } +/** + * bus_find_next_device - Find the next device after a given device in a + * given bus. + */ +static inline struct device *bus_find_next_device(struct bus_type *bus, + struct device *start) +{ + return bus_find_device(bus, start, NULL, device_match_any); +} + struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id, struct device *hint); int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,