[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [bluetooth-dev] unclear on what this code is for...



Hi Andrew,

This part of the code is originally from the Linux serial 
driver (serial.c). The last conditional is used to prevent 
that only one "tmp_bt_buf" is allocated even if many tty's 
are opened. This is because the kernel may schedule after 
get_free_page is called. Though this last conditional is not 
necessary in this version of the stack since it is only 
possible to open one tty_bt.

Best Regards

/Mats

> -----Original Message-----
> From: Grover, Andrew [mailto:andrew.grover@xxxxxxx.com]
> Sent: Wednesday, June 21, 2000 7:45 PM
> To: bluetooth-dev@xxxxxxx.com
> Subject: [bluetooth-dev] unclear on what this code is for...
> 
> 
> from the 0607 code drop, bluetooth.c line 982:
> 
> if (!tmp_bt_buf) {
> 	page = get_free_page(GFP_KERNEL);
> 	if (!page)
> 		return -1;
>    
> 	if (tmp_bt_buf)
> 		free_page(page);
> 	else
> 		tmp_bt_buf = (unsigned char *) page;
> }
> 
> ...I've just started going through the code, but can someone 
> enlighten me -
> what's the point of that last conditional?
> 
> Thanks -- Regards -- Andy
>