From patchwork Wed Jun 17 13:42:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6626251 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 493F09F326 for ; Wed, 17 Jun 2015 13:48:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7675C205E6 for ; Wed, 17 Jun 2015 13:48:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9B4B1204AD for ; Wed, 17 Jun 2015 13:48:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5DfN-0005rD-Q4; Wed, 17 Jun 2015 13:46:09 +0000 Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5Dcp-0002bB-D3 for linux-arm-kernel@lists.infradead.org; Wed, 17 Jun 2015 13:43:32 +0000 Received: by wgv5 with SMTP id 5so37483106wgv.1 for ; Wed, 17 Jun 2015 06:43:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=KXi2D10IBJtpOm1cfGG5sChGGiJc8viglCTRRp7E+FI=; b=NxXH89diuHAMsWTIKeoPhY8mNgtIVG3wFqBMILoABBQ49NZ3rC3YFo6CyIroCdSAFc Q/M6BSp53nhoWCn2TZPdC7BU2g9NnOIJkIR9f4N1I5r95yAVWO2qfxhJiR9DpkrerP+i NbIbtLALfYQ3EUmYRcjilVGyBAbloEo7dbVzUl7QyHWpVrFjUZiG7EwBAOEQtukOKiBF UbGp4f6ZZrocRnSWxMaR9vP3nJb32wA9Bial9cHIlS16la+3vCvcRnUzDYniUDjRgK/a Ck/GpMpHHRGMIlTUWLIrHNZV4NVJCKoo0pG/U6rxEaCHjvL3YqbP7/wV9Xm7qeTpFnb8 RVDQ== X-Received: by 10.194.120.230 with SMTP id lf6mr6159368wjb.41.1434548588427; Wed, 17 Jun 2015 06:43:08 -0700 (PDT) Received: from cizrna.lan ([109.72.12.132]) by mx.google.com with ESMTPSA id v3sm6920361wja.31.2015.06.17.06.43.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jun 2015 06:43:07 -0700 (PDT) From: Tomeu Vizoso To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 07/13] driver-core: Add class.get_dependencies() callback Date: Wed, 17 Jun 2015 15:42:17 +0200 Message-Id: <1434548543-22949-8-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1434548543-22949-1-git-send-email-tomeu.vizoso@collabora.com> References: <1434548543-22949-1-git-send-email-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150617_064331_639111_E1165C31 X-CRM114-Status: GOOD ( 11.87 ) X-Spam-Score: 0.0 (/) Cc: Mark Rutland , Krzysztof Kozlowski , Linus Walleij , Andrzej Hajda , Thierry Reding , Lv Zheng , Alexander Holler , Alexandre Courbot , Russell King , Pawel Moll , Stephen Warren , Robert Moore , Grant Likely , Len Brown , Arnd Bergmann , Ian Campbell , Rob Herring , =?UTF-8?q?Terje=20Bergstr=C3=B6m?= , Tomeu Vizoso , Greg Kroah-Hartman , Dmitry Torokhov , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Mark Brown , Kumar Gala , Javier Martinez Canillas X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Classes can implement this callback to provide a list of dependencies for a firmware node. These dependencies can be used to probe devices in order and to give proper warnings when dependencies cannot be fulfilled. This functionality is implemented in a class callback because subsystems implement the bindings that define how dependencies are expressed in the firmware. Adds struct fwnode_dependency, to be used to represent lists of dependencies of fwnodes. Signed-off-by: Tomeu Vizoso --- include/linux/device.h | 6 ++++++ include/linux/fwnode.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index 5a31bf3..c52f290 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -367,6 +367,10 @@ int subsys_virtual_register(struct bus_type *subsys, * @dev_release: Called to release the device. * @suspend: Used to put the device to sleep mode, usually to a low power * state. + * @get_dependencies: Returns a list of struct fwnode_dependency containing + * the dependencies of the passed firmware node. The class is + * expected to inspect the firmware node and extract dependencies + * from its properties, based on bindings documentation. * @resume: Used to bring the device from the sleep mode. * @ns_type: Callbacks so sysfs can detemine namespaces. * @namespace: Namespace of the device belongs to this class. @@ -397,6 +401,8 @@ struct class { int (*suspend)(struct device *dev, pm_message_t state); int (*resume)(struct device *dev); + struct list_head *(*get_dependencies)(struct fwnode_handle *fwnode); + const struct kobj_ns_type_operations *ns_type; const void *(*namespace)(struct device *dev); diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index 0408545..68ab558 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -24,4 +24,9 @@ struct fwnode_handle { struct fwnode_handle *secondary; }; +struct fwnode_dependency { + struct fwnode_handle *fwnode; + struct list_head dependency; +}; + #endif