Re: [PATCH 0/7] convert semaphore to mutex in struct class

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

 



On Fri, 11 Jan 2008 10:33:16 +0800,
"Dave Young" <hidave.darkstar@xxxxxxxxx> 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.
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux