@@ -868,12 +868,13 @@ static int snd_compress_dev_register(struct snd_device *device)
868
868
return - EBADFD ;
869
869
compr = device -> device_data ;
870
870
871
- sprintf (str , "comprC%iD%i" , compr -> card -> number , compr -> device );
872
871
pr_debug ("reg %s for device %s, direction %d\n" , str , compr -> name ,
873
872
compr -> direction );
874
873
/* register compressed device */
875
- ret = snd_register_device (SNDRV_DEVICE_TYPE_COMPRESS , compr -> card ,
876
- compr -> device , & snd_compr_file_ops , compr , str );
874
+ ret = snd_register_device_for_dev (SNDRV_DEVICE_TYPE_COMPRESS ,
875
+ compr -> card , compr -> device ,
876
+ & snd_compr_file_ops , compr ,
877
+ & compr -> dev , NULL , NULL );
877
878
if (ret < 0 ) {
878
879
pr_err ("snd_register_device failed\n %d" , ret );
879
880
return ret ;
@@ -892,6 +893,15 @@ static int snd_compress_dev_disconnect(struct snd_device *device)
892
893
return 0 ;
893
894
}
894
895
896
+ static int snd_compress_dev_free (struct snd_device * device )
897
+ {
898
+ struct snd_compr * compr ;
899
+
900
+ compr = device -> device_data ;
901
+ put_device (& compr -> dev );
902
+ return 0 ;
903
+ }
904
+
895
905
/*
896
906
* snd_compress_new: create new compress device
897
907
* @card: sound card pointer
@@ -903,14 +913,18 @@ int snd_compress_new(struct snd_card *card, int device,
903
913
int dirn , struct snd_compr * compr )
904
914
{
905
915
static struct snd_device_ops ops = {
906
- .dev_free = NULL ,
916
+ .dev_free = snd_compress_dev_free ,
907
917
.dev_register = snd_compress_dev_register ,
908
918
.dev_disconnect = snd_compress_dev_disconnect ,
909
919
};
910
920
911
921
compr -> card = card ;
912
922
compr -> device = device ;
913
923
compr -> direction = dirn ;
924
+
925
+ snd_device_initialize (& compr -> dev , card );
926
+ dev_set_name (& compr -> dev , "comprC%iD%i" , card -> number , device );
927
+
914
928
return snd_device_new (card , SNDRV_DEV_COMPRESS , compr , & ops );
915
929
}
916
930
EXPORT_SYMBOL_GPL (snd_compress_new );
@@ -948,7 +962,7 @@ int snd_compress_register(struct snd_compr *device)
948
962
{
949
963
int retval ;
950
964
951
- if (device -> name == NULL || device -> dev == NULL || device -> ops == NULL )
965
+ if (device -> name == NULL || device -> ops == NULL )
952
966
return - EINVAL ;
953
967
954
968
pr_debug ("Registering compressed device %s\n" , device -> name );
0 commit comments