[RFC,05/10] bttv: separate GPIO part from function audio_mux()

Message ID 1363807490-3906-6-git-send-email-fschaefer.oss@googlemail.com (mailing list archive)
State RFC, archived
Headers

Commit Message

Frank Schaefer March 20, 2013, 7:24 p.m. UTC
  Move the GPIO part of function audio_mux() to a separate function
audio_mux_gpio().
This prepares the code for the next patch which will separate mute and input
setting.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
 drivers/media/pci/bt8xx/bttv-driver.c |   18 ++++++++++++------
 1 Datei geändert, 12 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)
  

Comments

Hans Verkuil March 21, 2013, 10:32 a.m. UTC | #1
On Wed 20 March 2013 20:24:45 Frank Schäfer wrote:
> Move the GPIO part of function audio_mux() to a separate function
> audio_mux_gpio().
> This prepares the code for the next patch which will separate mute and input
> setting.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
> ---
>  drivers/media/pci/bt8xx/bttv-driver.c |   18 ++++++++++++------
>  1 Datei geändert, 12 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)
> 
> diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
> index 81ee70d..f1cb0db 100644
> --- a/drivers/media/pci/bt8xx/bttv-driver.c
> +++ b/drivers/media/pci/bt8xx/bttv-driver.c
> @@ -989,11 +989,10 @@ static char *audio_modes[] = {
>  	"audio: intern", "audio: mute"
>  };
>  
> -static int
> -audio_mux(struct bttv *btv, int input, int mute)
> +static void
> +audio_mux_gpio(struct bttv *btv, int input, int mute)
>  {
>  	int gpio_val, signal, mute_gpio;
> -	struct v4l2_ctrl *ctrl;
>  
>  	gpio_inout(bttv_tvcards[btv->c.type].gpiomask,
>  		   bttv_tvcards[btv->c.type].gpiomask);
> @@ -1020,8 +1019,14 @@ audio_mux(struct bttv *btv, int input, int mute)
>  
>  	if (bttv_gpio)
>  		bttv_gpio_tracking(btv, audio_modes[mute_gpio ? 4 : input]);
> -	if (in_interrupt())
> -		return 0;
> +}
> +
> +static int
> +audio_mux(struct bttv *btv, int input, int mute)
> +{
> +	struct v4l2_ctrl *ctrl;
> +
> +	audio_mux_gpio(btv, input, mute);
>  
>  	if (btv->sd_msp34xx) {
>  		u32 in;
> @@ -3846,7 +3851,8 @@ static irqreturn_t bttv_irq(int irq, void *dev_id)
>  			bttv_irq_switch_video(btv);
>  
>  		if ((astat & BT848_INT_HLOCK)  &&  btv->opt_automute)
> -			audio_mute(btv, btv->mute);  /* trigger automute */
> +			/* trigger automute */
> +			audio_mux_gpio(btv, btv->audio_input, btv->mute);
>  
>  		if (astat & (BT848_INT_SCERR|BT848_INT_OCERR)) {
>  			pr_info("%d: %s%s @ %08x,",
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
index 81ee70d..f1cb0db 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -989,11 +989,10 @@  static char *audio_modes[] = {
 	"audio: intern", "audio: mute"
 };
 
-static int
-audio_mux(struct bttv *btv, int input, int mute)
+static void
+audio_mux_gpio(struct bttv *btv, int input, int mute)
 {
 	int gpio_val, signal, mute_gpio;
-	struct v4l2_ctrl *ctrl;
 
 	gpio_inout(bttv_tvcards[btv->c.type].gpiomask,
 		   bttv_tvcards[btv->c.type].gpiomask);
@@ -1020,8 +1019,14 @@  audio_mux(struct bttv *btv, int input, int mute)
 
 	if (bttv_gpio)
 		bttv_gpio_tracking(btv, audio_modes[mute_gpio ? 4 : input]);
-	if (in_interrupt())
-		return 0;
+}
+
+static int
+audio_mux(struct bttv *btv, int input, int mute)
+{
+	struct v4l2_ctrl *ctrl;
+
+	audio_mux_gpio(btv, input, mute);
 
 	if (btv->sd_msp34xx) {
 		u32 in;
@@ -3846,7 +3851,8 @@  static irqreturn_t bttv_irq(int irq, void *dev_id)
 			bttv_irq_switch_video(btv);
 
 		if ((astat & BT848_INT_HLOCK)  &&  btv->opt_automute)
-			audio_mute(btv, btv->mute);  /* trigger automute */
+			/* trigger automute */
+			audio_mux_gpio(btv, btv->audio_input, btv->mute);
 
 		if (astat & (BT848_INT_SCERR|BT848_INT_OCERR)) {
 			pr_info("%d: %s%s @ %08x,",