mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v7 1/1] gpio: add sloppy logic analyzer using polling
Date: Mon, 21 Mar 2022 15:51:36 +0200	[thread overview]
Message-ID: <YjiC6Lg5k5gK/BfP@smile.fi.intel.com> (raw)
In-Reply-To: <20220317085019.3987-2-wsa+renesas@sang-engineering.com>

On Thu, Mar 17, 2022 at 09:50:19AM +0100, Wolfram Sang wrote:
> This is a sloppy logic analyzer using GPIOs. It comes with a script to
> isolate a CPU for polling. While this is definitely not a production
> level analyzer, it can be a helpful first view when remote debugging.
> Read the documentation for details.

...

> +	for (i = 0; i < priv->trig_len; i+= 2) {

Missed space.

> +		do {
> +			ret = gpio_la_get_array(priv->descs, &state);
> +			if (ret)
> +				goto out;
> +
> +			ndelay(delay);
> +		} while ((state & priv->trig_data[i]) != priv->trig_data[i + 1]);
> +	}

...

> +static int fops_buf_size_set(void *data, u64 val)
> +{
> +	struct gpio_la_poll_priv *priv = data;

> +	int ret = 0;

Instead of this assignment and other related things, can we do the following?

> +	void *p;
> +
> +	if (!val)
> +		return -EINVAL;
> +
> +	mutex_lock(&priv->lock);
> +
> +	vfree(priv->blob.data);

	priv->blob.data = NULL;
	priv->blob.size = 0;

> +	p = vzalloc(val);
> +	if (!p) {
> +		val = 0;
> +		ret = -ENOMEM;
> +	}

	p = vzalloc(val);
	if (!p)
		return -ENOMEM;

> +	priv->blob.data = p;
> +	priv->blob.size = val;
> +
> +	mutex_unlock(&priv->lock);
> +	return ret;
> +}
> +DEFINE_DEBUGFS_ATTRIBUTE(fops_buf_size, fops_buf_size_get, fops_buf_size_set, "%llu\n");

> +	priv->trig_data = buf;
> +	priv->trig_len = count;
> +
> +	return count;
> +}
> +
> +static const struct file_operations fops_trigger = {
> +	.owner = THIS_MODULE,
> +	.open = trigger_open,
> +	.write = trigger_write,
> +	.llseek = no_llseek,
> +	.release = single_release,
> +};

Can it be wrapped by DEFINE_SHOW_ATTRIBUTE()?

...

> +	dev_info(dev, "initialized");

Not sure how this one would be helpful.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2022-03-21 13:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17  8:50 [PATCH v7 0/1] gpio: add simple " Wolfram Sang
2022-03-17  8:50 ` [PATCH v7 1/1] gpio: add sloppy " Wolfram Sang
2022-03-21 13:51   ` Andy Shevchenko [this message]
2022-03-28  9:37     ` Wolfram Sang
2022-03-28 10:49       ` Andy Shevchenko
2022-03-28 12:19         ` Wolfram Sang
2022-03-28 12:51           ` Andy Shevchenko

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=YjiC6Lg5k5gK/BfP@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®