Message ID | 1439654427-26109-1-git-send-email-broonie@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 78b50f39142612d01073595d33e7cc48f03a5a2f |
Headers | show |
On Sat, 15 Aug 2015 18:00:27 +0200, Mark Brown wrote: > > Allow the topology code to be compiled out so that users who don't need > topology don't need to havve the code compiled in, saving them some > memory. > > Some more configuration could be added to remove some of the hooks into > the core data structures but that is probably best done with some > refactoring to use functions to do the updates of the data structures > rather than ifdefing in the code as we'd need to do at the minute. > > Suggested-by: Takashi Iwai <tiwai@suse.de> > Signed-off-by: Mark Brown <broonie@kernel.org> > --- > include/sound/soc-topology.h | 12 ++++++++++++ > sound/soc/Kconfig | 3 +++ > sound/soc/Makefile | 3 +++ > 3 files changed, 18 insertions(+) > > diff --git a/include/sound/soc-topology.h b/include/sound/soc-topology.h > index 865a141..427bc41 100644 > --- a/include/sound/soc-topology.h > +++ b/include/sound/soc-topology.h > @@ -141,6 +141,8 @@ struct snd_soc_tplg_ops { > int io_ops_count; > }; > > +#ifdef CONFIG_SND_SOC_TOPOLOGY > + > /* gets a pointer to data from the firmware block header */ > static inline const void *snd_soc_tplg_get_data(struct snd_soc_tplg_hdr *hdr) > { > @@ -165,4 +167,14 @@ int snd_soc_tplg_widget_bind_event(struct snd_soc_dapm_widget *w, > const struct snd_soc_tplg_widget_events *events, int num_events, > u16 event_type); > > +#else > + > +static inline int snd_soc_tplg_component_remove(struct snd_soc_component *comp, > + u32 index) > +{ > + return 0; > +} > + > +#endif > + > #endif > diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig > index 467ee1a..225bfda 100644 > --- a/sound/soc/Kconfig > +++ b/sound/soc/Kconfig > @@ -30,6 +30,9 @@ config SND_SOC_GENERIC_DMAENGINE_PCM > bool > select SND_DMAENGINE_PCM > > +config SND_SOC_TOPOLOGY > + bool > + > # All the supported SoCs > source "sound/soc/adi/Kconfig" > source "sound/soc/atmel/Kconfig" > diff --git a/sound/soc/Makefile b/sound/soc/Makefile > index 19fd711..134aca1 100644 > --- a/sound/soc/Makefile > +++ b/sound/soc/Makefile > @@ -1,6 +1,9 @@ > snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-cache.o soc-utils.o > snd-soc-core-objs += soc-pcm.o soc-compress.o soc-io.o soc-devres.o soc-ops.o > + > +ifneq ($(CONFIG_SND_SOC_TOPOLOGY),) > snd-soc-core-objs += soc-topology.o > +endif This can be simplified like snd-soc-core-$(CONFIG_SND_SOC_TOPOLOGY) += soc-topology.o Takashi
On Sat, Aug 15, 2015 at 08:50:08PM +0200, Takashi Iwai wrote: > Mark Brown wrote: > > +ifneq ($(CONFIG_SND_SOC_TOPOLOGY),) > > snd-soc-core-objs += soc-topology.o > > +endif > This can be simplified like > snd-soc-core-$(CONFIG_SND_SOC_TOPOLOGY) += soc-topology.o Yeah, that thought did occur to me while I was doing this however all the other optional files for the core that are in there already use the same idiom for some reason so I'm going to go back and update them all at once later rather than having some in one style and some in another.
On Mon, 17 Aug 2015 22:18:35 +0200, Mark Brown wrote: > > On Sat, Aug 15, 2015 at 08:50:08PM +0200, Takashi Iwai wrote: > > Mark Brown wrote: > > > > +ifneq ($(CONFIG_SND_SOC_TOPOLOGY),) > > > snd-soc-core-objs += soc-topology.o > > > +endif > > > This can be simplified like > > > snd-soc-core-$(CONFIG_SND_SOC_TOPOLOGY) += soc-topology.o > > Yeah, that thought did occur to me while I was doing this however all > the other optional files for the core that are in there already use the > same idiom for some reason so I'm going to go back and update them all > at once later rather than having some in one style and some in another. That should suffice. Thanks! Takashi
diff --git a/include/sound/soc-topology.h b/include/sound/soc-topology.h index 865a141..427bc41 100644 --- a/include/sound/soc-topology.h +++ b/include/sound/soc-topology.h @@ -141,6 +141,8 @@ struct snd_soc_tplg_ops { int io_ops_count; }; +#ifdef CONFIG_SND_SOC_TOPOLOGY + /* gets a pointer to data from the firmware block header */ static inline const void *snd_soc_tplg_get_data(struct snd_soc_tplg_hdr *hdr) { @@ -165,4 +167,14 @@ int snd_soc_tplg_widget_bind_event(struct snd_soc_dapm_widget *w, const struct snd_soc_tplg_widget_events *events, int num_events, u16 event_type); +#else + +static inline int snd_soc_tplg_component_remove(struct snd_soc_component *comp, + u32 index) +{ + return 0; +} + +#endif + #endif diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index 467ee1a..225bfda 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig @@ -30,6 +30,9 @@ config SND_SOC_GENERIC_DMAENGINE_PCM bool select SND_DMAENGINE_PCM +config SND_SOC_TOPOLOGY + bool + # All the supported SoCs source "sound/soc/adi/Kconfig" source "sound/soc/atmel/Kconfig" diff --git a/sound/soc/Makefile b/sound/soc/Makefile index 19fd711..134aca1 100644 --- a/sound/soc/Makefile +++ b/sound/soc/Makefile @@ -1,6 +1,9 @@ snd-soc-core-objs := soc-core.o soc-dapm.o soc-jack.o soc-cache.o soc-utils.o snd-soc-core-objs += soc-pcm.o soc-compress.o soc-io.o soc-devres.o soc-ops.o + +ifneq ($(CONFIG_SND_SOC_TOPOLOGY),) snd-soc-core-objs += soc-topology.o +endif ifneq ($(CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM),) snd-soc-core-objs += soc-generic-dmaengine-pcm.o
Allow the topology code to be compiled out so that users who don't need topology don't need to havve the code compiled in, saving them some memory. Some more configuration could be added to remove some of the hooks into the core data structures but that is probably best done with some refactoring to use functions to do the updates of the data structures rather than ifdefing in the code as we'd need to do at the minute. Suggested-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org> --- include/sound/soc-topology.h | 12 ++++++++++++ sound/soc/Kconfig | 3 +++ sound/soc/Makefile | 3 +++ 3 files changed, 18 insertions(+)