Skip to contentSkip to conversation

staging: bcm2835-audio: refactor code for compaction

PATCH Superseded Aishwarya Pant 2 participants 4 messages Mar 6, 2017

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover staging: bcm2835-audio: refactor code for compaction

This patch fixes two code style issues:
- Merge two if condiitonals doing the same work
- Removes initialisation of unused semaphores ( should they be removed all-together? )

Aishwarya Pant (2):
staging: bcm2835-audio: merge two if conditions into one
staging: bcm2835-audio: remove unused semaphores

 drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 staging: bcm2835-audio: merge two if conditions into one

Patch merges two if conditions doing the same work into one.

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c +2 -4
index d60d702..f4ce4801dc 100644
@@ -122,10 +122,8 @@ static int snd_bcm2835_playback_open_generic(
 	audio_info("Alsa open (%d)\n", substream->number);
 	idx = substream->number;
 
-	if (spdif && chip->opened) {
-		err = -EBUSY;
-		goto out;
-	} else if (!spdif && (chip->opened & (1 << idx))) {
+	if ((spdif && chip->opened) ||
+	    (!spdif && (chip->opened & (1 << idx)))) {
 		err = -EBUSY;
 		goto out;
 	}
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 staging: bcm2835-audio: remove unused semaphores

In reply to Aishwarya Pant

This patch removes initialisation of unused semaphores alsa_stream->buffers_update_sem and alsa_stream->control_sem

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c +0 -2
index f4ce4801dc..c0a511e 100644
@@ -154,8 +154,6 @@ static int snd_bcm2835_playback_open_generic(
 	alsa_stream->substream = substream;
 	alsa_stream->idx = idx;
 
-	sema_init(&alsa_stream->buffers_update_sem, 0);
-	sema_init(&alsa_stream->control_sem, 0);
 	spin_lock_init(&alsa_stream->lock);
 
 	err = bcm2835_audio_open(alsa_stream);
Signature · 1 line
2.7.4
#3 lore raw

Re: [Outreachy kernel] [PATCH 2/2] staging: bcm2835-audio: remove unused semaphores

Quoted 13 lines · Aishwarya Pant

This patch removes initialisation of unused semaphores alsa_stream->buffers_update_sem and alsa_stream->control_sem

---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c +0 -0
index f4ce4801dc..c0a511e 100644

drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c static int snd_bcm2835_playback_open_generic( · line 158

Quoted 5 lines
drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c +0 -2
@@ -154,8 +154,6 @@ static int snd_bcm2835_playback_open_generic(
 	alsa_stream->substream = substream;
 	alsa_stream->idx = idx;
 
-	sema_init(&alsa_stream->buffers_update_sem, 0);
-	sema_init(&alsa_stream->control_sem, 0);

If they are not used, maybe they should be dropped from the structure as well?

julia

Quoted 13 lines
drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c +0 -1
 	spin_lock_init(&alsa_stream->lock);
 
 	err = bcm2835_audio_open(alsa_stream);
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/3751b0b72869975ee0e829f6aaedf3b6f044452d.1488814329.git.aishpant%40gmail.com.
For more options, visit https://groups.google.com/d/optout.