From: Kalle Valo <kvalo@codeaurora.org>
To: merez@codeaurora.org
Cc: Maya Erez <qca_merez@qca.qualcomm.com>,
linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com,
linux-wireless-owner@vger.kernel.org
Subject: Re: [PATCH v2 7/7] wil6210: add support for device led configuration
Date: Wed, 11 May 2016 22:34:28 +0300 [thread overview]
Message-ID: <878tzge6d7.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <c9158ef6654aa9b201909103b1300177@codeaurora.org> (merez@codeaurora.org's message of "Sun, 01 May 2016 10:06:32 +0300")
merez@codeaurora.org writes:
> On 2016-04-25 21:56, Kalle Valo wrote:
>> Maya Erez <qca_merez@qca.qualcomm.com> writes:
>>
>>> Add the ability to configure the device led to be used for notifying
>>> the AP activity (60G device supports leds 0-2).
>>> The host can also configure the blinking frequency of the led in
>>> three states.
>>
>> [...]
>>
>>> +/* led_blink_time, write:
>>> + * "<blink_on_slow> <blink_off_slow> <blink_on_med> <blink_off_med>
>> <blink_on_fast> <blink_off_fast>
>>> + */
>>> +static ssize_t wil_write_led_blink_time(struct file *file,
>>> + const char __user *buf,
>>> + size_t len, loff_t *ppos)
>>> +{
>>> + int rc;
>>> + char *kbuf = kmalloc(len + 1, GFP_KERNEL);
>>> +
>>> + if (!kbuf)
>>> + return -ENOMEM;
>>> +
>>> + rc = simple_write_to_buffer(kbuf, len, ppos, buf, len);
>>> + if (rc != len) {
>>> + kfree(kbuf);
>>> + return rc >= 0 ? -EIO : rc;
>>> + }
>>> +
>>> + kbuf[len] = '\0';
>>> + rc = sscanf(kbuf, "%d %d %d %d %d %d",
>>> + &led_blink_time[WIL_LED_TIME_SLOW].on_ms,
>>> + &led_blink_time[WIL_LED_TIME_SLOW].off_ms,
>>> + &led_blink_time[WIL_LED_TIME_MED].on_ms,
>>> + &led_blink_time[WIL_LED_TIME_MED].off_ms,
>>> + &led_blink_time[WIL_LED_TIME_FAST].on_ms,
>>> + &led_blink_time[WIL_LED_TIME_FAST].off_ms);
>>> + kfree(kbuf);
>>> +
>>> + if (rc < 0)
>>> + return rc;
>>> + if (rc < 6)
>>> + return -EINVAL;
>>> +
>>> + return len;
>>> +}
>>
>> Don't we already have a proper framework for leds? At least
>> include/linux/led.h and drivers/led/ makes me suspect that. I'm not
>> really fond of the idea reinventing the wheel, unless there's a really
>> good reason.
>
> The kernel led framework provides the host the ability to toggle a
> defined led, but in our case the led toggling is fully offloaded to
> the device. The host only configures the device with the led to
> activate and its parameters. I agree that reusing an existing
> framework should be enforced when possible, but as the WIL6210 host
> needs to align to the device led configuration we cannot reuse the led
> kernel framework.
Ok, thanks for checking. I'll apply the patch now.
--
Kalle Valo
next prev parent reply other threads:[~2016-05-11 19:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-25 12:57 [PATCH v2 0/7] wil6210 patches Maya Erez
2016-04-25 12:57 ` [PATCH v2 1/7] wil6210: add function name to wil log macros Maya Erez
2016-04-25 12:57 ` [PATCH v2 2/7] wil6210: support regular scan on P2P_DEVICE interface Maya Erez
2016-04-25 12:57 ` [PATCH v2 3/7] wil6210: change RX_HTRSH interrupt print level to debug Maya Erez
2016-04-25 12:57 ` [PATCH v2 4/7] wil6210: print debug message when transmitting while disconnected Maya Erez
2016-04-25 12:57 ` [PATCH v2 5/7] wil6210: unmask RX_HTRSH interrupt only when connected Maya Erez
2016-04-25 12:57 ` [PATCH v2 6/7] wil6210: prevent deep sleep of 60G device in critical paths Maya Erez
2016-04-25 12:57 ` [PATCH v2 7/7] wil6210: add support for device led configuration Maya Erez
2016-04-25 18:56 ` Kalle Valo
2016-05-01 7:06 ` merez
2016-05-11 19:34 ` Kalle Valo [this message]
2016-05-11 19:46 ` [v2,7/7] " Kalle Valo
2016-04-27 12:56 ` [PATCH v2 0/7] wil6210 patches Kalle Valo
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=878tzge6d7.fsf@kamboji.qca.qualcomm.com \
--to=kvalo@codeaurora.org \
--cc=linux-wireless-owner@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=merez@codeaurora.org \
--cc=qca_merez@qca.qualcomm.com \
--cc=wil6210@qca.qualcomm.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).