[PATCH 25/27] ALSA: hda: Drop superfluous driver->ops NULL checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



After all conversions, driver->ops became a must in most places
(except for the codec power setup which might be called before binding
to the codec driver), hence we can get rid of the superfluous
driver->ops NULL checks, too.

Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
 sound/hda/common/bind.c      |  6 +++---
 sound/hda/common/codec.c     | 15 +++++++--------
 sound/hda/common/hda_local.h |  2 +-
 sound/soc/codecs/hda.c       |  4 ++--
 sound/soc/codecs/hdac_hda.c  |  4 ++--
 5 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/sound/hda/common/bind.c b/sound/hda/common/bind.c
index f85c640dd54f..bb1090b65699 100644
--- a/sound/hda/common/bind.c
+++ b/sound/hda/common/bind.c
@@ -52,7 +52,7 @@ static void hda_codec_unsol_event(struct hdac_device *dev, unsigned int ev)
 	if (codec->core.dev.power.power_state.event != PM_EVENT_ON)
 		return;
 
-	if (driver->ops && driver->ops->unsol_event)
+	if (driver->ops->unsol_event)
 		driver->ops->unsol_event(codec, ev);
 }
 
@@ -138,7 +138,7 @@ static int hda_codec_driver_probe(struct device *dev)
 	return 0;
 
  error_module:
-	if (driver->ops && driver->ops->remove)
+	if (driver->ops->remove)
 		driver->ops->remove(codec);
  error_module_put:
 	module_put(owner);
@@ -166,7 +166,7 @@ static int hda_codec_driver_remove(struct device *dev)
 		wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref));
 	snd_power_sync_ref(codec->bus->card);
 
-	if (driver->ops && driver->ops->remove)
+	if (driver->ops->remove)
 		driver->ops->remove(codec);
 	snd_hda_codec_cleanup_for_unbind(codec);
 	codec->preset = NULL;
diff --git a/sound/hda/common/codec.c b/sound/hda/common/codec.c
index 33121d002087..fa07a296abe8 100644
--- a/sound/hda/common/codec.c
+++ b/sound/hda/common/codec.c
@@ -1129,7 +1129,7 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,
 	if (!p)
 		return;
 
-	if (driver->ops && driver->ops->stream_pm)
+	if (driver->ops->stream_pm)
 		driver->ops->stream_pm(codec, nid, true);
 	if (codec->pcm_format_first)
 		update_pcm_format(codec, p, nid, format);
@@ -1200,7 +1200,7 @@ static void really_cleanup_stream(struct hda_codec *codec,
 );
 	memset(q, 0, sizeof(*q));
 	q->nid = nid;
-	if (driver->ops && driver->ops->stream_pm)
+	if (driver->ops->stream_pm)
 		driver->ops->stream_pm(codec, nid, false);
 }
 
@@ -2849,7 +2849,7 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec)
 	unsigned int state;
 
 	snd_hdac_enter_pm(&codec->core);
-	if (driver->ops && driver->ops->suspend)
+	if (driver->ops->suspend)
 		driver->ops->suspend(codec);
 	if (!codec->no_stream_clean_at_suspend)
 		hda_cleanup_all_streams(codec);
@@ -2876,7 +2876,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
 	restore_shutup_pins(codec);
 	hda_exec_init_verbs(codec);
 	snd_hda_jack_set_dirty_all(codec);
-	if (driver->ops && driver->ops->resume)
+	if (driver->ops->resume)
 		driver->ops->resume(codec);
 	else {
 		snd_hda_codec_init(codec);
@@ -3071,7 +3071,7 @@ int snd_hda_codec_build_controls(struct hda_codec *codec)
 	/* continue to initialize... */
 	err = snd_hda_codec_init(codec);
 	if (!err) {
-		if (driver->ops && driver->ops->build_controls)
+		if (driver->ops->build_controls)
 			err = driver->ops->build_controls(codec);
 		if (err < 0)
 			return err;
@@ -3268,11 +3268,10 @@ int snd_hda_codec_parse_pcms(struct hda_codec *codec)
 	if (!list_empty(&codec->pcm_list_head))
 		return 0; /* already parsed */
 
-	if (driver->ops && driver->ops->build_pcms)
-		err = driver->ops->build_pcms(codec);
-	else
+	if (!driver->ops->build_pcms)
 		return 0;
 
+	err = driver->ops->build_pcms(codec);
 	if (err < 0) {
 		codec_err(codec, "cannot build PCMs for #%d (error %d)\n",
 			  codec->core.addr, err);
diff --git a/sound/hda/common/hda_local.h b/sound/hda/common/hda_local.h
index e56bea4c9357..a7e53277a0fe 100644
--- a/sound/hda/common/hda_local.h
+++ b/sound/hda/common/hda_local.h
@@ -656,7 +656,7 @@ static inline int snd_hda_codec_init(struct hda_codec *codec)
 {
 	struct hda_codec_driver *driver = hda_codec_to_driver(codec);
 
-	if (driver->ops && driver->ops->init)
+	if (driver->ops->init)
 		return driver->ops->init(codec);
 	return 0;
 }
diff --git a/sound/soc/codecs/hda.c b/sound/soc/codecs/hda.c
index 126270ffd418..c8344e28df3d 100644
--- a/sound/soc/codecs/hda.c
+++ b/sound/soc/codecs/hda.c
@@ -250,7 +250,7 @@ static int hda_codec_probe(struct snd_soc_component *component)
 complete_err:
 	hda_codec_unregister_dais(codec, component);
 parse_pcms_err:
-	if (driver->ops && driver->ops->remove)
+	if (driver->ops->remove)
 		driver->ops->remove(codec);
 err:
 	snd_hda_codec_cleanup_for_unbind(codec);
@@ -280,7 +280,7 @@ static void hda_codec_remove(struct snd_soc_component *component)
 
 	hda_codec_unregister_dais(codec, component);
 
-	if (driver->ops && driver->ops->remove)
+	if (driver->ops->remove)
 		driver->ops->remove(codec);
 
 	snd_hda_codec_cleanup_for_unbind(codec);
diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c
index 191cb8427664..afd8edf10fdc 100644
--- a/sound/soc/codecs/hdac_hda.c
+++ b/sound/soc/codecs/hdac_hda.c
@@ -531,7 +531,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component)
 	return 0;
 
 error_patch:
-	if (driver->ops && driver->ops->remove)
+	if (driver->ops->remove)
 		driver->ops->remove(hcodec);
 error_regmap:
 	snd_hdac_regmap_exit(hdev);
@@ -560,7 +560,7 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component)
 	pm_runtime_disable(&hdev->dev);
 	snd_hdac_ext_bus_link_put(hdev->bus, hlink);
 
-	if (driver->ops && driver->ops->remove)
+	if (driver->ops->remove)
 		driver->ops->remove(codec);
 
 	snd_hda_codec_cleanup_for_unbind(codec);
-- 
2.50.0





[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux