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 09:58:35 +0200 [thread overview]
Message-ID: <4CAD7DAB.8030209@gmail.com> (raw)
In-Reply-To: <19F8576C6E063C45BE387C64729E739404AA21CEC6@dbde02.ent.ti.com>
On 10/07/2010 12:36 AM, Savoy, Pavan wrote:
>>>>> +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.
>
> Yes, But in this case, I required something which can be set during ldisc_register, and can be picked up during tty_open.
Why? ldiscs are per-system, singletons, not per-device. So you should
not bind to them any device specific info.
regards,
--
js
next prev parent reply other threads:[~2010-10-07 7:58 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
2010-10-06 22:36 ` Savoy, Pavan
2010-10-07 7:58 ` Jiri Slaby [this message]
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=4CAD7DAB.8030209@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