From patchwork Wed Dec 28 09:49:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 637519 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95079C53210 for ; Wed, 28 Dec 2022 09:49:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232827AbiL1JtU (ORCPT ); Wed, 28 Dec 2022 04:49:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232729AbiL1JtG (ORCPT ); Wed, 28 Dec 2022 04:49:06 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1FFBDF11; Wed, 28 Dec 2022 01:49:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672220945; x=1703756945; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w2JXJ456fPTH56W24+qfmXMA6Zjmitv++M814MxKvZo=; b=Ro/xMF2uMVbbagGnMb0uMZ3xTozLXguu0qR/Ra61Oi39HeM5ZJ5+3cM3 oJzt3jTBLh3lERZWRyaN2M4dEWRhW0Pt26klG25Ob4t3oEY5P22Tjew5N PiyzOPg5j+K8p3Gf3EQps1wTgRqXXfI0OzSa0TE3S0f78HTKSEX+rerIa 7u48IqViRzyd9h6LY62vyR2FR9uWIYSkL7d+P59KQBp8N4A0xiBv4fCLX GM1XM6LVTOt5ZMinwctDN8HnzmMLPEbJ3ObPUYc36lRWVItRKOKBHf6DE 5LldWMVEukO/uM+GtYJ1xuVQHVZDQw8kjXP+TdvnWjW1eOITHKyoyrBA1 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="385266796" X-IronPort-AV: E=Sophos;i="5.96,280,1665471600"; d="scan'208";a="385266796" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2022 01:49:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="603291133" X-IronPort-AV: E=Sophos;i="5.96,280,1665471600"; d="scan'208";a="603291133" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 28 Dec 2022 01:48:58 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id DB7AE19E; Wed, 28 Dec 2022 11:49:29 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , Sakari Ailus , Heikki Krogerus , Andy Shevchenko , Daniel Scally , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: "Rafael J. Wysocki" , Yong Zhi , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Daniel Scally Subject: [PATCH v3 2/4] media: ipu3-cio2: Convert to use software_node_register_node_group() Date: Wed, 28 Dec 2022 11:49:20 +0200 Message-Id: <20221228094922.84119-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221228094922.84119-1-andriy.shevchenko@linux.intel.com> References: <20221228094922.84119-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The currently used software_node_register_nodes() is going to be removed. Prepare driver by switching to a new API. Signed-off-by: Andy Shevchenko Acked-by: Sakari Ailus Tested-by: Daniel Scally Acked-by: Heikki Krogerus Reviewed-by: Daniel Scally --- drivers/media/pci/intel/ipu3/cio2-bridge.c | 21 ++++++++++++++++++--- drivers/media/pci/intel/ipu3/cio2-bridge.h | 5 +++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/media/pci/intel/ipu3/cio2-bridge.c b/drivers/media/pci/intel/ipu3/cio2-bridge.c index 18974a72e94a..dfefe0d8aa95 100644 --- a/drivers/media/pci/intel/ipu3/cio2-bridge.c +++ b/drivers/media/pci/intel/ipu3/cio2-bridge.c @@ -195,6 +195,19 @@ static void cio2_bridge_init_swnode_names(struct cio2_sensor *sensor) SWNODE_GRAPH_ENDPOINT_NAME_FMT, 0); /* And endpoint 0 */ } +static void cio2_bridge_init_swnode_group(struct cio2_sensor *sensor) +{ + struct software_node *nodes = sensor->swnodes; + + sensor->group[SWNODE_SENSOR_HID] = &nodes[SWNODE_SENSOR_HID]; + sensor->group[SWNODE_SENSOR_PORT] = &nodes[SWNODE_SENSOR_PORT]; + sensor->group[SWNODE_SENSOR_ENDPOINT] = &nodes[SWNODE_SENSOR_ENDPOINT]; + sensor->group[SWNODE_CIO2_PORT] = &nodes[SWNODE_CIO2_PORT]; + sensor->group[SWNODE_CIO2_ENDPOINT] = &nodes[SWNODE_CIO2_ENDPOINT]; + if (sensor->ssdb.vcmtype) + sensor->group[SWNODE_VCM] = &nodes[SWNODE_VCM]; +} + static void cio2_bridge_create_connection_swnodes(struct cio2_bridge *bridge, struct cio2_sensor *sensor) { @@ -219,6 +232,8 @@ static void cio2_bridge_create_connection_swnodes(struct cio2_bridge *bridge, if (sensor->ssdb.vcmtype) nodes[SWNODE_VCM] = NODE_VCM(cio2_vcm_types[sensor->ssdb.vcmtype - 1]); + + cio2_bridge_init_swnode_group(sensor); } static void cio2_bridge_instantiate_vcm_i2c_client(struct cio2_sensor *sensor) @@ -252,7 +267,7 @@ static void cio2_bridge_unregister_sensors(struct cio2_bridge *bridge) for (i = 0; i < bridge->n_sensors; i++) { sensor = &bridge->sensors[i]; - software_node_unregister_nodes(sensor->swnodes); + software_node_unregister_node_group(sensor->group); ACPI_FREE(sensor->pld); acpi_dev_put(sensor->adev); i2c_unregister_device(sensor->vcm_i2c_client); @@ -310,7 +325,7 @@ static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg, cio2_bridge_create_fwnode_properties(sensor, bridge, cfg); cio2_bridge_create_connection_swnodes(bridge, sensor); - ret = software_node_register_nodes(sensor->swnodes); + ret = software_node_register_node_group(sensor->group); if (ret) goto err_free_pld; @@ -337,7 +352,7 @@ static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg, return 0; err_free_swnodes: - software_node_unregister_nodes(sensor->swnodes); + software_node_unregister_node_group(sensor->group); err_free_pld: ACPI_FREE(sensor->pld); err_put_adev: diff --git a/drivers/media/pci/intel/ipu3/cio2-bridge.h b/drivers/media/pci/intel/ipu3/cio2-bridge.h index 4418cbd08208..b93b749c65bd 100644 --- a/drivers/media/pci/intel/ipu3/cio2-bridge.h +++ b/drivers/media/pci/intel/ipu3/cio2-bridge.h @@ -117,8 +117,9 @@ struct cio2_sensor { struct acpi_device *adev; struct i2c_client *vcm_i2c_client; - /* SWNODE_COUNT + 1 for terminating empty node */ - struct software_node swnodes[SWNODE_COUNT + 1]; + /* SWNODE_COUNT + 1 for terminating NULL */ + const struct software_node *group[SWNODE_COUNT + 1]; + struct software_node swnodes[SWNODE_COUNT]; struct cio2_node_names node_names; struct cio2_sensor_ssdb ssdb; From patchwork Wed Dec 28 09:49:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 637518 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69C77C46467 for ; Wed, 28 Dec 2022 09:49:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232876AbiL1JtX (ORCPT ); Wed, 28 Dec 2022 04:49:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232734AbiL1JtH (ORCPT ); Wed, 28 Dec 2022 04:49:07 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72C00F01B; Wed, 28 Dec 2022 01:49:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672220946; x=1703756946; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+ozAS6yksRC8a62UTirV31SEjQ8EBsV6SC/XfQ+AkkA=; b=UZdhzyyHMy/MsyrFmgyatPqdRrvUYqG6Rt4PTzzv9UJ7CcfKRa5mEEF0 UZXeNg8dUOPXS+ADr3EaQq2EeBVqXj3nm++cB6nhKrikcMjE/SpF1bXAS mK5b9YjBjdIuXHezjcaSSrKe53ZqN1xw7AMwPfebIQp0zLj/bZA0SUbwA 4+rymtiDmh1fmGaTfbOFIL0btXqNUWbn1w5dHkJGeli2v1qQ8GOa7cY+V 7nR587SpiWXvjO9GVDjBSzw47Jq7r7koSlkR407o+Eo/H0ZaufFHKXDnb k+tNjB4OOcaHZ1BoERJ6vKMwrTTbMU8bdlGdgLJeko1oHaGftFT4eMbd2 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="385266808" X-IronPort-AV: E=Sophos;i="5.96,280,1665471600"; d="scan'208";a="385266808" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2022 01:49:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="603291141" X-IronPort-AV: E=Sophos;i="5.96,280,1665471600"; d="scan'208";a="603291141" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 28 Dec 2022 01:49:00 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E8B04220; Wed, 28 Dec 2022 11:49:31 +0200 (EET) From: Andy Shevchenko To: Greg Kroah-Hartman , Sakari Ailus , Heikki Krogerus , Andy Shevchenko , Daniel Scally , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: "Rafael J. Wysocki" , Yong Zhi , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Daniel Scally Subject: [PATCH v3 4/4] software node: Remove unused APIs Date: Wed, 28 Dec 2022 11:49:22 +0200 Message-Id: <20221228094922.84119-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221228094922.84119-1-andriy.shevchenko@linux.intel.com> References: <20221228094922.84119-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are no more users of software_node_register_nodes() and software_node_unregister_nodes(). Remove them. Signed-off-by: Andy Shevchenko Acked-by: Greg Kroah-Hartman Acked-by: Sakari Ailus Tested-by: Daniel Scally Acked-by: Heikki Krogerus --- drivers/base/swnode.c | 61 ---------------------------------------- include/linux/property.h | 3 -- 2 files changed, 64 deletions(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 0a482212c7e8..da3c1c2cb9a8 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -819,67 +819,6 @@ swnode_register(const struct software_node *node, struct swnode *parent, return &swnode->fwnode; } -/** - * software_node_register_nodes - Register an array of software nodes - * @nodes: Zero terminated array of software nodes to be registered - * - * Register multiple software nodes at once. If any node in the array - * has its .parent pointer set (which can only be to another software_node), - * then its parent **must** have been registered before it is; either outside - * of this function or by ordering the array such that parent comes before - * child. - */ -int software_node_register_nodes(const struct software_node *nodes) -{ - int ret; - int i; - - for (i = 0; nodes[i].name; i++) { - const struct software_node *parent = nodes[i].parent; - - if (parent && !software_node_to_swnode(parent)) { - ret = -EINVAL; - goto err_unregister_nodes; - } - - ret = software_node_register(&nodes[i]); - if (ret) - goto err_unregister_nodes; - } - - return 0; - -err_unregister_nodes: - software_node_unregister_nodes(nodes); - return ret; -} -EXPORT_SYMBOL_GPL(software_node_register_nodes); - -/** - * software_node_unregister_nodes - Unregister an array of software nodes - * @nodes: Zero terminated array of software nodes to be unregistered - * - * Unregister multiple software nodes at once. If parent pointers are set up - * in any of the software nodes then the array **must** be ordered such that - * parents come before their children. - * - * NOTE: If you are uncertain whether the array is ordered such that - * parents will be unregistered before their children, it is wiser to - * remove the nodes individually, in the correct order (child before - * parent). - */ -void software_node_unregister_nodes(const struct software_node *nodes) -{ - unsigned int i = 0; - - while (nodes[i].name) - i++; - - while (i--) - software_node_unregister(&nodes[i]); -} -EXPORT_SYMBOL_GPL(software_node_unregister_nodes); - /** * software_node_register_node_group - Register a group of software nodes * @node_group: NULL terminated array of software node pointers to be registered diff --git a/include/linux/property.h b/include/linux/property.h index 37179e3abad5..1ffd4f9bb67b 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -486,9 +486,6 @@ const struct software_node * software_node_find_by_name(const struct software_node *parent, const char *name); -int software_node_register_nodes(const struct software_node *nodes); -void software_node_unregister_nodes(const struct software_node *nodes); - int software_node_register_node_group(const struct software_node **node_group); void software_node_unregister_node_group(const struct software_node **node_group);