lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4CAD7DAB.8030209@gmail.com>
Date:	Thu, 07 Oct 2010 09:58:35 +0200
From:	Jiri Slaby <jirislaby@...il.com>
To:	"Savoy, Pavan" <pavan_savoy@...com>
CC:	"gregkh@...e.de" <gregkh@...e.de>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
	"alan@...rguk.ukuu.org.uk" <alan@...rguk.ukuu.org.uk>
Subject: Re: [PATCH 1/2] drivers:staging:ti-st: move TI_ST from staging

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ