diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-01-30 02:34:58 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-02-02 11:01:26 -0500 |
commit | 40a4b263854346fe7c7d1c3964c106296f690816 (patch) | |
tree | 409291460a651df9ef508f19667489a25f5df09e /include/sound/core.h | |
parent | 04c5d5a430fca046cffac099a3f41e74816939da (diff) |
ALSA: Simplify snd_device_register() variants
Now that all callers have been replaced with
snd_device_register_for_dev(), let's drop the obsolete device
registration code and concentrate only on the code handling struct
device directly. That said,
- remove the old snd_device_register(),
- rename snd_device_register_for_dev() with snd_device_register(),
- drop superfluous arguments from snd_device_register(),
- change snd_unregister_device() to pass the device pointer directly
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound/core.h')
-rw-r--r-- | include/sound/core.h | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/include/sound/core.h b/include/sound/core.h index 4b7e04e85e16..67ac309bb218 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -187,7 +187,6 @@ struct snd_minor { | |||
187 | int type; /* SNDRV_DEVICE_TYPE_XXX */ | 187 | int type; /* SNDRV_DEVICE_TYPE_XXX */ |
188 | int card; /* card number */ | 188 | int card; /* card number */ |
189 | int device; /* device number */ | 189 | int device; /* device number */ |
190 | bool created; | ||
191 | const struct file_operations *f_ops; /* file operations */ | 190 | const struct file_operations *f_ops; /* file operations */ |
192 | void *private_data; /* private data for f_ops->open */ | 191 | void *private_data; /* private data for f_ops->open */ |
193 | struct device *dev; /* device for sysfs */ | 192 | struct device *dev; /* device for sysfs */ |
@@ -210,40 +209,10 @@ void snd_request_card(int card); | |||
210 | 209 | ||
211 | void snd_device_initialize(struct device *dev, struct snd_card *card); | 210 | void snd_device_initialize(struct device *dev, struct snd_card *card); |
212 | 211 | ||
213 | int snd_register_device_for_dev(int type, struct snd_card *card, int dev, | 212 | int snd_register_device(int type, struct snd_card *card, int dev, |
214 | const struct file_operations *f_ops, | 213 | const struct file_operations *f_ops, |
215 | void *private_data, struct device *device, | 214 | void *private_data, struct device *device); |
216 | struct device *parent, const char *name); | 215 | int snd_unregister_device(struct device *dev); |
217 | |||
218 | /** | ||
219 | * snd_register_device - Register the ALSA device file for the card | ||
220 | * @type: the device type, SNDRV_DEVICE_TYPE_XXX | ||
221 | * @card: the card instance | ||
222 | * @dev: the device index | ||
223 | * @f_ops: the file operations | ||
224 | * @private_data: user pointer for f_ops->open() | ||
225 | * @name: the device file name | ||
226 | * | ||
227 | * Registers an ALSA device file for the given card. | ||
228 | * The operators have to be set in reg parameter. | ||
229 | * | ||
230 | * This function uses the card's device pointer to link to the | ||
231 | * correct &struct device. | ||
232 | * | ||
233 | * Return: Zero if successful, or a negative error code on failure. | ||
234 | */ | ||
235 | static inline int snd_register_device(int type, struct snd_card *card, int dev, | ||
236 | const struct file_operations *f_ops, | ||
237 | void *private_data, | ||
238 | const char *name) | ||
239 | { | ||
240 | return snd_register_device_for_dev(type, card, dev, f_ops, | ||
241 | private_data, NULL, | ||
242 | snd_card_get_device_link(card), | ||
243 | name); | ||
244 | } | ||
245 | |||
246 | int snd_unregister_device(int type, struct snd_card *card, int dev); | ||
247 | void *snd_lookup_minor_data(unsigned int minor, int type); | 216 | void *snd_lookup_minor_data(unsigned int minor, int type); |
248 | struct device *snd_get_device(int type, struct snd_card *card, int dev); | 217 | struct device *snd_get_device(int type, struct snd_card *card, int dev); |
249 | 218 | ||