diff mbox

[1/1] SND/PCI/HDA: add __init to snd_hda_add_codec_preset

Message ID 1402323812-1225-1-git-send-email-fabf@skynet.be (mailing list archive)
State New, archived
Headers show

Commit Message

Fabian Frederick June 9, 2014, 2:23 p.m. UTC
snd_hda_add_codec_preset is only called by __init functions:

__init patch_via_init
__init patch_sigmatel_init
__init patch_si3054_init
__init patch_realtek_init
__init patch_hdmi_init
__init patch_conexant_init
__init patch_cmedia_init
__init patch_cirrus_init
__init patch_ca0132_init
__init patch_ca0110_init
__init patch_analog_init

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 sound/pci/hda/hda_codec.c | 2 +-
 sound/pci/hda/hda_codec.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Takashi Iwai June 10, 2014, 1:55 p.m. UTC | #1
At Mon,  9 Jun 2014 16:23:32 +0200,
Fabian Frederick wrote:
> 
> snd_hda_add_codec_preset is only called by __init functions:
> 
> __init patch_via_init
> __init patch_sigmatel_init
> __init patch_si3054_init
> __init patch_realtek_init
> __init patch_hdmi_init
> __init patch_conexant_init
> __init patch_cmedia_init
> __init patch_cirrus_init
> __init patch_ca0132_init
> __init patch_ca0110_init
> __init patch_analog_init
> 
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

No, it's a wrong guess.  Each module may be called at any time, so you
can't use __init for helper functions.


thanks,

Takashi

> ---
>  sound/pci/hda/hda_codec.c | 2 +-
>  sound/pci/hda/hda_codec.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
> index 4c20277..5770c5c 100644
> --- a/sound/pci/hda/hda_codec.c
> +++ b/sound/pci/hda/hda_codec.c
> @@ -77,7 +77,7 @@ static struct hda_vendor_id hda_vendor_ids[] = {
>  static DEFINE_MUTEX(preset_mutex);
>  static LIST_HEAD(hda_preset_tables);
>  
> -int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset)
> +int __init snd_hda_add_codec_preset(struct hda_codec_preset_list *preset)
>  {
>  	mutex_lock(&preset_mutex);
>  	list_add_tail(&preset->list, &hda_preset_tables);
> diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
> index 5825aa1..02a9123 100644
> --- a/sound/pci/hda/hda_codec.h
> +++ b/sound/pci/hda/hda_codec.h
> @@ -182,7 +182,7 @@ struct hda_codec_preset_list {
>  };
>  
>  /* initial hook */
> -int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset);
> +int __init snd_hda_add_codec_preset(struct hda_codec_preset_list *preset);
>  int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset);
>  
>  /* ops set by the preset patch */
> -- 
> 1.8.4.5
>
Fabian Frederick June 10, 2014, 5:43 p.m. UTC | #2
On Tue, 10 Jun 2014 15:55:26 +0200
Takashi Iwai <tiwai@suse.de> wrote:

> At Mon,  9 Jun 2014 16:23:32 +0200,
> Fabian Frederick wrote:
> > 
> > snd_hda_add_codec_preset is only called by __init functions:
> > 
> > __init patch_via_init
> > __init patch_sigmatel_init
> > __init patch_si3054_init
> > __init patch_realtek_init
> > __init patch_hdmi_init
> > __init patch_conexant_init
> > __init patch_cmedia_init
> > __init patch_cirrus_init
> > __init patch_ca0132_init
> > __init patch_ca0110_init
> > __init patch_analog_init
> > 
> > Cc: Jaroslav Kysela <perex@perex.cz>
> > Cc: Takashi Iwai <tiwai@suse.de>
> > Signed-off-by: Fabian Frederick <fabf@skynet.be>
> 
> No, it's a wrong guess.  Each module may be called at any time, so you
> can't use __init for helper functions.

Sorry but I don't understand what you mean by "calling at any time".
AFAIK __init prefix only impacts built-in drivers.

Regards,
Fabian
> 
> 
> thanks,
> 
> Takashi
> 
> > ---
> >  sound/pci/hda/hda_codec.c | 2 +-
> >  sound/pci/hda/hda_codec.h | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
> > index 4c20277..5770c5c 100644
> > --- a/sound/pci/hda/hda_codec.c
> > +++ b/sound/pci/hda/hda_codec.c
> > @@ -77,7 +77,7 @@ static struct hda_vendor_id hda_vendor_ids[] = {
> >  static DEFINE_MUTEX(preset_mutex);
> >  static LIST_HEAD(hda_preset_tables);
> >  
> > -int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset)
> > +int __init snd_hda_add_codec_preset(struct hda_codec_preset_list *preset)
> >  {
> >  	mutex_lock(&preset_mutex);
> >  	list_add_tail(&preset->list, &hda_preset_tables);
> > diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
> > index 5825aa1..02a9123 100644
> > --- a/sound/pci/hda/hda_codec.h
> > +++ b/sound/pci/hda/hda_codec.h
> > @@ -182,7 +182,7 @@ struct hda_codec_preset_list {
> >  };
> >  
> >  /* initial hook */
> > -int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset);
> > +int __init snd_hda_add_codec_preset(struct hda_codec_preset_list *preset);
> >  int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset);
> >  
> >  /* ops set by the preset patch */
> > -- 
> > 1.8.4.5
> >
diff mbox

Patch

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 4c20277..5770c5c 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -77,7 +77,7 @@  static struct hda_vendor_id hda_vendor_ids[] = {
 static DEFINE_MUTEX(preset_mutex);
 static LIST_HEAD(hda_preset_tables);
 
-int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset)
+int __init snd_hda_add_codec_preset(struct hda_codec_preset_list *preset)
 {
 	mutex_lock(&preset_mutex);
 	list_add_tail(&preset->list, &hda_preset_tables);
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 5825aa1..02a9123 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -182,7 +182,7 @@  struct hda_codec_preset_list {
 };
 
 /* initial hook */
-int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset);
+int __init snd_hda_add_codec_preset(struct hda_codec_preset_list *preset);
 int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset);
 
 /* ops set by the preset patch */