Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp162405ybi; Fri, 26 Jul 2019 07:44:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqedBGescjPQggkdEdysyuqw8w1Cq70h3giLS5AXFCfyCbE0D1kufTHdVgV9kzz+xWYjw9 X-Received: by 2002:a17:902:2b8a:: with SMTP id l10mr96422906plb.283.1564152299720; Fri, 26 Jul 2019 07:44:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564152299; cv=none; d=google.com; s=arc-20160816; b=myH1v7TLWzM4R3lGlkG8mtbWiIGtTaSDvq31DvTNADMgAiNka7B90rQTjz5iLqPcRE zUAZ5IIma0yeWbzk9e9yvPDUZIKBPbywATPSQhuOXpZ4IDXfK2ce7D/vnKEwUfRTbNBB 3+tW5WI2mgEve9v8AAOZBrSN3EJ8/2EavFeEixfKMEskyQy86vLbJH5iKW7A0Oq9M5Sl 04RtA9eugXNWSPrWvc70z4NeX7aZ6O3p+5BDAKY8bs7KtwdilKZSTNme7wdEYpcN2jD1 gNuuwpkdnMEx7SgzMntJcP6KujLgiuyoti/+Nj7gnBmXxjXf9qV39m9sw4epzv8XY6lH tB9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=jmQ2xsIeQwvj69CMKcRGtgin55FI3gx63M/aKR4Z9zo=; b=NcK1UI2sxBvKxqZRW6yxvfi4ViSkM08jCV9L2zuJBsbMMZFIGdgmdBEq70b4+ouSCk BvF8/zFU/VhqCHcY0grSsnboFgfREn35pRIb4Q54um0KBroaZOzcDUMepkqbVYJvx9sm MwvDMK4eCjWN4C8yiBWwZJGeGU+3rEP8+Jas2Dgu8SO8ZLy92uwhGX4tyH/OMAUDKYry nhldxJ/9W1O0OWDl8TbpyL5VcBQp+oxics8dx0+xOK0PeJCId6C0kcm/9DcboNA8Ucxn VYttmRjs9khob/huUr2LNUoi+BysXfS8Y8kgWPsl3DxH3S/8SE8uvIfBfg2A0nXxFPkt oAwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4si6005868pgh.434.2019.07.26.07.44.44; Fri, 26 Jul 2019 07:44:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727921AbfGZOna (ORCPT + 99 others); Fri, 26 Jul 2019 10:43:30 -0400 Received: from mga17.intel.com ([192.55.52.151]:29269 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbfGZOn3 (ORCPT ); Fri, 26 Jul 2019 10:43:29 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jul 2019 07:43:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,311,1559545200"; d="scan'208";a="369551174" Received: from gliakhov-mobl2.ger.corp.intel.com (HELO ubuntu) ([10.249.35.244]) by fmsmga005.fm.intel.com with ESMTP; 26 Jul 2019 07:43:27 -0700 Date: Fri, 26 Jul 2019 16:43:25 +0200 From: Guennadi Liakhovetski To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, tiwai@suse.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, slawomir.blauciak@intel.com, Sanyog Kale Subject: Re: [alsa-devel] [RFC PATCH 21/40] soundwire: export helpers to find row and column values Message-ID: <20190726144325.GH16003@ubuntu> References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> <20190725234032.21152-22-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190725234032.21152-22-pierre-louis.bossart@linux.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 25, 2019 at 06:40:13PM -0500, Pierre-Louis Bossart wrote: > Add a prefix for common tables and export 2 helpers to set the frame > shapes based on row/col values. > > Signed-off-by: Pierre-Louis Bossart > --- > drivers/soundwire/bus.h | 7 +++++-- > drivers/soundwire/stream.c | 14 ++++++++------ > 2 files changed, 13 insertions(+), 8 deletions(-) > > diff --git a/drivers/soundwire/bus.h b/drivers/soundwire/bus.h > index 06ac4adb0074..c57c9c23f6ca 100644 > --- a/drivers/soundwire/bus.h > +++ b/drivers/soundwire/bus.h > @@ -73,8 +73,11 @@ struct sdw_msg { > > #define SDW_DOUBLE_RATE_FACTOR 2 > > -extern int rows[SDW_FRAME_ROWS]; > -extern int cols[SDW_FRAME_COLS]; > +extern int sdw_rows[SDW_FRAME_ROWS]; > +extern int sdw_cols[SDW_FRAME_COLS]; So these arrays actually have to be exported? In the current (5.2) sources they seem to only be used in stream.c, maybe make them static there? > + > +int sdw_find_row_index(int row); > +int sdw_find_col_index(int col); > > /** > * sdw_port_runtime: Runtime port parameters for Master or Slave > diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c > index a0476755a459..53f5e790fcd7 100644 > --- a/drivers/soundwire/stream.c > +++ b/drivers/soundwire/stream.c > @@ -21,37 +21,39 @@ > * The rows are arranged as per the array index value programmed > * in register. The index 15 has dummy value 0 in order to fill hole. > */ > -int rows[SDW_FRAME_ROWS] = {48, 50, 60, 64, 75, 80, 125, 147, > +int sdw_rows[SDW_FRAME_ROWS] = {48, 50, 60, 64, 75, 80, 125, 147, > 96, 100, 120, 128, 150, 160, 250, 0, > 192, 200, 240, 256, 72, 144, 90, 180}; > > -int cols[SDW_FRAME_COLS] = {2, 4, 6, 8, 10, 12, 14, 16}; > +int sdw_cols[SDW_FRAME_COLS] = {2, 4, 6, 8, 10, 12, 14, 16}; > > -static int sdw_find_col_index(int col) > +int sdw_find_col_index(int col) > { > int i; > > for (i = 0; i < SDW_FRAME_COLS; i++) { > - if (cols[i] == col) > + if (sdw_cols[i] == col) > return i; > } > > pr_warn("Requested column not found, selecting lowest column no: 2\n"); > return 0; > } > +EXPORT_SYMBOL(sdw_find_col_index); > > -static int sdw_find_row_index(int row) > +int sdw_find_row_index(int row) > { > int i; > > for (i = 0; i < SDW_FRAME_ROWS; i++) { > - if (rows[i] == row) > + if (sdw_rows[i] == row) > return i; > } > > pr_warn("Requested row not found, selecting lowest row no: 48\n"); > return 0; > } > +EXPORT_SYMBOL(sdw_find_row_index); > > static int _sdw_program_slave_port_params(struct sdw_bus *bus, > struct sdw_slave *slave, > -- > 2.20.1 > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel