From patchwork Mon Nov 21 15:27:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 23899 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1655702wrr; Mon, 21 Nov 2022 07:27:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf4NfRpZ2rZctV4YJee2cWHdSbqFCOPGlsgOykZajatXsaU7q3diZ0UtDpF991WN1Ndjk755 X-Received: by 2002:a63:1f65:0:b0:470:8e8d:44ae with SMTP id q37-20020a631f65000000b004708e8d44aemr2519749pgm.382.1669044448917; Mon, 21 Nov 2022 07:27:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669044448; cv=none; d=google.com; s=arc-20160816; b=R3QLQVO+ToveH7WSG3E5d8JwQigTgAcbfh/eW5F9QNTT3lOnM8qfueEjARHotxyDlh +1MM4ccOfUw0/pUXZ5VF3r8c1wjo+SXFtprP6cHlyeFIGyhr91AYworz1vc43bb/l9cx wMWdeXZWIhbpH2xk7JqkCUAXj0xd2B6R5f9Q+XlWX05+a+3itKONrWA+dF14QBZFCzMj om3pXb/6Tf/C7PBIZ5/yS9tIAC00fac7WIRcDpkiomgv94zp/AjGhNpqaXVuWMkmbn8f Jffqn3iZIR0IBfUWxgcSSOycEaqhBETwvox6nabqf9B75mTbYBAhokVzTZAqL0T3decJ WOyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JE81Tahksv1q2aA8yaDSOr6MRnzoKDf9jz4fp5MqU+o=; b=RVN3yunJMFMMwqo1vzaV7oLpPt83pR5KkIIMtsleMDmmK0CuVXePpcpc+ENPjO6HpO ACtOYWtLM8X+lnybswjnw/SUoPt0M9rdMsSEjNrANhTM5EhTc2RN6e5kq90tH39LE8M9 ummsJrEZNBSeerxdMn7RORcsgrCpzUGmPsVYNYPq30wJXglBOI2+6nfrUCEigi9bEf2A N+3qe4teCq5CbgIYEGOHFfwl2WC+E9CBIE5SSoHVV7oTUCXyTTwolk09W/t6gkjHTLc+ hXeNPQMgvZsXnYQPladsL37+sjWlDR2q7g+327Pc/dqOP2qMzR3iG6QX8ZJ7wmr7pCiu SLtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SXfRJwj4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f15-20020a170902ce8f00b00186b1459953si13079752plg.382.2022.11.21.07.27.14; Mon, 21 Nov 2022 07:27:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SXfRJwj4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232243AbiKUP0w (ORCPT + 99 others); Mon, 21 Nov 2022 10:26:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbiKUP0p (ORCPT ); Mon, 21 Nov 2022 10:26:45 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 279C62B8; Mon, 21 Nov 2022 07:26:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669044404; x=1700580404; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5TSvQT5+U3vvcJBcdLDzf8vC8Y35yVoLbaW0xTDEF8U=; b=SXfRJwj4TGc5cmbHcjKs/BCt/dNXXlAzwn3e9oeIhecDQxS3VMIQyNJR cIHRcWDw2fTK6juOZ67jzdaNa/8L/y9HJKoKBoy4ECyX0C2OFna7SFVha nwGDBhd3l4SW9j0TG66IblEpYEn7KzEBjr84AQRFkeIa/wiQd372fL5yg 1i07++ds6sMkbY7Uwk573ACDumQ9lYDyFvZXz+X+RaNenL7QuLr+Kq4dR TlLxhmtHc2JrfIrAFq+QVrwaaoCx6yXLpQbFwhuzRJj8kn4twbfo97A5b I3nnEMOB2sHELEBNeq1NsMLPg9CrJbKLUUqnkd/PjkZKi8JFEVg/5xYfc w==; X-IronPort-AV: E=McAfee;i="6500,9779,10538"; a="296941338" X-IronPort-AV: E=Sophos;i="5.96,181,1665471600"; d="scan'208";a="296941338" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2022 07:26:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10538"; a="635213958" X-IronPort-AV: E=Sophos;i="5.96,181,1665471600"; d="scan'208";a="635213958" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 21 Nov 2022 07:26:39 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 387B884; Mon, 21 Nov 2022 17:27:05 +0200 (EET) From: Andy Shevchenko To: Heikki Krogerus , =?utf-8?b?Q2zDqW1l?= =?utf-8?b?bnQgTMOpZ2Vy?= , Andy Shevchenko , Mauro Carvalho Chehab , Daniel Scally , Sakari Ailus , Hans de Goede , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Yong Zhi , Bingbu Cao , Tianshu Qiu , Daniel Scally Subject: [PATCH v2 2/4] media: ipu3-cio2: Convert to use software_node_register_node_group() Date: Mon, 21 Nov 2022 17:27:02 +0200 Message-Id: <20221121152704.30180-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221121152704.30180-1-andriy.shevchenko@linux.intel.com> References: <20221121152704.30180-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750119952178730628?= X-GMAIL-MSGID: =?utf-8?q?1750119952178730628?= 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 Tested-by: Daniel Scally Acked-by: Heikki Krogerus Reviewed-by: Daniel Scally --- v2: added tags (Heikki, Daniel) 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;