Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760188AbYAKIxr (ORCPT ); Fri, 11 Jan 2008 03:53:47 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755783AbYAKIxi (ORCPT ); Fri, 11 Jan 2008 03:53:38 -0500 Received: from hs-out-0708.google.com ([64.233.178.244]:46977 "EHLO hs-out-2122.google.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755318AbYAKIxh (ORCPT ); Fri, 11 Jan 2008 03:53:37 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=fb284PtejGPpplm2u4d5eJOuTpnB56jMBn3JA2HVYJmhvh/Ieh5Xx/Tunhzb+6kD0w5j1AsvQE9TOrPwWIIU8SFj2CLNNuLWsC5IMgt1s8jaU04FyZRBFFFtB9Cr7GRrkKn4qyiXX2f9meR2WyxsdjAQHPxSFTjfPYtMvF1qjok= Message-ID: Date: Fri, 11 Jan 2008 16:53:36 +0800 From: "Dave Young" To: "Cornelia Huck" Subject: Re: [PATCH 0/7] convert semaphore to mutex in struct class Cc: "Greg KH" , "Stefan Richter" , James.Bottomley@hansenpartnership.com, linux-scsi@vger.kernel.org, a.zummo@towertech.it, peterz@infradead.org, cbou@mail.ru, linux-kernel@vger.kernel.org, "David Brownell" , krh@redhat.com, stern@rowland.harvard.edu, rtc-linux@googlegroups.com, spi-devel-general@lists.sourceforge.net, linux1394-devel@lists.sourceforge.net, dwmw2@infradead.org, davem@davemloft.net, jarkao2@gmail.com In-Reply-To: <20080111092359.7443af68@gondolin.boeblingen.de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <478227D5.8050402@s5r6.in-berlin.de> <20080108224837.GA19623@suse.de> <20080109061316.GA3249@darkstar.te-china.tietoenator.com> <20080110094843.GA3014@darkstar.te-china.tietoenator.com> <20080110142341.71af4dc5@gondolin.boeblingen.de.ibm.com> <20080111092359.7443af68@gondolin.boeblingen.de.ibm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1427 Lines: 37 On Jan 11, 2008 4:23 PM, Cornelia Huck wrote: > On Fri, 11 Jan 2008 10:33:16 +0800, > "Dave Young" wrote: > > > > > > +struct device *class_find_device(struct class *class, void *data, > > > > + int (*match)(struct device *, void *)) > > > > +{ > > > > + struct device *dev; > > > > + > > > > + if (!class) > > > > + return NULL; > > > > + > > > > + mutex_lock(&class->mutex); > > > > + list_for_each_entry(dev, &class->devices, node) > > > > + if (match(dev, data) && get_device(dev)) > > > > > > First get the reference and then drop it if the match function returns > > > 0 to make this analogous to the other _find_device() functions? > > > > It's just like other _find_device() functions. Are these more get/put > > really needed? > > The other _find_device() functions operate on klists, which means that > there is an implicit get while the element is handled. This function > operates on a normal list, which means that getting/putting the > reference looks a bit different if we want the same effect. > Hi, you are right. Will be fixed. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/