Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp46135pxb; Tue, 12 Jan 2021 19:35:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyAT4Y/1gxjioNlQ29Br/AtR6ZVhutPqfhryrXCCvCLT17derRJ9N5Hn8Ik/vjcuwvrz28l X-Received: by 2002:aa7:c5ce:: with SMTP id h14mr180812eds.188.1610508922369; Tue, 12 Jan 2021 19:35:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610508922; cv=none; d=google.com; s=arc-20160816; b=vsKp/Mr2DzZ4uof3JOcOziM9E8grBo3BBMKsH+lumLa1MvcRsy/lMfEvfNFQAZBZeP CaAIOBMo1dBf+pG9zPpzshrJIMd5x+UTmALnf6fo4PlVv//i5Piv5rO0Q8TuPR5jqjft ocVSXv6w9Xe4WATOOPBW/HzkgAgc8UOeOL5UsEAWmfLTLTj/rF392QXQwXNm9zgi5arl mCv7qyiQQPT5zdfR0HavR1FixQfTo+ZceoerQQ8fMo2S14du0d+m9Cia7VbYDkESqfqt JxkMNl21jaWqHlKhpXeCNFUk7E90Si9tNEy34fI4p4mog/AAILQVcF4eHFfNzUH5ZwGU jtsg== 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=wnYzjTfj+0CVGKioX4F3f2Rr2TE6YgQbb5/kGOsgyiM=; b=0x8xPc+unvp7Bd//01SQhUCSGLB5xXX7WsDgmcmH/lt5Erh/cGv/HzfTbM15W0dSwM TtL+e2e+Vk/P1ltMv+7W5oxHVwXc2F7Uw2U6XnxwRgLETY2cLlaLQbQ+iR0deub/MXIj 9w2jVPD7OqiaNoJXIrB6wo+BgooTKxOYwxM3u9Y+4XjaxFnkhZsKgBYDzPo/dce3/Cxc N0iZsLTUNaocjnDigdPQnoE5FIC8rNQXAY3DC1Y6DPlro9jIYRXY/xqMTJXtlCMqiCX2 4p/g2QJGCGAz1s1/GiXxnB99SoY07T6moHltPz3v2BI1OVpbARauVZ8VWsH87SbnEQqK 9hRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=Kyvh2i86; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e20si325148ejq.444.2021.01.12.19.34.58; Tue, 12 Jan 2021 19:35:22 -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=@infradead.org header.s=merlin.20170209 header.b=Kyvh2i86; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728032AbhAMBCS (ORCPT + 99 others); Tue, 12 Jan 2021 20:02:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728154AbhAMBCQ (ORCPT ); Tue, 12 Jan 2021 20:02:16 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 920B9C061795 for ; Tue, 12 Jan 2021 17:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=wnYzjTfj+0CVGKioX4F3f2Rr2TE6YgQbb5/kGOsgyiM=; b=Kyvh2i86LAY7d/OHvkygqKltvh fwr9ODYbvcQs/yMz9MRhIjoAwIkm8BsuVIkOBBqAUe6r3GYbLNqNPCYrr7YLGPGU2MjK+wQAChyrg 6XaBESrBO7bZBzHeSaV2tHOvlSUWHWTOmUQo2ibDaPj803hM9wDzG8uUIKqrZF9wkGFZA4rSBZwGn KgKVQ31ETPPrWf/ZFjJiJg1oMDD4isq+tevQC9H0R4Aa5NlSD9bylTq/RJSKJhfH8L77y2yQ0O9q6 xmtLIDErl/FyRAfrUNrZGXb3CdmqD+kfWXtm1IbjDZEYXxHWUoov/vDrINkBe1QYG5v1rW6IXYPOH UZixV/BA==; Received: from [2601:1c0:6280:3f0::9abc] by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kzUXT-0005UF-5E; Wed, 13 Jan 2021 01:01:32 +0000 Subject: Re: [PATCH v2] software_node: Add kernel-doc comments to exported symbols To: Daniel Scally , gregkh@linuxfoundation.org, rafael@kernel.org, linux-kernel@vger.kernel.org Cc: heikki.krogerus@linux.intel.com, sakari.ailus@linux.intel.com, andriy.shevchenko@linux.intel.com References: <20210113000209.322218-1-djrscally@gmail.com> From: Randy Dunlap Message-ID: <0c5710f0-88c3-ace5-64c7-e668705b5bf8@infradead.org> Date: Tue, 12 Jan 2021 17:01:25 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20210113000209.322218-1-djrscally@gmail.com> 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 On 1/12/21 4:02 PM, Daniel Scally wrote: > A number of functions which are exported via EXPORT_SYMBOL_GPL() lack any > kernel-doc comments; add those in so all exported symbols are documented. > > Reviewed-by: Andy Shevchenko > Reviewed-by: Heikki Krogerus > Signed-off-by: Daniel Scally > --- > Changes in version 2: > - Replaced "fwnode_handle" with either @fwnode or natural language > reference to a firmware node handle as appropriate. > > drivers/base/swnode.c | 53 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 53 insertions(+) > > diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c > index 4a4b2008fbc2..e98018aa8b2f 100644 > --- a/drivers/base/swnode.c > +++ b/drivers/base/swnode.c > @@ -33,6 +33,13 @@ static struct kset *swnode_kset; > > static const struct fwnode_operations software_node_ops; > > +/** > + * is_software_node() - check if given fwnode was created from a software_node > + * @fwnode: The &struct fwnode_handle to check > + * > + * This function is used to check whether a given firmware node handle was > + * created by registering a &struct software_node or not. > + */ > bool is_software_node(const struct fwnode_handle *fwnode) > { > return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &software_node_ops; > @@ -71,6 +78,14 @@ software_node_to_swnode(const struct software_node *node) > return swnode; > } > > +/** > + * to_software_node() - Fetch software node associated with a firmware node handle > + * @fwnode: The pointer to a &struct fwnode_handle to parse > + * > + * This function attempts to fetch a pointer to the &struct software_node which > + * was used to create the given @fwnode. Note that this will only work if the > + * software node has **not** been released. > + */ > const struct software_node *to_software_node(const struct fwnode_handle *fwnode) > { > const struct swnode *swnode = to_swnode(fwnode); > @@ -79,6 +94,14 @@ const struct software_node *to_software_node(const struct fwnode_handle *fwnode) > } > EXPORT_SYMBOL_GPL(to_software_node); > > +/** > + * software_node_fwnode() - Fetch firmware node associated with a given software node > + * @node: The pointer to a &struct software_node to parse > + * > + * This function attempts to fetch a pointer to the &struct fwnode_handle which > + * was created from the given @node. Note that this will only work after the > + * software node has been registered. > + */ > struct fwnode_handle *software_node_fwnode(const struct software_node *node) > { > struct swnode *swnode = software_node_to_swnode(node); > @@ -800,6 +823,27 @@ void software_node_unregister(const struct software_node *node) > } > EXPORT_SYMBOL_GPL(software_node_unregister); > > +/** > + * fwnode_create_software_node() - Create and register a new software_node > + * @properties: NULL terminated array of properties to assign to the new node > + * @parent: Pointer to a &struct fwnode_handle to assign as parent to the new > + * node > + * > + * NOTE: The pointer passed to @parent **must** be to a firmware node handle maybe: passed as @parent ? Otherwise, LGTM. Thanks for doing this. Reviewed-by: Randy Dunlap > + * that was created by registering a software node, meaning is_software_node() > + * must return true when passed that pointer. > + * > + * This function creates a new instance of &struct software_node, assigns it a > + * copy of the given array of properties and registers it as a new fwnode_handle. > + * Freeing of the allocated memory when the fwnode_handle is no longer needed is > + * handled via software_node_release() and does not need to be done separately. > + * > + * Returns: > + * * fwnode_handle * - On success > + * * -EINVAL - When @parent is not associated with a software_node > + * * -ENOMEM - When memory allocation fails > + * * -Other - Propagated errors from sub-functions > + */ > struct fwnode_handle * > fwnode_create_software_node(const struct property_entry *properties, > const struct fwnode_handle *parent) > @@ -832,6 +876,15 @@ fwnode_create_software_node(const struct property_entry *properties, > } > EXPORT_SYMBOL_GPL(fwnode_create_software_node); > > +/** > + * fwnode_remove_software_node() - Put a reference to a registered software_node > + * @fwnode: The pointer to the &struct fwnode_handle you want to release > + * > + * Release a reference to a registered &struct software_node. This function > + * differs from software_node_put() in that it takes no action if the > + * firmware node handle passed to @fwnode turns out not to have been created by > + * registering a software_node. > + */ > void fwnode_remove_software_node(struct fwnode_handle *fwnode) > { > struct swnode *swnode = to_swnode(fwnode); > -- ~Randy You can't do anything without having to do something else first. -- Belefant's Law