aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2009-02-19 02:37:13 -0500
committerTakashi Iwai <tiwai@suse.de>2009-02-19 04:22:22 -0500
commitbb71858853a5c9616eea98512f4075d4f081154d (patch)
tree62447849ac3a255219029d99ee29557ad9c8de76 /sound/pci
parenta5e0e970c06065a14844b406a0c2a59776a1ccc6 (diff)
sound: oxygen: make the owner module a parameter of the probe function
Move the owner field out of the oxygen_model structure and make it a parameter of oxygen_pci_probe(), because the actual owner module does not depend on the card model. Furthermore, moving it out of the model structure allows us to create the card structure before the actual model is known. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/oxygen/hifier.c3
-rw-r--r--sound/pci/oxygen/oxygen.c3
-rw-r--r--sound/pci/oxygen/oxygen.h2
-rw-r--r--sound/pci/oxygen/oxygen_lib.c3
-rw-r--r--sound/pci/oxygen/virtuoso.c5
5 files changed, 6 insertions, 10 deletions
diff --git a/sound/pci/oxygen/hifier.c b/sound/pci/oxygen/hifier.c
index 1ab833f843eb..cc98bad9916a 100644
--- a/sound/pci/oxygen/hifier.c
+++ b/sound/pci/oxygen/hifier.c
@@ -151,7 +151,6 @@ static const struct oxygen_model model_hifier = {
151 .shortname = "C-Media CMI8787", 151 .shortname = "C-Media CMI8787",
152 .longname = "C-Media Oxygen HD Audio", 152 .longname = "C-Media Oxygen HD Audio",
153 .chip = "CMI8788", 153 .chip = "CMI8788",
154 .owner = THIS_MODULE,
155 .init = hifier_init, 154 .init = hifier_init,
156 .control_filter = hifier_control_filter, 155 .control_filter = hifier_control_filter,
157 .cleanup = hifier_cleanup, 156 .cleanup = hifier_cleanup,
@@ -185,7 +184,7 @@ static int __devinit hifier_probe(struct pci_dev *pci,
185 ++dev; 184 ++dev;
186 return -ENOENT; 185 return -ENOENT;
187 } 186 }
188 err = oxygen_pci_probe(pci, index[dev], id[dev], &model_hifier, 0); 187 err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, &model_hifier, 0);
189 if (err >= 0) 188 if (err >= 0)
190 ++dev; 189 ++dev;
191 return err; 190 return err;
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index de999c6d6dd3..12b6c2137d50 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -315,7 +315,6 @@ static const struct oxygen_model model_generic = {
315 .shortname = "C-Media CMI8788", 315 .shortname = "C-Media CMI8788",
316 .longname = "C-Media Oxygen HD Audio", 316 .longname = "C-Media Oxygen HD Audio",
317 .chip = "CMI8788", 317 .chip = "CMI8788",
318 .owner = THIS_MODULE,
319 .probe = generic_probe, 318 .probe = generic_probe,
320 .init = generic_init, 319 .init = generic_init,
321 .cleanup = generic_cleanup, 320 .cleanup = generic_cleanup,
@@ -353,7 +352,7 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci,
353 ++dev; 352 ++dev;
354 return -ENOENT; 353 return -ENOENT;
355 } 354 }
356 err = oxygen_pci_probe(pci, index[dev], id[dev], 355 err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE,
357 &model_generic, pci_id->driver_data); 356 &model_generic, pci_id->driver_data);
358 if (err >= 0) 357 if (err >= 0)
359 ++dev; 358 ++dev;
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h
index 19107c6307e5..268bff4f29d2 100644
--- a/sound/pci/oxygen/oxygen.h
+++ b/sound/pci/oxygen/oxygen.h
@@ -62,7 +62,6 @@ struct oxygen_model {
62 const char *shortname; 62 const char *shortname;
63 const char *longname; 63 const char *longname;
64 const char *chip; 64 const char *chip;
65 struct module *owner;
66 int (*probe)(struct oxygen *chip, unsigned long driver_data); 65 int (*probe)(struct oxygen *chip, unsigned long driver_data);
67 void (*init)(struct oxygen *chip); 66 void (*init)(struct oxygen *chip);
68 int (*control_filter)(struct snd_kcontrol_new *template); 67 int (*control_filter)(struct snd_kcontrol_new *template);
@@ -134,6 +133,7 @@ struct oxygen {
134/* oxygen_lib.c */ 133/* oxygen_lib.c */
135 134
136int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, 135int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
136 struct module *owner,
137 const struct oxygen_model *model, 137 const struct oxygen_model *model,
138 unsigned long driver_data); 138 unsigned long driver_data);
139void oxygen_pci_remove(struct pci_dev *pci); 139void oxygen_pci_remove(struct pci_dev *pci);
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index 9c81e0b05113..b5560fa5a5e3 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -452,6 +452,7 @@ static void oxygen_card_free(struct snd_card *card)
452} 452}
453 453
454int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, 454int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
455 struct module *owner,
455 const struct oxygen_model *model, 456 const struct oxygen_model *model,
456 unsigned long driver_data) 457 unsigned long driver_data)
457{ 458{
@@ -459,7 +460,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
459 struct oxygen *chip; 460 struct oxygen *chip;
460 int err; 461 int err;
461 462
462 err = snd_card_create(index, id, model->owner, 463 err = snd_card_create(index, id, owner,
463 sizeof(*chip) + model->model_data_size, &card); 464 sizeof(*chip) + model->model_data_size, &card);
464 if (err < 0) 465 if (err < 0)
465 return err; 466 return err;
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index 6c870c12a177..c05f7e7bdb34 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -816,7 +816,6 @@ static int xonar_model_probe(struct oxygen *chip, unsigned long driver_data)
816static const struct oxygen_model model_xonar_d2 = { 816static const struct oxygen_model model_xonar_d2 = {
817 .longname = "Asus Virtuoso 200", 817 .longname = "Asus Virtuoso 200",
818 .chip = "AV200", 818 .chip = "AV200",
819 .owner = THIS_MODULE,
820 .probe = xonar_model_probe, 819 .probe = xonar_model_probe,
821 .init = xonar_d2_init, 820 .init = xonar_d2_init,
822 .control_filter = xonar_d2_control_filter, 821 .control_filter = xonar_d2_control_filter,
@@ -849,7 +848,6 @@ static const struct oxygen_model model_xonar_d2 = {
849static const struct oxygen_model model_xonar_d1 = { 848static const struct oxygen_model model_xonar_d1 = {
850 .longname = "Asus Virtuoso 100", 849 .longname = "Asus Virtuoso 100",
851 .chip = "AV200", 850 .chip = "AV200",
852 .owner = THIS_MODULE,
853 .probe = xonar_model_probe, 851 .probe = xonar_model_probe,
854 .init = xonar_d1_init, 852 .init = xonar_d1_init,
855 .control_filter = xonar_d1_control_filter, 853 .control_filter = xonar_d1_control_filter,
@@ -878,7 +876,6 @@ static const struct oxygen_model model_xonar_d1 = {
878static const struct oxygen_model model_xonar_hdav = { 876static const struct oxygen_model model_xonar_hdav = {
879 .longname = "Asus Virtuoso 200", 877 .longname = "Asus Virtuoso 200",
880 .chip = "AV200", 878 .chip = "AV200",
881 .owner = THIS_MODULE,
882 .probe = xonar_model_probe, 879 .probe = xonar_model_probe,
883 .init = xonar_hdav_init, 880 .init = xonar_hdav_init,
884 .cleanup = xonar_hdav_cleanup, 881 .cleanup = xonar_hdav_cleanup,
@@ -925,7 +922,7 @@ static int __devinit xonar_probe(struct pci_dev *pci,
925 return -ENOENT; 922 return -ENOENT;
926 } 923 }
927 BUG_ON(pci_id->driver_data >= ARRAY_SIZE(models)); 924 BUG_ON(pci_id->driver_data >= ARRAY_SIZE(models));
928 err = oxygen_pci_probe(pci, index[dev], id[dev], 925 err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE,
929 models[pci_id->driver_data], 926 models[pci_id->driver_data],
930 pci_id->driver_data); 927 pci_id->driver_data);
931 if (err >= 0) 928 if (err >= 0)