|
@@ -73,7 +73,7 @@ int snd_device_new(struct snd_card *card, enum snd_device_type type,
|
|
|
}
|
|
|
EXPORT_SYMBOL(snd_device_new);
|
|
|
|
|
|
-static int __snd_device_disconnect(struct snd_device *dev)
|
|
|
+static void __snd_device_disconnect(struct snd_device *dev)
|
|
|
{
|
|
|
if (dev->state == SNDRV_DEV_REGISTERED) {
|
|
|
if (dev->ops->dev_disconnect &&
|
|
@@ -81,7 +81,6 @@ static int __snd_device_disconnect(struct snd_device *dev)
|
|
|
dev_err(dev->card->dev, "device disconnect failure\n");
|
|
|
dev->state = SNDRV_DEV_DISCONNECTED;
|
|
|
}
|
|
|
- return 0;
|
|
|
}
|
|
|
|
|
|
static void __snd_device_free(struct snd_device *dev)
|
|
@@ -108,6 +107,34 @@ static struct snd_device *look_for_dev(struct snd_card *card, void *device_data)
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * snd_device_disconnect - disconnect the device
|
|
|
+ * @card: the card instance
|
|
|
+ * @device_data: the data pointer to disconnect
|
|
|
+ *
|
|
|
+ * Turns the device into the disconnection state, invoking
|
|
|
+ * dev_disconnect callback, if the device was already registered.
|
|
|
+ *
|
|
|
+ * Usually called from snd_card_disconnect().
|
|
|
+ *
|
|
|
+ * Return: Zero if successful, or a negative error code on failure or if the
|
|
|
+ * device not found.
|
|
|
+ */
|
|
|
+void snd_device_disconnect(struct snd_card *card, void *device_data)
|
|
|
+{
|
|
|
+ struct snd_device *dev;
|
|
|
+
|
|
|
+ if (snd_BUG_ON(!card || !device_data))
|
|
|
+ return;
|
|
|
+ dev = look_for_dev(card, device_data);
|
|
|
+ if (dev)
|
|
|
+ __snd_device_disconnect(dev);
|
|
|
+ else
|
|
|
+ dev_dbg(card->dev, "device disconnect %p (from %pF), not found\n",
|
|
|
+ device_data, __builtin_return_address(0));
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(snd_device_disconnect);
|
|
|
+
|
|
|
/**
|
|
|
* snd_device_free - release the device from the card
|
|
|
* @card: the card instance
|
|
@@ -195,18 +222,14 @@ int snd_device_register_all(struct snd_card *card)
|
|
|
* disconnect all the devices on the card.
|
|
|
* called from init.c
|
|
|
*/
|
|
|
-int snd_device_disconnect_all(struct snd_card *card)
|
|
|
+void snd_device_disconnect_all(struct snd_card *card)
|
|
|
{
|
|
|
struct snd_device *dev;
|
|
|
- int err = 0;
|
|
|
|
|
|
if (snd_BUG_ON(!card))
|
|
|
- return -ENXIO;
|
|
|
- list_for_each_entry_reverse(dev, &card->devices, list) {
|
|
|
- if (__snd_device_disconnect(dev) < 0)
|
|
|
- err = -ENXIO;
|
|
|
- }
|
|
|
- return err;
|
|
|
+ return;
|
|
|
+ list_for_each_entry_reverse(dev, &card->devices, list)
|
|
|
+ __snd_device_disconnect(dev);
|
|
|
}
|
|
|
|
|
|
/*
|