@@ -9,6 +9,7 @@
*/
#include "cx231xx.h"
+#include <linux/find_atomic.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
@@ -1708,16 +1709,12 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
return -ENODEV;
/* Check to see next free device and mark as used */
- do {
- nr = find_first_zero_bit(&cx231xx_devused, CX231XX_MAXBOARDS);
- if (nr >= CX231XX_MAXBOARDS) {
- /* No free device slots */
- dev_err(d,
- "Supports only %i devices.\n",
- CX231XX_MAXBOARDS);
- return -ENOMEM;
- }
- } while (test_and_set_bit(nr, &cx231xx_devused));
+ nr = find_and_set_bit(&cx231xx_devused, CX231XX_MAXBOARDS);
+ if (nr >= CX231XX_MAXBOARDS) {
+ /* No free device slots */
+ dev_err(d, "Supports only %i devices.\n", CX231XX_MAXBOARDS);
+ return -ENOMEM;
+ }
udev = usb_get_dev(interface_to_usbdev(interface));
@@ -11,6 +11,7 @@
#include "em28xx.h"
+#include <linux/find_atomic.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
@@ -3684,17 +3685,14 @@ static int em28xx_duplicate_dev(struct em28xx *dev)
return -ENOMEM;
}
/* Check to see next free device and mark as used */
- do {
- nr = find_first_zero_bit(em28xx_devused, EM28XX_MAXBOARDS);
- if (nr >= EM28XX_MAXBOARDS) {
- /* No free device slots */
- dev_warn(&dev->intf->dev, ": Supports only %i em28xx boards.\n",
- EM28XX_MAXBOARDS);
- kfree(sec_dev);
- dev->dev_next = NULL;
- return -ENOMEM;
- }
- } while (test_and_set_bit(nr, em28xx_devused));
+ nr = find_and_set_bit(em28xx_devused, EM28XX_MAXBOARDS);
+ if (nr >= EM28XX_MAXBOARDS) {
+ /* No free device slots */
+ dev_warn(&dev->intf->dev, ": Supports only %i em28xx boards.\n", EM28XX_MAXBOARDS);
+ kfree(sec_dev);
+ dev->dev_next = NULL;
+ return -ENOMEM;
+ }
sec_dev->devno = nr;
snprintf(sec_dev->name, 28, "em28xx #%d", nr);
sec_dev->dev_next = NULL;
@@ -3827,17 +3825,13 @@ static int em28xx_usb_probe(struct usb_interface *intf,
udev = usb_get_dev(interface_to_usbdev(intf));
/* Check to see next free device and mark as used */
- do {
- nr = find_first_zero_bit(em28xx_devused, EM28XX_MAXBOARDS);
- if (nr >= EM28XX_MAXBOARDS) {
- /* No free device slots */
- dev_err(&intf->dev,
- "Driver supports up to %i em28xx boards.\n",
- EM28XX_MAXBOARDS);
- retval = -ENOMEM;
- goto err_no_slot;
- }
- } while (test_and_set_bit(nr, em28xx_devused));
+ nr = find_and_set_bit(em28xx_devused, EM28XX_MAXBOARDS);
+ if (nr >= EM28XX_MAXBOARDS) {
+ /* No free device slots */
+ dev_err(&intf->dev, "Driver supports up to %i em28xx boards.\n", EM28XX_MAXBOARDS);
+ retval = -ENOMEM;
+ goto err_no_slot;
+ }
/* Don't register audio interfaces */
if (intf->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {