Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp8086157pxu; Sat, 26 Dec 2020 15:50:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDg3PZnGtvXLAQ2jagyt7TqQorS0BIKH2RSAuO/XlwjHMIRkJmnqHPpPPN5/lNVdZzaw4b X-Received: by 2002:a17:906:195a:: with SMTP id b26mr36051309eje.4.1609026657873; Sat, 26 Dec 2020 15:50:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609026657; cv=none; d=google.com; s=arc-20160816; b=rLwJYFNN+HiCZRnAcL42AZAiyQA90cv0eZMzlELVbHK1niY0V43sQk+uvG+FD6L+hm tKg+l3T87gvrWkSBK+bQ2LHHtwexPjIu5tJzNSo2BjOpOR5vlA5v8B+cDElAhEuW8kPf 3OSfAJwu5QPc+n952mC/cQOBesk8CSG6vMOy9FgNwroe5UkhQGrE2ne+seLN9NAEjYyT qwkryzywCUudJyagmLWsjtDMfh2BZkMYBttpjo3RToRSSn+5ULhyCe0ZP6JlZKwxO0+2 o/kL8XFBomub08lVDIYWyishXQGYJ+DCKFVDIz2YSQ+ljMH3WTZ3nyc4kztt3TQJA07p M9Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=kzI2MBTYva7U96gTMdRoE9qINNA+Cq6RZ4dSPhM8U1k=; b=Rh5O5+F0hS+hh0lQXJvduro0W9KQ0HA9RrafUoQBqEUp4LkEylPKMgLYb+Qdqptxd1 DO/Hzua+8UbJiG1X2NFjDfUjeVib7Fg+aO/UwBIfPcyOpxiQ691/fy6etFOhpLCvkR1I 2MGVRxEb0E6cT8wrQYluRTHi26Ih4eiQBF9WnZRdycK8a1ciYY4Ri09aV90vHOXpRLhk 1HUO/simlY+4ygnAyzyszydVp8MSkzsTfNzCLlveX6xbeo1m8KdwWvBhSZvf/31D1n/Q X2oks6RFZBuSkmGZ0lZGZCkyRW5M2ZajQh52yPQbHBqBW41e1ItaHxTp7ZeNiajOTKfx 9O2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="hJM+G/aA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o27si15974102ejd.738.2020.12.26.15.50.18; Sat, 26 Dec 2020 15:50:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="hJM+G/aA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726101AbgLZXsX (ORCPT + 99 others); Sat, 26 Dec 2020 18:48:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725943AbgLZXsW (ORCPT ); Sat, 26 Dec 2020 18:48:22 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64F50C061757; Sat, 26 Dec 2020 15:47:42 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id c5so7056174wrp.6; Sat, 26 Dec 2020 15:47:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=kzI2MBTYva7U96gTMdRoE9qINNA+Cq6RZ4dSPhM8U1k=; b=hJM+G/aArmhCe9cR274A2+PGV6lQ/drZKAZwupEAAlgnFtX4aQZPx2DqEXbX7LGQkk YdgYKL15S6UQTVSNwr3QWdj5a0bQ/ggEQvuDO7TzVLipV0Vib95bOSvXey/5gVQez2Jc TiGZclktxHth2mxRD4m8Xu/QI16HD2GaRJuodWEU+7NYA08ZYjsCOEr2tZ3ZFWRnMull gYe3hEzyRXbW0lWl5dSKuNUI3P89K6wz8MfuBzOMuDZ6DUyL6y5kuSwhlhViSLWAB3ap SQLFuWIeg5v9zTwTKv1Fhr7uD8e+e2US2woYNrvXWQ23BTaRxZZ0O7BYM42npMRuw2rf wwKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kzI2MBTYva7U96gTMdRoE9qINNA+Cq6RZ4dSPhM8U1k=; b=glQMUr9/fJRXqLcJbH3T+3VJwyMncsZRn2Df10BfPoYMT+2wbehHYInfXuhWWfqKOi DGY5hPaC++jMSHUDuQGtDC4/P8ke7X1YDZjb5W1XpvpMkZfMyAsugT+vsu+UKJQgGUn3 heSusFKQnQAb4/ELx6hao2Vu5zD0VTOWi6aQUzvIcnHSUZO7/PNf7lMK618O6FdPvchT jRTIfnw/0CSsYQlMoCQytjMS5ypqc3JnDj5sNyetW+7QRuUG7lTnYWYqW9DoG8Veu+UL vX4DIwps3tR39QhY0rnixC1u5cHxvw6mI3LNZ1OggUBh/HfkApo6cTzeR52NkGvySAc9 Olfg== X-Gm-Message-State: AOAM531ZAp8kj+sWAdEFsMh7hpsevtbkV5GTDXU8cvmUGaNRd3qpLwUd 8g8Y9Tjo7bjKT+nwh1rlN34= X-Received: by 2002:adf:e9d2:: with SMTP id l18mr43057569wrn.179.1609026459449; Sat, 26 Dec 2020 15:47:39 -0800 (PST) Received: from [192.168.1.211] ([2.31.224.116]) by smtp.gmail.com with ESMTPSA id m17sm54312124wrn.0.2020.12.26.15.47.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Dec 2020 15:47:38 -0800 (PST) Subject: Re: [PATCH v3 07/14] software_node: Add support for fwnode_graph*() family of functions To: Andy Shevchenko Cc: Linux Kernel Mailing List , ACPI Devel Maling List , Linux Media Mailing List , devel@acpica.org, "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Yong Zhi , Sakari Ailus , Bingbu Cao , Tian Shu Qiu , Mauro Carvalho Chehab , Robert Moore , Erik Kaneda , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Laurent Pinchart , Jacopo Mondi , kieran.bingham+renesas@ideasonboard.com, Hans Verkuil , Marco Felsch , niklas.soderlund+renesas@ragnatech.se, Steve Longerbeam , "Krogerus, Heikki" , Linus Walleij References: <20201224010907.263125-1-djrscally@gmail.com> <20201224010907.263125-8-djrscally@gmail.com> From: Daniel Scally Message-ID: Date: Sat, 26 Dec 2020 23:47:37 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy On 24/12/2020 12:24, Andy Shevchenko wrote: > On Thu, Dec 24, 2020 at 3:14 AM Daniel Scally wrote: >> >> From: Heikki Krogerus >> >> This implements the remaining .graph_* callbacks in the > > .graph_* ==> ->graph_*() ? > >> fwnode operations structure for the software nodes. That makes >> the fwnode_graph*() functions available in the drivers also > > graph*() -> graph_*() ? Both done. >> when software nodes are used. >> >> The implementation tries to mimic the "OF graph" as much as >> possible, but there is no support for the "reg" device >> property. The ports will need to have the index in their >> name which starts with "port@" (for example "port@0", "port@1", > >> ...) > > Looks not good, perhaps move to the previous line, or move port@1 example here? Fixed - by expanding the lines to ~75 chars > Few nitpicks here and there, after addressing them, > Reviewed-by: Andy Shevchenko Thank you! >> +static struct fwnode_handle * >> +swnode_graph_find_next_port(const struct fwnode_handle *parent, >> + struct fwnode_handle *port) >> +{ >> + struct fwnode_handle *old = port; >> + >> + while ((port = software_node_get_next_child(parent, old))) { >> + /* >> + * ports have naming style "port@n", so we search for children >> + * that follow that convention (but without assuming anything >> + * about the index number) >> + */ > >> + if (!strncmp(to_swnode(port)->node->name, "port@", > > You may use here corresponding _FMT macro. >> +static int >> +software_node_graph_parse_endpoint(const struct fwnode_handle *fwnode, >> + struct fwnode_endpoint *endpoint) >> +{ >> + struct swnode *swnode = to_swnode(fwnode); >> + int ret; >> + >> + /* Ports have naming style "port@n", we need to select the n */ > >> + ret = kstrtou32(swnode->parent->node->name + FWNODE_GRAPH_PORT_NAME_PREFIX_LEN, > > Maybe a temporary variable? > > unsigned int prefix_len = FWNODE_GRAPH_PORT_NAME_PREFIX_LEN; > ... > ret = kstrtou32(swnode->parent->node->name + prefix_len, Both discussed after Laurent's reply I think.