Return-Path: From: Marcel Holtmann To: Ville Tervo In-Reply-To: <20070601111156.GB6310@null.research.nokia.com> References: <20070601111156.GB6310@null.research.nokia.com> Date: Fri, 01 Jun 2007 17:21:01 +0200 Message-Id: <1180711261.6726.6.camel@aeonflux.holtmann.net> Mime-Version: 1.0 Cc: bluez-devel@lists.sourceforge.net Subject: Re: [Bluez-devel] [Patch] Keep rfcomm device in list until it's freed Reply-To: BlueZ development List-Id: BlueZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Sender: bluez-devel-bounces@lists.sourceforge.net Errors-To: bluez-devel-bounces@lists.sourceforge.net Hi Ville, > Here is patch for rfcomm to keep rfcomm device in list until it's really > unused. dev = __rfcomm_dev_get(id); + + if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags)) + dev = NULL; + if (dev) rfcomm_dev_hold(dev); a test_bit() and then return NULL at the beginning makes more sense. No need to take the lock since test_bit() is atomic anyway. Regards Marcel ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel