linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Smirl <jonsmirl@gmail.com>
To: Greg KH <greg@kroah.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-input@vger.kernel.org
Subject: Re: [IR-RFC PATCH v4 2/6] Core IR module
Date: Sun, 29 Nov 2009 12:41:22 -0500	[thread overview]
Message-ID: <9e4733910911290941o761a4dfhf4168e573c6b6e89@mail.gmail.com> (raw)
In-Reply-To: <20091129171726.GB4993@kroah.com>

On Sun, Nov 29, 2009 at 12:17 PM, Greg KH <greg@kroah.com> wrote:
>> +static ssize_t ir_raw_show(struct device *dev,
>> +                              struct device_attribute *attr, char *buf)
>> +{
>> +     struct input_dev *input_dev = to_input_dev(dev);
>> +     unsigned int i, count = 0;
>> +
>> +     for (i = input_dev->ir->raw.tail; i != input_dev->ir->raw.head; ) {
>> +
>> +             count += snprintf(&buf[count], PAGE_SIZE - 1, "%i\n", input_dev->ir->raw.buffer[i++]);
>> +             if (i > ARRAY_SIZE(input_dev->ir->raw.buffer))
>> +                     i = 0;
>> +             if (count >= PAGE_SIZE - 1) {
>> +                     input_dev->ir->raw.tail = i;
>> +                     return PAGE_SIZE - 1;
>> +             }
>> +     }
>> +     input_dev->ir->raw.tail = i;
>> +     return count;
>> +}
>
> This looks like it violates the "one value per sysfs file" rule that we
> have.  What exactly are you outputting here?  It does not look like this
> belongs in sysfs at all.

It should be on a debug switch or maybe a debug device. If the rest of
the system is working right you shouldn't need this data.

>
>> +static ssize_t ir_raw_store(struct device *dev,
>> +                               struct device_attribute *attr,
>> +                               const char *buf,
>> +                               size_t count)
>> +{
>> +     struct ir_device *ir = to_input_dev(dev)->ir;
>> +     long delta;
>> +     int i = count;
>> +     int first = 0;
>> +
>> +     if (!ir->xmit)
>> +             return count;
>> +     ir->send.count = 0;
>> +
>> +     while (i > 0) {
>> +             i -= strict_strtoul(&buf[i], i, &delta);
>> +             while ((buf[i] != '\n') && (i > 0))
>> +                     i--;
>> +             i--;
>> +             /* skip leading zeros */
>> +             if ((delta > 0) && !first)
>> +                     continue;
>> +
>> +             ir->send.buffer[ir->send.count++] = abs(delta);
>> +     }
>> +
>> +     ir->xmit(ir->private, ir->send.buffer, ir->send.count, ir->raw.carrier, ir->raw.xmitter);
>> +
>> +     return count;
>> +}
>
> What type of data are you expecting here?  More than one value?
>
> thanks,
>
> greg k-h
>



-- 
Jon Smirl
jonsmirl@gmail.com

  reply	other threads:[~2009-11-29 17:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-27  1:34 [IR-RFC PATCH v4 0/6] In-kernel IR support using evdev Jon Smirl
2009-11-27  1:34 ` [IR-RFC PATCH v4 1/6] Minimal changes to the core input system Jon Smirl
2009-11-27  1:34 ` [IR-RFC PATCH v4 2/6] Core IR module Jon Smirl
2009-11-29 17:14   ` Greg KH
2009-11-29 17:37     ` Jon Smirl
2009-11-29 19:09       ` Greg KH
2009-11-29 17:17   ` Greg KH
2009-11-29 17:41     ` Jon Smirl [this message]
2009-11-29 19:09       ` Greg KH
2009-11-27  1:34 ` [IR-RFC PATCH v4 3/6] Configfs support for IR Jon Smirl
2009-11-27  1:34 ` [IR-RFC PATCH v4 4/6] GPT driver for in-kernel IR support Jon Smirl
2009-11-27  1:34 ` [IR-RFC PATCH v4 5/6] Example of PowerPC device tree support for GPT based IR Jon Smirl
2009-11-27  1:34 ` [IR-RFC PATCH v4 6/6] Microsoft mceusb2 driver for in-kernel IR subsystem Jon Smirl
2009-11-27  3:12 ` [IR-RFC PATCH v4 0/6] In-kernel IR support using evdev Jarod Wilson
2009-11-27  3:34   ` Jon Smirl
2009-11-29  7:21     ` Dmitry Torokhov
2009-11-27  3:58   ` Jon Smirl
2009-11-29  7:34     ` Dmitry Torokhov
2009-11-27  7:22   ` Stefan Richter

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=9e4733910911290941o761a4dfhf4168e573c6b6e89@mail.gmail.com \
    --to=jonsmirl@gmail.com \
    --cc=greg@kroah.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).