On Tue, Sep 01, 2015 at 05:03:28PM -0700, Lee Duncan wrote: > +static int host_get_index(int *index) > +{ > + int error = -ENOMEM; > + > + do { > + if (!ida_pre_get(&host_index_ida, GFP_KERNEL)) > + break; > + spin_lock(&host_index_lock); > + error = ida_get_new(&host_index_ida, index); > + spin_unlock(&host_index_lock); > + } while (error == -EAGAIN); > + > + return error; > +} > + > +static inline void host_put_index(int index) > +{ > + spin_lock(&host_index_lock); > + ida_remove(&host_index_ida, index); > + spin_unlock(&host_index_lock); > +} I really hate how this pattern (and the equivalent for IDA) are spread all over. Any chance to have some simple_ida/simple_idr helpers instead of duplicating it again an again. Besides that why aren't we using and idr here and use it for host lookup as well? -- 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