linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Amitesh Singh <singh.amitesh@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>,
	Anaszewski <j.anaszewski@samsung.com>,
	linux-leds@vger.kernel.org
Subject: Re: [PATCH] leds: oneshot - Allow default delay to be passed as an argument
Date: Sat, 3 Sep 2016 20:12:19 +0200	[thread overview]
Message-ID: <d6bd7a38-8f85-e9fe-7b23-b2568757624f@gmail.com> (raw)
In-Reply-To: <CABKcAmXSwgMbopurjrNU7fgPu58W-ZDbDi6VuUn2P2zOGATYLQ@mail.gmail.com>

On 09/03/2016 05:35 PM, Amitesh Singh wrote:
> Hello Jacek,
>
>
> On Sat, Sep 3, 2016 at 7:14 PM, Jacek Anaszewski
> <jacek.anaszewski@gmail.com <mailto:jacek.anaszewski@gmail.com>> wrote:
>
>     Hi Amitesh,
>
>
>     On 09/03/2016 11:03 AM, Amitesh Singh wrote:
>
>         This patch facilates the blink delay to be passed as
>         an argument at the time of module loading.
>         e.g.
>         insmod ledtrigg-oneshot.ko default_delay=100
>         ---
>          drivers/leds/trigger/ledtrig-oneshot.c | 7 +++++--
>          1 file changed, 5 insertions(+), 2 deletions(-)
>
>         diff --git a/drivers/leds/trigger/ledtrig-oneshot.c
>         b/drivers/leds/trigger/ledtrig-oneshot.c
>         index b8ea9f0..95933a1 100644
>         --- a/drivers/leds/trigger/ledtrig-oneshot.c
>         +++ b/drivers/leds/trigger/ledtrig-oneshot.c
>         @@ -22,6 +22,9 @@
>
>          #define DEFAULT_DELAY 100
>
>         +static unsigned long default_delay = DEFAULT_DELAY;
>         +module_param(default_delay, ulong, S_IRUGO|S_IWUSR);
>         +
>          struct oneshot_trig_data {
>                 unsigned int invert;
>          };
>         @@ -146,8 +149,8 @@ static void oneshot_trig_activate(struct
>         led_classdev *led_cdev)
>                 if (rc)
>                         goto err_out_invert;
>
>         -       led_cdev->blink_delay_on = DEFAULT_DELAY;
>         -       led_cdev->blink_delay_off = DEFAULT_DELAY;
>         +       led_cdev->blink_delay_on = default_delay;
>         +       led_cdev->blink_delay_off = default_delay;
>
>                 led_cdev->activated = true;
>
>
>
>
>     Why do you need this module parameter? You can change
>     delay_on and delay_off values from sysfs.
>
> Yes, indeed. If someone wants to change blink_delay, he has to change
> both delay_on and delay_off in case you want to blink with constant time
> ON and OFF (1 / (T + T) = 1/2T)
> This patch facilitates you to modify delay in one step in case of delay
> on and off are same which I think, is most used case.

I don't think this is real improvement. We spare two sysfs file
write operations only in case the default_delay param value passed
on module loading won't need to be altered later on.

Moreover, three sysfs file writes needed for configuring oneshot
trigger (e.g. echo "oneshot" > trigger; echo 100 > delay_on;
echo 50 > delay_off) are not too expensive taking into account
usual frequency of setting LED trigger (surely less often than
once per second).

-- 
Best regards,
Jacek Anaszewski

  parent reply	other threads:[~2016-09-03 18:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-03  9:03 [PATCH] leds: oneshot - Allow default delay to be passed as an argument Amitesh Singh
2016-09-03 13:44 ` Jacek Anaszewski
2016-09-03 15:39   ` Amitesh Singh
     [not found]   ` <CABKcAmXSwgMbopurjrNU7fgPu58W-ZDbDi6VuUn2P2zOGATYLQ@mail.gmail.com>
2016-09-03 18:12     ` Jacek Anaszewski [this message]
2016-09-06 15:05       ` Amitesh Singh
2016-09-06 18:52         ` Jacek Anaszewski
  -- strict thread matches above, loose matches on Subject: below --
2016-09-03  8:39 Amitesh Singh

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=d6bd7a38-8f85-e9fe-7b23-b2568757624f@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    --cc=singh.amitesh@gmail.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;
as well as URLs for NNTP newsgroup(s).