From: Vinod Koul <vinod.koul@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.jf.intel.com>
Cc: linux-kernel@vger.kernel.org,
Viresh Kumar <viresh.kumar@linaro.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 04/10] dmatest: move dmatest_channels and nr_channels to dmatest_info
Date: Tue, 5 Mar 2013 14:33:15 +0530 [thread overview]
Message-ID: <20130305090315.GC28136@intel.com> (raw)
In-Reply-To: <1362388174-3435-5-git-send-email-andriy.shevchenko@linux.intel.com>
On Mon, Mar 04, 2013 at 11:09:28AM +0200, Andy Shevchenko wrote:
> We don't need to have them global and later we would like to protect access to
> them as well.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/dma/dmatest.c | 29 ++++++++++++++++-------------
> 1 file changed, 16 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
> index 7f9e3cc..475a21a 100644
> --- a/drivers/dma/dmatest.c
> +++ b/drivers/dma/dmatest.c
> @@ -109,6 +109,7 @@ struct dmatest_chan {
> * @timeout: transfer timeout in msec, -1 for infinite timeout
> */
> struct dmatest_info {
> + /* Test parameters */
> unsigned int buf_size;
> char channel[20];
> char device[20];
> @@ -118,17 +119,14 @@ struct dmatest_info {
> unsigned int xor_sources;
> unsigned int pq_sources;
> int timeout;
> +
> + /* Internal state */
> + struct list_head channels;
> + unsigned int nr_channels;
> };
Ideally this should be folded into previous...
>
> static struct dmatest_info test_info;
>
> -/*
> - * These are protected by dma_list_mutex since they're only used by
> - * the DMA filter function callback
> - */
> -static LIST_HEAD(dmatest_channels);
> -static unsigned int nr_channels;
> -
> static bool dmatest_match_channel(struct dmatest_info *info,
> struct dma_chan *chan)
> {
> @@ -690,8 +688,8 @@ static int dmatest_add_channel(struct dmatest_info *info,
> pr_info("dmatest: Started %u threads using %s\n",
> thread_count, dma_chan_name(chan));
>
> - list_add_tail(&dtc->node, &dmatest_channels);
> - nr_channels++;
> + list_add_tail(&dtc->node, &info->channels);
> + info->nr_channels++;
>
> return 0;
> }
> @@ -725,7 +723,8 @@ static int run_threaded_test(struct dmatest_info *info)
> }
> } else
> break; /* no more channels available */
> - if (info->max_channels && nr_channels >= info->max_channels)
> + if (info->max_channels &&
> + info->nr_channels >= info->max_channels)
> break; /* we have all we need */
> }
> return err;
> @@ -736,14 +735,15 @@ static void stop_threaded_test(struct dmatest_info *info)
> struct dmatest_chan *dtc, *_dtc;
> struct dma_chan *chan;
>
> - list_for_each_entry_safe(dtc, _dtc, &dmatest_channels, node) {
> + list_for_each_entry_safe(dtc, _dtc, &info->channels, node) {
> list_del(&dtc->node);
> chan = dtc->chan;
> dmatest_cleanup_channel(dtc);
> - pr_debug("dmatest: dropped channel %s\n",
> - dma_chan_name(chan));
> + pr_debug("dmatest: dropped channel %s\n", dma_chan_name(chan));
> dma_release_channel(chan);
> }
> +
> + info->nr_channels = 0;
> }
>
> static int __init dmatest_init(void)
> @@ -752,6 +752,9 @@ static int __init dmatest_init(void)
>
> memset(info, 0, sizeof(*info));
>
> + INIT_LIST_HEAD(&info->channels);
> +
> + /* Set default parameters */
> info->buf_size = test_buf_size;
> strlcpy(info->channel, test_channel, sizeof(info->channel));
> strlcpy(info->device, test_device, sizeof(info->device));
> --
> 1.8.2.rc0.22.gb3600c3
>
next prev parent reply other threads:[~2013-03-05 9:28 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-04 9:09 [PATCH 00/10] dmatest: update the module to use debugfs Andy Shevchenko
2013-03-04 9:09 ` [PATCH 01/10] dmatest: cancel thread immediately when asked for Andy Shevchenko
2013-03-05 1:41 ` Viresh Kumar
2013-03-04 9:09 ` [PATCH 02/10] dmatest: allocate memory for pq_coefs from heap Andy Shevchenko
2013-03-05 1:43 ` Viresh Kumar
2013-03-04 9:09 ` [PATCH 03/10] dmatest: create dmatest_info to keep test parameters Andy Shevchenko
2013-03-05 1:47 ` Viresh Kumar
2013-03-04 9:09 ` [PATCH 04/10] dmatest: move dmatest_channels and nr_channels to dmatest_info Andy Shevchenko
2013-03-05 9:03 ` Vinod Koul [this message]
2013-03-05 9:12 ` Viresh Kumar
2013-03-05 9:19 ` Andy Shevchenko
2013-03-04 9:09 ` [PATCH 05/10] dmatest: split test parameters to separate structure Andy Shevchenko
2013-03-05 9:16 ` Viresh Kumar
2013-03-08 13:07 ` Andy Shevchenko
2013-03-04 9:09 ` [PATCH 06/10] dmatest: run test via debugfs Andy Shevchenko
2013-03-05 9:26 ` Vinod Koul
2013-03-05 10:36 ` Andy Shevchenko
2013-03-05 10:35 ` Vinod Koul
[not found] ` <CAHp75Vc6KmPQYjSx5m+gEBCe4g2tRgEPKyg4hZx9ytk99pB7Qw@mail.gmail.com>
[not found] ` <20130307061143.GD13370@intel.com>
2013-03-07 8:37 ` Andy Shevchenko
2013-03-04 9:09 ` [PATCH 07/10] dmatest: return actual state in 'run' file Andy Shevchenko
2013-03-04 9:09 ` [PATCH 08/10] dmatest: define MAX_ERROR_COUNT constant Andy Shevchenko
2013-03-04 9:09 ` [PATCH 09/10] dmatest: gather test results in the linked list Andy Shevchenko
2013-11-05 19:58 ` Dan Williams
2013-11-06 14:13 ` Andy Shevchenko
2013-11-06 18:11 ` Dan Williams
2013-11-07 14:37 ` Andy Shevchenko
2013-03-04 9:09 ` [PATCH 10/10] dmatest: append verify result to results Andy Shevchenko
2013-03-07 6:20 ` [PATCH 00/10] dmatest: update the module to use debugfs Vinod Koul
2013-03-08 13:11 ` Andy Shevchenko
2013-03-10 13:44 ` Viresh Kumar
2013-03-11 8:12 ` Andy Shevchenko
2013-03-21 5:11 ` Vinod Koul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130305090315.GC28136@intel.com \
--to=vinod.koul@intel.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.jf.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.