From patchwork Sat Mar 27 22:20:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12168673 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 096F1C433E8 for ; Sat, 27 Mar 2021 22:21:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E722961976 for ; Sat, 27 Mar 2021 22:21:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231225AbhC0WUm (ORCPT ); Sat, 27 Mar 2021 18:20:42 -0400 Received: from mga14.intel.com ([192.55.52.115]:65376 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231191AbhC0WUR (ORCPT ); Sat, 27 Mar 2021 18:20:17 -0400 IronPort-SDR: Xoq7TagD7rdSeABGU20yDwb7C1SndxULbZfqA/QSpUv63EgOCoPrfAgRZ5SUt3avb8TvAvEYbU IdurenMTkIcA== X-IronPort-AV: E=McAfee;i="6000,8403,9936"; a="190792949" X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="190792949" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2021 15:20:16 -0700 IronPort-SDR: Fm30aeXPCvAm5sdq9f22Q7ZzXtWWAW+bh5SrIxPsTasYOT1OuV3Y9X7Y5AC0VxWy5KLtXNEbka iRjLdNX/M3zw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="594591281" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 27 Mar 2021 15:20:13 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C980411F; Sun, 28 Mar 2021 00:20:27 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Daniel Scally , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Yong Zhi , Sakari Ailus , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Heikki Krogerus Subject: [PATCH v1 1/8] software node: Free resources explicitly when swnode_register() fails Date: Sun, 28 Mar 2021 00:20:05 +0200 Message-Id: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Currently we have a slightly twisted logic in swnode_register(). It frees resources that it doesn't allocate on error path and in once case it relies on the ->release() implementation. Untwist the logic by freeing resources explicitly when swnode_register() fails. Currently it happens only in fwnode_create_software_node(). Signed-off-by: Andy Shevchenko --- drivers/base/swnode.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index fa3719ef80e4..456f5fe58b58 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -767,22 +767,19 @@ swnode_register(const struct software_node *node, struct swnode *parent, int ret; swnode = kzalloc(sizeof(*swnode), GFP_KERNEL); - if (!swnode) { - ret = -ENOMEM; - goto out_err; - } + if (!swnode) + return ERR_PTR(-ENOMEM); ret = ida_simple_get(parent ? &parent->child_ids : &swnode_root_ids, 0, 0, GFP_KERNEL); if (ret < 0) { kfree(swnode); - goto out_err; + return ERR_PTR(ret); } swnode->id = ret; swnode->node = node; swnode->parent = parent; - swnode->allocated = allocated; swnode->kobj.kset = swnode_kset; fwnode_init(&swnode->fwnode, &software_node_ops); @@ -803,16 +800,17 @@ swnode_register(const struct software_node *node, struct swnode *parent, return ERR_PTR(ret); } + /* + * Assign the flag only in the successful case, so + * the above kobject_put() won't mess up with properties. + */ + swnode->allocated = allocated; + if (parent) list_add_tail(&swnode->entry, &parent->children); kobject_uevent(&swnode->kobj, KOBJ_ADD); return &swnode->fwnode; - -out_err: - if (allocated) - property_entries_free(node->properties); - return ERR_PTR(ret); } /** @@ -963,6 +961,7 @@ struct fwnode_handle * fwnode_create_software_node(const struct property_entry *properties, const struct fwnode_handle *parent) { + struct fwnode_handle *fwnode; struct software_node *node; struct swnode *p = NULL; int ret; @@ -987,7 +986,13 @@ fwnode_create_software_node(const struct property_entry *properties, node->parent = p ? p->node : NULL; - return swnode_register(node, p, 1); + fwnode = swnode_register(node, p, 1); + if (IS_ERR(fwnode)) { + property_entries_free(node->properties); + kfree(node); + } + + return fwnode; } EXPORT_SYMBOL_GPL(fwnode_create_software_node); From patchwork Sat Mar 27 22:20:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12168669 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C91F3C433E3 for ; Sat, 27 Mar 2021 22:21:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 94437619AB for ; Sat, 27 Mar 2021 22:21:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231199AbhC0WUl (ORCPT ); Sat, 27 Mar 2021 18:20:41 -0400 Received: from mga17.intel.com ([192.55.52.151]:30344 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231189AbhC0WUQ (ORCPT ); Sat, 27 Mar 2021 18:20:16 -0400 IronPort-SDR: S/FeV6jDuC0WhUs6evgYV6ZuiWjmDfbiAh/U9C74peyXmnffOkFbCW+p5PQDflLoH+xyugpRT3 O6cjAVapJSYA== X-IronPort-AV: E=McAfee;i="6000,8403,9936"; a="171343878" X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="171343878" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2021 15:20:16 -0700 IronPort-SDR: zQiDHXu7GDLDsku6wxtsgSBjXCscK30U39o3qbUErh4jkFkJNrGfZ8zbV5WpTbTKTNJn08D1sW 1OsT1Qr+PZRA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="410447020" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 27 Mar 2021 15:20:13 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id D524C103; Sun, 28 Mar 2021 00:20:27 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Daniel Scally , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Yong Zhi , Sakari Ailus , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Heikki Krogerus Subject: [PATCH v1 2/8] software node: Introduce software_node_alloc()/software_node_free() Date: Sun, 28 Mar 2021 00:20:06 +0200 Message-Id: <20210327222012.54103-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> References: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Introduce software_node_alloc() and software_node_free() helpers. This will help with code readability and maintenance. Signed-off-by: Andy Shevchenko --- drivers/base/swnode.c | 47 ++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 456f5fe58b58..19aa44bc2628 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -720,19 +720,30 @@ software_node_find_by_name(const struct software_node *parent, const char *name) } EXPORT_SYMBOL_GPL(software_node_find_by_name); -static int -software_node_register_properties(struct software_node *node, - const struct property_entry *properties) +static struct software_node *software_node_alloc(const struct property_entry *properties) { struct property_entry *props; + struct software_node *node; props = property_entries_dup(properties); if (IS_ERR(props)) - return PTR_ERR(props); + return ERR_CAST(props); + + node = kzalloc(sizeof(*node), GFP_KERNEL); + if (!node) { + property_entries_free(props); + return ERR_PTR(-ENOMEM); + } node->properties = props; - return 0; + return node; +} + +static void software_node_free(const struct software_node *node) +{ + property_entries_free(node->properties); + kfree(node); } static void software_node_release(struct kobject *kobj) @@ -746,10 +757,9 @@ static void software_node_release(struct kobject *kobj) ida_simple_remove(&swnode_root_ids, swnode->id); } - if (swnode->allocated) { - property_entries_free(swnode->node->properties); - kfree(swnode->node); - } + if (swnode->allocated) + software_node_free(swnode->node); + ida_destroy(&swnode->child_ids); kfree(swnode); } @@ -964,7 +974,6 @@ fwnode_create_software_node(const struct property_entry *properties, struct fwnode_handle *fwnode; struct software_node *node; struct swnode *p = NULL; - int ret; if (parent) { if (IS_ERR(parent)) @@ -974,23 +983,15 @@ fwnode_create_software_node(const struct property_entry *properties, p = to_swnode(parent); } - node = kzalloc(sizeof(*node), GFP_KERNEL); - if (!node) - return ERR_PTR(-ENOMEM); - - ret = software_node_register_properties(node, properties); - if (ret) { - kfree(node); - return ERR_PTR(ret); - } + node = software_node_alloc(properties); + if (IS_ERR(node)) + return ERR_CAST(node); node->parent = p ? p->node : NULL; fwnode = swnode_register(node, p, 1); - if (IS_ERR(fwnode)) { - property_entries_free(node->properties); - kfree(node); - } + if (IS_ERR(fwnode)) + software_node_free(node); return fwnode; } From patchwork Sat Mar 27 22:20:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12168675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43FF3C433E9 for ; Sat, 27 Mar 2021 22:21:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1EB0661976 for ; Sat, 27 Mar 2021 22:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231258AbhC0WUn (ORCPT ); Sat, 27 Mar 2021 18:20:43 -0400 Received: from mga14.intel.com ([192.55.52.115]:65376 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231194AbhC0WUS (ORCPT ); Sat, 27 Mar 2021 18:20:18 -0400 IronPort-SDR: oPHnaxeppvo/LCaOuep+NReZ/2+0pPgXRcHjXuo6PUVg56O30BymMWmtodsUtQi19wqy6paJBC YUhfYLhM+HTg== X-IronPort-AV: E=McAfee;i="6000,8403,9936"; a="190792951" X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="190792951" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2021 15:20:17 -0700 IronPort-SDR: dupuPbrfXH4RC8cEJMOLs68HpZO6BskZtP3jLI8WbGP268LyMFnzosOdeUxY6lLtQeJHcBhuRc K3xDECKlStGg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="526476385" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 27 Mar 2021 15:20:13 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id E136A236; Sun, 28 Mar 2021 00:20:27 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Daniel Scally , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Yong Zhi , Sakari Ailus , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Heikki Krogerus Subject: [PATCH v1 3/8] software node: Show properties and their values in sysfs Date: Sun, 28 Mar 2021 00:20:07 +0200 Message-Id: <20210327222012.54103-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> References: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org It's very convenient to see what properties and their values are currently being assigned in the registered software nodes. Show properties and their values in sysfs. Signed-off-by: Andy Shevchenko Reported-by: kernel test robot --- drivers/base/swnode.c | 137 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 132 insertions(+), 5 deletions(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 19aa44bc2628..d7fe1a887d2d 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -10,6 +10,7 @@ #include #include #include +#include struct swnode { int id; @@ -17,6 +18,10 @@ struct swnode { struct fwnode_handle fwnode; const struct software_node *node; + /* properties in sysfs */ + struct kobj_attribute *property_attrs; + struct attribute_group property_group; + /* hierarchy */ struct ida child_ids; struct list_head entry; @@ -25,6 +30,7 @@ struct swnode { unsigned int allocated:1; unsigned int managed:1; + unsigned int properties:1; }; static DEFINE_IDA(swnode_root_ids); @@ -299,6 +305,18 @@ static int property_entry_copy_data(struct property_entry *dst, return 0; } +static int property_entries_count(const struct property_entry *properties) +{ + int n = 0; + + if (properties) { + while (properties[n].name) + n++; + } + + return n; +} + /** * property_entries_dup - duplicate array of properties * @properties: array of properties to copy @@ -310,15 +328,13 @@ struct property_entry * property_entries_dup(const struct property_entry *properties) { struct property_entry *p; - int i, n = 0; + int i, n; int ret; - if (!properties) + n = property_entries_count(properties); + if (n == 0) return NULL; - while (properties[n].name) - n++; - p = kcalloc(n + 1, sizeof(*p), GFP_KERNEL); if (!p) return ERR_PTR(-ENOMEM); @@ -746,6 +762,108 @@ static void software_node_free(const struct software_node *node) kfree(node); } +static ssize_t +swnode_property_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) +{ + struct swnode *swnode = kobj_to_swnode(kobj); + const struct property_entry *prop; + const void *pointer; + ssize_t len = 0; + int i; + + prop = property_entry_get(swnode->node->properties, attr->attr.name); + if (!prop) + return -EINVAL; + + /* We can't fail here, because it means boolean property */ + pointer = property_get_pointer(prop); + if (!pointer) + return sysfs_emit(buf, "\n"); + + switch (prop->type) { + case DEV_PROP_U8: + for (i = 0; i < prop->length / sizeof(u8); i++) + len += sysfs_emit_at(buf, len, "%u,", ((u8 *)pointer)[i]); + break; + case DEV_PROP_U16: + for (i = 0; i < prop->length / sizeof(u16); i++) + len += sysfs_emit_at(buf, len, "%u,", ((u16 *)pointer)[i]); + break; + case DEV_PROP_U32: + for (i = 0; i < prop->length / sizeof(u32); i++) + len += sysfs_emit_at(buf, len, "%u,", ((u32 *)pointer)[i]); + break; + case DEV_PROP_U64: + for (i = 0; i < prop->length / sizeof(u64); i++) + len += sysfs_emit_at(buf, len, "%llu,", ((u64 *)pointer)[i]); + break; + case DEV_PROP_STRING: + for (i = 0; i < prop->length / sizeof(const char **); i++) + len += sysfs_emit_at(buf, len, "\"%s\",", ((const char **)pointer)[i]); + break; + default: + return -EINVAL; + } + + sysfs_emit_at(buf, len ? len - 1 : 0, "\n"); + return len; +} + +static int swnode_register_properties(struct swnode *swnode) +{ + const struct property_entry *props = swnode->node->properties; + struct attribute **group_attrs; + struct kobj_attribute *attrs; + int n; + int ret; + + n = property_entries_count(props); + if (n == 0) + return 0; + + group_attrs = kcalloc(n + 1, sizeof(*group_attrs), GFP_KERNEL); + if (!group_attrs) + return -ENOMEM; + + attrs = kcalloc(n, sizeof(*attrs), GFP_KERNEL); + if (!attrs) { + kfree(group_attrs); + return -ENOMEM; + } + + while (n--) { + sysfs_attr_init(&attrs[n]); + attrs[n].attr.mode = 0444; + attrs[n].attr.name = props[n].name; + attrs[n].show = swnode_property_show; + group_attrs[n] = &attrs[n].attr; + } + + swnode->property_group.name = "properties"; + swnode->property_group.attrs = group_attrs; + + ret = sysfs_create_group(&swnode->kobj, &swnode->property_group); + if (ret) { + kfree(attrs); + kfree(group_attrs); + return ret; + } + + swnode->property_attrs = attrs; + swnode->properties = true; + return 0; +} + +static void swnode_unregister_properties(struct swnode *swnode) +{ + /* + * Nodes under sysfs are removed by __kobject_del(), + * we don't need to call sysfs_remove_group() explicitly. + */ + kfree(swnode->property_group.attrs); + kfree(swnode->property_attrs); +} + static void software_node_release(struct kobject *kobj) { struct swnode *swnode = kobj_to_swnode(kobj); @@ -757,6 +875,9 @@ static void software_node_release(struct kobject *kobj) ida_simple_remove(&swnode_root_ids, swnode->id); } + if (swnode->properties) + swnode_unregister_properties(swnode); + if (swnode->allocated) software_node_free(swnode->node); @@ -810,6 +931,12 @@ swnode_register(const struct software_node *node, struct swnode *parent, return ERR_PTR(ret); } + ret = swnode_register_properties(swnode); + if (ret) { + kobject_put(&swnode->kobj); + return ERR_PTR(ret); + } + /* * Assign the flag only in the successful case, so * the above kobject_put() won't mess up with properties. From patchwork Sat Mar 27 22:20:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12168679 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C379C433FB for ; Sat, 27 Mar 2021 22:21:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EDCCD619AB for ; Sat, 27 Mar 2021 22:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231214AbhC0WUm (ORCPT ); Sat, 27 Mar 2021 18:20:42 -0400 Received: from mga12.intel.com ([192.55.52.136]:20237 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231192AbhC0WUR (ORCPT ); Sat, 27 Mar 2021 18:20:17 -0400 IronPort-SDR: pM0Dis63SoBZ7fNy4JwA+Gf6AuttayFpCX5qJCu4TfAXG3rLzl55OitmJGpLRZEmsC+POmWO84 CtQmjzwOD2Sw== X-IronPort-AV: E=McAfee;i="6000,8403,9936"; a="170732004" X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="170732004" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2021 15:20:17 -0700 IronPort-SDR: LkmIsYHL0BkahnxczuekWaqkoWewS8vWFqP55myOp50unfu6GOYYoKajQLSDypCzBBlJKtVTxp oAVFpbAFz3vw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="417064275" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 27 Mar 2021 15:20:13 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id EB6C26F1; Sun, 28 Mar 2021 00:20:27 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Daniel Scally , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Yong Zhi , Sakari Ailus , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Heikki Krogerus Subject: [PATCH v1 4/8] software node: Deduplicate code in fwnode_create_software_node() Date: Sun, 28 Mar 2021 00:20:08 +0200 Message-Id: <20210327222012.54103-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> References: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Deduplicate conditional and assignment in fwnode_create_software_node(), i.e. parent is checked in two out of three cases and parent software node is assigned by to_swnode() call. Signed-off-by: Andy Shevchenko --- drivers/base/swnode.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index d7fe1a887d2d..22f81688af2c 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -1100,15 +1100,14 @@ fwnode_create_software_node(const struct property_entry *properties, { struct fwnode_handle *fwnode; struct software_node *node; - struct swnode *p = NULL; - - if (parent) { - if (IS_ERR(parent)) - return ERR_CAST(parent); - if (!is_software_node(parent)) - return ERR_PTR(-EINVAL); - p = to_swnode(parent); - } + struct swnode *p; + + if (IS_ERR(parent)) + return ERR_CAST(parent); + + p = to_swnode(parent); + if (parent && !p) + return ERR_PTR(-EINVAL); node = software_node_alloc(properties); if (IS_ERR(node)) From patchwork Sat Mar 27 22:20:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12168681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B8BBC43381 for ; Sat, 27 Mar 2021 22:21:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C024619C9 for ; Sat, 27 Mar 2021 22:21:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231240AbhC0WUm (ORCPT ); Sat, 27 Mar 2021 18:20:42 -0400 Received: from mga14.intel.com ([192.55.52.115]:65376 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231190AbhC0WUR (ORCPT ); Sat, 27 Mar 2021 18:20:17 -0400 IronPort-SDR: D53/jTRqBiC8KHfLxdTKpY0b0HvldNRYeVdVpdN+2mdgwwItW3UmEP7DJgFqOdW+gi/e4FbY/y Fqhdoqlb5YzQ== X-IronPort-AV: E=McAfee;i="6000,8403,9936"; a="190792947" X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="190792947" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2021 15:20:16 -0700 IronPort-SDR: 5DfQiHwmGsP7+A7jagnJtH2O2k9EIk8wQElRcu5zLIITcLtIGtySJgxt+NcWLaU5zxGLyti+F3 Rvybxj7xrn6w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="594591279" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 27 Mar 2021 15:20:13 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0110ECC4; Sun, 28 Mar 2021 00:20:27 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Daniel Scally , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Yong Zhi , Sakari Ailus , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Heikki Krogerus Subject: [PATCH v1 5/8] software node: Imply kobj_to_swnode() to be no-op Date: Sun, 28 Mar 2021 00:20:09 +0200 Message-Id: <20210327222012.54103-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> References: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Since we don't use structure field layout randomization the manual shuffling can affect some macros, in particular kobj_to_swnode(), which becomes a no-op when kobj member is the first one in the struct swnode. Bloat-o-meter statistics: add/remove: 0/0 grow/shrink: 2/10 up/down: 9/-100 (-91) Total: Before=7217, After=7126, chg -1.26% Signed-off-by: Andy Shevchenko --- drivers/base/swnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 22f81688af2c..ae53c48f84b1 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -13,10 +13,10 @@ #include struct swnode { - int id; struct kobject kobj; struct fwnode_handle fwnode; const struct software_node *node; + int id; /* properties in sysfs */ struct kobj_attribute *property_attrs; From patchwork Sat Mar 27 22:20:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12168671 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 336CBC433EA for ; Sat, 27 Mar 2021 22:21:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0566661999 for ; Sat, 27 Mar 2021 22:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231265AbhC0WUo (ORCPT ); Sat, 27 Mar 2021 18:20:44 -0400 Received: from mga14.intel.com ([192.55.52.115]:65376 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231195AbhC0WUU (ORCPT ); Sat, 27 Mar 2021 18:20:20 -0400 IronPort-SDR: Q7Ero3yrRke3CGQyaRc7UAtqiJhfTfddVO3lbdCc7cuR/xNSU7w8StPBvJnwadObDS7jBtXHZv MNi6m0VqI6hQ== X-IronPort-AV: E=McAfee;i="6000,8403,9936"; a="190792953" X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="190792953" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2021 15:20:20 -0700 IronPort-SDR: LhG7xf+BuoyNl4R4hy8jxmugAsxSSOE8VsQgak4lujKzEqWNii4HddQ+TONzEADfJsGOn9JkMi MO7VYCMrzlUg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="605906453" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 27 Mar 2021 15:20:17 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0B0D9CDD; Sun, 28 Mar 2021 00:20:28 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Daniel Scally , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Yong Zhi , Sakari Ailus , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Heikki Krogerus Subject: [PATCH v1 6/8] software node: Simplify swnode_register() a bit Date: Sun, 28 Mar 2021 00:20:10 +0200 Message-Id: <20210327222012.54103-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> References: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org By introducing two temporary variables simplify swnode_register() a bit. No functional change intended. Signed-off-by: Andy Shevchenko --- drivers/base/swnode.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index ae53c48f84b1..1e81aaf5f6a1 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -894,6 +894,8 @@ static struct fwnode_handle * swnode_register(const struct software_node *node, struct swnode *parent, unsigned int allocated) { + struct ida *ids = parent ? &parent->child_ids : &swnode_root_ids; + struct kobject *kobj_parent = parent ? &parent->kobj : NULL; struct swnode *swnode; int ret; @@ -901,8 +903,7 @@ swnode_register(const struct software_node *node, struct swnode *parent, if (!swnode) return ERR_PTR(-ENOMEM); - ret = ida_simple_get(parent ? &parent->child_ids : &swnode_root_ids, - 0, 0, GFP_KERNEL); + ret = ida_simple_get(ids, 0, 0, GFP_KERNEL); if (ret < 0) { kfree(swnode); return ERR_PTR(ret); @@ -920,12 +921,10 @@ swnode_register(const struct software_node *node, struct swnode *parent, if (node->name) ret = kobject_init_and_add(&swnode->kobj, &software_node_type, - parent ? &parent->kobj : NULL, - "%s", node->name); + kobj_parent, "%s", node->name); else ret = kobject_init_and_add(&swnode->kobj, &software_node_type, - parent ? &parent->kobj : NULL, - "node%d", swnode->id); + kobj_parent, "node%d", swnode->id); if (ret) { kobject_put(&swnode->kobj); return ERR_PTR(ret); From patchwork Sat Mar 27 22:20:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12168677 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4C79C433F1 for ; Sat, 27 Mar 2021 22:21:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 86F3C619E4 for ; Sat, 27 Mar 2021 22:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231293AbhC0WUp (ORCPT ); Sat, 27 Mar 2021 18:20:45 -0400 Received: from mga03.intel.com ([134.134.136.65]:17399 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230487AbhC0WUV (ORCPT ); Sat, 27 Mar 2021 18:20:21 -0400 IronPort-SDR: jk0J+ETNiFr24/iBYFTzMup16JU+HRFbSmfBDJmZo9vZEZ9l4TVOXdUmwBC3AOBiQO/C6uRR9I hfK+CoDrw8NQ== X-IronPort-AV: E=McAfee;i="6000,8403,9936"; a="191370247" X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="191370247" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2021 15:20:20 -0700 IronPort-SDR: 0fvhwCC9+0j/t7nQJoBLlVBy4I8mEvnIy94rHmIXlyeQntd0Fz5xnnF/GbbQSAzeDhyMwCMRAv 8NXPr6RGJsRw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="515505908" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 27 Mar 2021 15:20:17 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 143DB10B0; Sun, 28 Mar 2021 00:20:28 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Daniel Scally , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Yong Zhi , Sakari Ailus , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Heikki Krogerus Subject: [PATCH v1 7/8] software node: Introduce SOFTWARE_NODE_REFERENCE() helper macro Date: Sun, 28 Mar 2021 00:20:11 +0200 Message-Id: <20210327222012.54103-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> References: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This is useful to assign software node reference with arguments in a common way. Moreover, we have already couple of users that may be converted. And by the fact, one of them is moved right here to use the helper. Signed-off-by: Andy Shevchenko --- drivers/base/test/property-entry-test.c | 11 ++--------- include/linux/property.h | 13 ++++++++----- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/base/test/property-entry-test.c b/drivers/base/test/property-entry-test.c index abe03315180f..c2e455d46ffd 100644 --- a/drivers/base/test/property-entry-test.c +++ b/drivers/base/test/property-entry-test.c @@ -370,15 +370,8 @@ static void pe_test_reference(struct kunit *test) }; static const struct software_node_ref_args refs[] = { - { - .node = &nodes[0], - .nargs = 0, - }, - { - .node = &nodes[1], - .nargs = 2, - .args = { 3, 4 }, - }, + SOFTWARE_NODE_REFERENCE(&nodes[0]), + SOFTWARE_NODE_REFERENCE(&nodes[1], 3, 4), }; const struct property_entry entries[] = { diff --git a/include/linux/property.h b/include/linux/property.h index dd4687b56239..0d876316e61d 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -254,6 +254,13 @@ struct software_node_ref_args { u64 args[NR_FWNODE_REFERENCE_ARGS]; }; +#define SOFTWARE_NODE_REFERENCE(_ref_, ...) \ +(const struct software_node_ref_args) { \ + .node = _ref_, \ + .nargs = ARRAY_SIZE(((u64[]){ 0, ##__VA_ARGS__ })) - 1, \ + .args = { __VA_ARGS__ }, \ +} + /** * struct property_entry - "Built-in" device property representation. * @name: Name of the property. @@ -362,11 +369,7 @@ struct property_entry { .name = _name_, \ .length = sizeof(struct software_node_ref_args), \ .type = DEV_PROP_REF, \ - { .pointer = &(const struct software_node_ref_args) { \ - .node = _ref_, \ - .nargs = ARRAY_SIZE(((u64[]){ 0, ##__VA_ARGS__ })) - 1, \ - .args = { __VA_ARGS__ }, \ - } }, \ + { .pointer = &SOFTWARE_NODE_REFERENCE(_ref_, ##__VA_ARGS__), }, \ } struct property_entry * From patchwork Sat Mar 27 22:20:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12168683 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C38D7C433F7 for ; Sat, 27 Mar 2021 22:21:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2D26619E8 for ; Sat, 27 Mar 2021 22:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231281AbhC0WUo (ORCPT ); Sat, 27 Mar 2021 18:20:44 -0400 Received: from mga06.intel.com ([134.134.136.31]:3289 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231197AbhC0WUV (ORCPT ); Sat, 27 Mar 2021 18:20:21 -0400 IronPort-SDR: gPvA/MrXRu/6HY7200wvHED6r8hEkLfdZVo1ntczuLZ4PYOXHUhSrvyvnQ5/Gq9EY/0qiqiJul UDLh3oV202aw== X-IronPort-AV: E=McAfee;i="6000,8403,9936"; a="252690862" X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="252690862" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2021 15:20:20 -0700 IronPort-SDR: 12VvtQS48zmeJGUefaQrhNWO/GGZlYVIEZisJRhrGrEMfhfrYy+H4IjnxTJFnJ0hBI9Mt0W15O dmu4GKxNHsrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,284,1610438400"; d="scan'208";a="454002272" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 27 Mar 2021 15:20:17 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1D59710D1; Sun, 28 Mar 2021 00:20:28 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Daniel Scally , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Yong Zhi , Sakari Ailus , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Heikki Krogerus Subject: [PATCH v1 8/8] media: ipu3-cio2: Switch to use SOFTWARE_NODE_REFERENCE() Date: Sun, 28 Mar 2021 00:20:12 +0200 Message-Id: <20210327222012.54103-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> References: <20210327222012.54103-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This is useful to assign software node reference with arguments in a common way. Switch to use SOFTWARE_NODE_REFERENCE() here. Signed-off-by: Andy Shevchenko --- drivers/media/pci/intel/ipu3/cio2-bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/intel/ipu3/cio2-bridge.c b/drivers/media/pci/intel/ipu3/cio2-bridge.c index c2199042d3db..e8511787c1e4 100644 --- a/drivers/media/pci/intel/ipu3/cio2-bridge.c +++ b/drivers/media/pci/intel/ipu3/cio2-bridge.c @@ -79,8 +79,8 @@ static void cio2_bridge_create_fwnode_properties( { sensor->prop_names = prop_names; - sensor->local_ref[0].node = &sensor->swnodes[SWNODE_CIO2_ENDPOINT]; - sensor->remote_ref[0].node = &sensor->swnodes[SWNODE_SENSOR_ENDPOINT]; + sensor->local_ref[0] = SOFTWARE_NODE_REFERENCE(&sensor->swnodes[SWNODE_CIO2_ENDPOINT]); + sensor->remote_ref[0] = SOFTWARE_NODE_REFERENCE(&sensor->swnodes[SWNODE_SENSOR_ENDPOINT]); sensor->dev_properties[0] = PROPERTY_ENTRY_U32( sensor->prop_names.clock_frequency,