All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] staging: bcm2835-audio: refactor code for compaction
@ 2017-03-06 19:56 Aishwarya Pant
  2017-03-06 19:57 ` [PATCH v2 1/2] staging: bcm2835-audio: merge two if conditions into one Aishwarya Pant
  2017-03-06 19:57 ` [PATCH v2 2/2] staging: bcm2835-audio: remove unused semaphores Aishwarya Pant
  0 siblings, 2 replies; 4+ messages in thread
From: Aishwarya Pant @ 2017-03-06 19:56 UTC (permalink / raw)
  To: Stephen Warren, Lee Jones, Eric Anholt, Greg Kroah-Hartman,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list
  Cc: outreachy-kernel

This patch fixes two code style issues:
        - Merge two if condiitonals doing the same work
	- Removes initialisation of unused semaphores

Changes in v2:
	- Removed the semaphores from struct bcm2835_alsa_stream and 
	  not just their initialisation

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 ++------
 drivers/staging/vc04_services/bcm2835-audio/bcm2835.h     | 2 --
 2 files changed, 2 insertions(+), 8 deletions(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] staging: bcm2835-audio: merge two if conditions into one
  2017-03-06 19:56 [PATCH v2 0/2] staging: bcm2835-audio: refactor code for compaction Aishwarya Pant
@ 2017-03-06 19:57 ` Aishwarya Pant
  2017-03-07 19:08   ` [Outreachy kernel] " Greg Kroah-Hartman
  2017-03-06 19:57 ` [PATCH v2 2/2] staging: bcm2835-audio: remove unused semaphores Aishwarya Pant
  1 sibling, 1 reply; 4+ messages in thread
From: Aishwarya Pant @ 2017-03-06 19:57 UTC (permalink / raw)
  To: Stephen Warren, Lee Jones, Eric Anholt, Greg Kroah-Hartman,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list
  Cc: outreachy-kernel

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

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
index d60d702..f4ce4801dc 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
@@ -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;
 	}
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] staging: bcm2835-audio: remove unused semaphores
  2017-03-06 19:56 [PATCH v2 0/2] staging: bcm2835-audio: refactor code for compaction Aishwarya Pant
  2017-03-06 19:57 ` [PATCH v2 1/2] staging: bcm2835-audio: merge two if conditions into one Aishwarya Pant
@ 2017-03-06 19:57 ` Aishwarya Pant
  1 sibling, 0 replies; 4+ messages in thread
From: Aishwarya Pant @ 2017-03-06 19:57 UTC (permalink / raw)
  To: Stephen Warren, Lee Jones, Eric Anholt, Greg Kroah-Hartman,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list
  Cc: outreachy-kernel

This patch removes unused semaphores alsa_stream->buffers_update_sem
and alsa_stream->control_sem from struct bcm2835_alsa_stream

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>

---
Changes in v2:
	- Remove the unused semaphores from struct bcm2835_alsa_stream

 drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c | 2 --
 drivers/staging/vc04_services/bcm2835-audio/bcm2835.h     | 2 --
 2 files changed, 4 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
index f4ce4801dc..c0a511e 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
@@ -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);
diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
index 2f9d1c9..c53c2bd 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
@@ -122,8 +122,6 @@ struct bcm2835_alsa_stream {
 	struct snd_pcm_substream *substream;
 	struct snd_pcm_indirect pcm_indirect;
 
-	struct semaphore buffers_update_sem;
-	struct semaphore control_sem;
 	spinlock_t lock;
 	volatile unsigned int control;
 	volatile unsigned int status;
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Outreachy kernel] [PATCH v2 1/2] staging: bcm2835-audio: merge two if conditions into one
  2017-03-06 19:57 ` [PATCH v2 1/2] staging: bcm2835-audio: merge two if conditions into one Aishwarya Pant
@ 2017-03-07 19:08   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2017-03-07 19:08 UTC (permalink / raw)
  To: Aishwarya Pant
  Cc: Stephen Warren, Lee Jones, Eric Anholt, Florian Fainelli, Ray Jui,
	Scott Branden, bcm-kernel-feedback-list, outreachy-kernel

On Tue, Mar 07, 2017 at 01:27:09AM +0530, Aishwarya Pant wrote:
> Patch merges two if conditions doing the same work into one.
> 
> Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
> ---
>  drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
> index d60d702..f4ce4801dc 100644
> --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
> +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
> @@ -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)))) {

But now it's a lot harder to read and understand, right?  Please keep
the original, it's not incorrect.

There are _so_ many real things to fix in this driver, don't make minor
tweaks for no reason.

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-07 19:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-06 19:56 [PATCH v2 0/2] staging: bcm2835-audio: refactor code for compaction Aishwarya Pant
2017-03-06 19:57 ` [PATCH v2 1/2] staging: bcm2835-audio: merge two if conditions into one Aishwarya Pant
2017-03-07 19:08   ` [Outreachy kernel] " Greg Kroah-Hartman
2017-03-06 19:57 ` [PATCH v2 2/2] staging: bcm2835-audio: remove unused semaphores Aishwarya Pant

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.