lkml.org 
[lkml]   [2022]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v7 1/1] gpio: add sloppy logic analyzer using polling
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


\
 
 \ /
  Last update: 2022-03-21 14:53    [W:1.898 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site