idr: add ida_is_empty
Two of the USB Gadgets were poking around in the internals of struct ida in order to determine if it is empty. Add the appropriate abstraction. Link: http://lkml.kernel.org/r/1480369871-5271-63-git-send-email-mawilcox@linuxonhyperv.com Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Acked-by: Konstantin Khlebnikov <koct9i@gmail.com> Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: Felipe Balbi <balbi@kernel.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Michal Nazarewicz <mina86@mina86.com> Cc: Matthew Wilcox <mawilcox@microsoft.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
3e3cdc68be
commit
99c494077e
@@ -1265,7 +1265,7 @@ static void gprinter_free_inst(struct usb_function_instance *f)
|
||||
mutex_lock(&printer_ida_lock);
|
||||
|
||||
gprinter_put_minor(opts->minor);
|
||||
if (idr_is_empty(&printer_ida.idr))
|
||||
if (ida_is_empty(&printer_ida))
|
||||
gprinter_cleanup();
|
||||
|
||||
mutex_unlock(&printer_ida_lock);
|
||||
@@ -1289,7 +1289,7 @@ static struct usb_function_instance *gprinter_alloc_inst(void)
|
||||
|
||||
mutex_lock(&printer_ida_lock);
|
||||
|
||||
if (idr_is_empty(&printer_ida.idr)) {
|
||||
if (ida_is_empty(&printer_ida)) {
|
||||
status = gprinter_setup(PRINTER_MINORS);
|
||||
if (status) {
|
||||
ret = ERR_PTR(status);
|
||||
@@ -1302,7 +1302,7 @@ static struct usb_function_instance *gprinter_alloc_inst(void)
|
||||
if (opts->minor < 0) {
|
||||
ret = ERR_PTR(opts->minor);
|
||||
kfree(opts);
|
||||
if (idr_is_empty(&printer_ida.idr))
|
||||
if (ida_is_empty(&printer_ida))
|
||||
gprinter_cleanup();
|
||||
goto unlock;
|
||||
}
|
||||
|
Reference in New Issue
Block a user