From patchwork Tue Jul 23 19:42:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11055241 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4572F6C5 for ; Tue, 23 Jul 2019 19:43:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D00B28718 for ; Tue, 23 Jul 2019 19:43:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CF2728714; Tue, 23 Jul 2019 19:43:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2F1A528714 for ; Tue, 23 Jul 2019 19:43:21 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 99E1D16B6; Tue, 23 Jul 2019 21:42:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 99E1D16B6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1563910999; bh=+s2ZnLCuV06+jWsGkTFKm85bQUiTt8fUnvCzq22BtFM=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=KDeZoxH91N3Py4BshS32r1/tdJJrAI9T4d3zTHHEgwkAFw9gl7SceUDuocd1HJgaq paIHsRUHRyvOqgFKJu3tNIWcp+1kAiEnDT715n1RFNAaflXGLc2rrcApCXn/Kmane2 IyiGEi3ihxGWgjEUZjTFM80ffNervTC0piprDbbU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 025F9F803D0; Tue, 23 Jul 2019 21:42:29 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id A3B8AF80447; Tue, 23 Jul 2019 21:42:27 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A33A9F8011C for ; Tue, 23 Jul 2019 21:42:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A33A9F8011C X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jul 2019 12:42:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,300,1559545200"; d="scan'208";a="368540096" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 23 Jul 2019 12:42:20 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8B4BB81; Tue, 23 Jul 2019 22:42:19 +0300 (EEST) From: Andy Shevchenko To: Vinod Koul , Sanyog Kale , Pierre-Louis Bossart , alsa-devel@alsa-project.org Date: Tue, 23 Jul 2019 22:42:18 +0300 Message-Id: <20190723194218.69168-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Cc: Andy Shevchenko Subject: [alsa-devel] [PATCH v1] soundwire: mipi_disco: Switch to use fwnode_property_count_uXX() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use use fwnode_property_count_uXX() directly, that makes code neater. Signed-off-by: Andy Shevchenko Reviewed-by: Pierre-Louis Bossart --- drivers/soundwire/mipi_disco.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/soundwire/mipi_disco.c b/drivers/soundwire/mipi_disco.c index 79fee1b21ab6..844e6b22974f 100644 --- a/drivers/soundwire/mipi_disco.c +++ b/drivers/soundwire/mipi_disco.c @@ -60,8 +60,7 @@ int sdw_master_read_prop(struct sdw_bus *bus) "mipi-sdw-max-clock-frequency", &prop->max_clk_freq); - nval = fwnode_property_read_u32_array(link, - "mipi-sdw-clock-frequencies-supported", NULL, 0); + nval = fwnode_property_count_u32(link, "mipi-sdw-clock-frequencies-supported"); if (nval > 0) { prop->num_clk_freq = nval; prop->clk_freq = devm_kcalloc(bus->dev, prop->num_clk_freq, @@ -87,8 +86,7 @@ int sdw_master_read_prop(struct sdw_bus *bus) } } - nval = fwnode_property_read_u32_array(link, - "mipi-sdw-supported-clock-gears", NULL, 0); + nval = fwnode_property_count_u32(link, "mipi-sdw-supported-clock-gears"); if (nval > 0) { prop->num_clk_gears = nval; prop->clk_gears = devm_kcalloc(bus->dev, prop->num_clk_gears, @@ -134,8 +132,7 @@ static int sdw_slave_read_dp0(struct sdw_slave *slave, fwnode_property_read_u32(port, "mipi-sdw-port-min-wordlength", &dp0->min_word); - nval = fwnode_property_read_u32_array(port, - "mipi-sdw-port-wordlength-configs", NULL, 0); + nval = fwnode_property_count_u32(port, "mipi-sdw-port-wordlength-configs"); if (nval > 0) { dp0->num_words = nval; @@ -193,8 +190,7 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, fwnode_property_read_u32(node, "mipi-sdw-port-min-wordlength", &dpn[i].min_word); - nval = fwnode_property_read_u32_array(node, - "mipi-sdw-port-wordlength-configs", NULL, 0); + nval = fwnode_property_count_u32(node, "mipi-sdw-port-wordlength-configs"); if (nval > 0) { dpn[i].num_words = nval; dpn[i].words = devm_kcalloc(&slave->dev, @@ -233,8 +229,7 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, fwnode_property_read_u32(node, "mipi-sdw-max-channel-number", &dpn[i].max_ch); - nval = fwnode_property_read_u32_array(node, - "mipi-sdw-channel-number-list", NULL, 0); + nval = fwnode_property_count_u32(node, "mipi-sdw-channel-number-list"); if (nval > 0) { dpn[i].num_ch = nval; dpn[i].ch = devm_kcalloc(&slave->dev, dpn[i].num_ch, @@ -248,8 +243,7 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, dpn[i].ch, dpn[i].num_ch); } - nval = fwnode_property_read_u32_array(node, - "mipi-sdw-channel-combination-list", NULL, 0); + nval = fwnode_property_count_u32(node, "mipi-sdw-channel-combination-list"); if (nval > 0) { dpn[i].num_ch_combinations = nval; dpn[i].ch_combinations = devm_kcalloc(&slave->dev,