From: Jiri Slaby <jirislaby@gmail.com>
To: "Savoy, Pavan" <pavan_savoy@ti.com>
Cc: "gregkh@suse.de" <gregkh@suse.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"alan@lxorguk.ukuu.org.uk" <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH 1/2] drivers:staging:ti-st: move TI_ST from staging
Date: Thu, 07 Oct 2010 00:18:15 +0200 [thread overview]
Message-ID: <4CACF5A7.3010601@gmail.com> (raw)
In-Reply-To: <19F8576C6E063C45BE387C64729E739404AA21CEA1@dbde02.ent.ti.com>
On 10/06/2010 10:08 PM, Savoy, Pavan wrote:
>> On 10/06/2010 06:18 PM, pavan_savoy@ti.com wrote:
>>> --- /dev/null
>>> +++ b/drivers/misc/ti-st/st_core.c
>>> @@ -0,0 +1,1031 @@
>> ...
>>> +#define PROTO_ENTRY(type, name) name
>>> +const unsigned char *protocol_strngs[] = {
>>> + PROTO_ENTRY(ST_BT, "Bluetooth"),
>>> + PROTO_ENTRY(ST_FM, "FM"),
>>> + PROTO_ENTRY(ST_GPS, "GPS"),
>>> +};
>>
>> Is this planned to be used somewhere?
>
> Yes- would go in the debugfs.
> Doesn't it already? Will check up, & will remove if not required.
The thing probably is that you have protocol_strngs here and
protocol_names there.
>>> + pr_err("protocol %d not registered, no data to send?",
>>> + protoid);
>>
>> Missing \n. And all over the code.
>
> With pr_fmt defined in each source file, the "\n" is not necessary.
> I don't see the logs getting all jumbled up in one line.
>
> However If I don't have a pr_fmt, I see the need for "\n" - Please suggest.
I can't explain that, but I see no reason why you wouldn't need \n
there. It expands to standard printk(KERN_ERR "(stc): " fmt) where fmt
should contain \n. I remember Linus sending a patch to the list which
added \n by default if <.> is about to be printed next. But I don't know
if he pushed it out. You can check printk implementation.
>>> +static inline int st_check_data_len(struct st_data_s *st_gdata,
>>
>> It doesn't look like a candidate for inlining.
>
> Because?
Because it does too much to be an inline. The compiler will inline that
itself on its own if it decides to. It can count the pros and cons more
precisely than we can. Also note that gcc will un-inline that if it
decides to (if the inlining penalty is too high).
>>> +int st_core_init(struct st_data_s **core_data)
>>> +{
>>> + struct st_data_s *st_gdata;
>>> + long err;
>>> + static struct tty_ldisc_ops *st_ldisc_ops;
>>> +
>>> + /* populate and register to TTY line discipline */
>>> + st_ldisc_ops = kzalloc(sizeof(*st_ldisc_ops), GFP_KERNEL);
>>> + if (!st_ldisc_ops) {
>>> + pr_err("no mem to allocate");
>>> + return -ENOMEM;
>>> + }
>>> +
>>> + st_ldisc_ops->magic = TTY_LDISC_MAGIC;
>>> + st_ldisc_ops->name = "n_st"; /*"n_hci"; */
>>> + st_ldisc_ops->open = st_tty_open;
>>> + st_ldisc_ops->close = st_tty_close;
>>> + st_ldisc_ops->receive_buf = st_tty_receive;
>>> + st_ldisc_ops->write_wakeup = st_tty_wakeup;
>>> + st_ldisc_ops->flush_buffer = st_tty_flush_buffer;
>>> + st_ldisc_ops->owner = THIS_MODULE;
>>
>> This can be static structure, you don't need to allocate this on heap.
>> It should be a singleton.
>
> Yes, I got this comment before, but is it just a style issue?
> I want to keep this in heap because some day, I hope TTY ldics have their own
> private_data, which I can pass around like the tty_struct's data.
> and having them in heap, I plan to keep a reference to ops structure, so that I
> can pass around and use ops->private_data everywhere ..
I doubt ldisc ops will ever have ->private_data. What would you need it
for? The ops generally work with ttys which have ->disc_data.
>>> +void kim_int_recv(struct kim_data_s *kim_gdata,
>>> + const unsigned char *data, long count)
>>> +{
>>> + register char *ptr;
>>> + struct hci_event_hdr *eh;
>>> + register int len = 0, type = 0;
>>
>> registers
>>
>>> + pr_debug("%s", __func__);
>>
>> \n
>>
>>> + /* Decode received bytes here */
>>> + ptr = (char *)data;
>>
>> Casting from const to non-const. It doesn't look correct.
>
> So, would I rather declare ptr as const?
Yes, if that makes sense. Otherwise de-const data.
>>> +long st_kim_start(void *kim_data)
>>> +{
>>> + long err = 0;
>>> + long retry = POR_RETRY_COUNT;
>>> + struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data;
>>> +
>>> + pr_info(" %s", __func__);
>>> +
>>> + do {
>>> + /* TODO: this is only because rfkill sub-system
>>> + * doesn't send events to user-space if the state
>>> + * isn't changed
>>> + */
>>> + rfkill_set_hw_state(kim_gdata->rfkill[ST_BT], 1);
>>> + /* Configure BT nShutdown to HIGH state */
>>> + gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_LOW);
>>> + mdelay(5); /* FIXME: a proper toggle */
>>> + gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_HIGH);
>>> + mdelay(100);
>>
>> You can sleep here instead (below you wait for completion). 100 ms of
>> busy waiting is way too much.
>
> It's agreed upon from the process, since it is in a process context.
> Like's a device's open or hci0's UP.
Dunno if you got me right. I meant mdelay->msleep.
regards,
--
js
next prev parent reply other threads:[~2010-10-06 22:18 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-06 16:18 [PATCH 0/2] move TI_ST driver out of staging pavan_savoy
2010-10-06 15:28 ` Greg KH
2010-10-06 16:10 ` Savoy, Pavan
2010-10-06 16:18 ` [PATCH 1/2] drivers:staging:ti-st: move TI_ST from staging pavan_savoy
2010-10-06 16:18 ` [PATCH 2/2] drivers:misc: ti-st: Kconfig & Makefile for TI_ST pavan_savoy
2010-10-06 19:47 ` [PATCH 1/2] drivers:staging:ti-st: move TI_ST from staging Jiri Slaby
2010-10-06 20:08 ` Savoy, Pavan
2010-10-06 22:18 ` Jiri Slaby [this message]
2010-10-06 22:36 ` Savoy, Pavan
2010-10-07 7:58 ` Jiri Slaby
2010-10-07 14:52 ` Savoy, Pavan
2010-10-07 18:26 ` Jiri Slaby
2010-10-07 18:35 ` Savoy, Pavan
2010-10-07 19:38 ` Alan Cox
2010-10-07 19:19 ` Savoy, Pavan
2010-10-07 20:35 ` Alan Cox
2010-10-07 20:17 ` Savoy, Pavan
2010-10-07 20:59 ` Alan Cox
2010-10-07 20:46 ` Savoy, Pavan
2010-10-08 8:32 ` Marcel Holtmann
2010-10-20 5:22 ` Andrew Morton
2010-10-20 16:03 ` Savoy, Pavan
2010-10-13 7:10 ` [PATCH 0/2] move TI_ST driver out of staging Pavel Machek
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=4CACF5A7.3010601@gmail.com \
--to=jirislaby@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=pavan_savoy@ti.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