All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
Cc: kstewart@linuxfoundation.org, linux-kernel@vger.kernel.org,
	rfontana@redhat.com, tglx@linutronix.de,
	linux-kernel-mentees@lists.linuxfoundation.org,
	linux-media@vger.kernel.org
Subject: Re: [Linux-kernel-mentees] [PATCH] media: dummy_dvb_fe: register adapter/frontend
Date: Sun, 1 Dec 2019 08:56:02 +0100	[thread overview]
Message-ID: <20191201085602.7212436b@kernel.org> (raw)
In-Reply-To: <20191126153157.26355-1-dwlsalmeida@gmail.com>

Em Tue, 26 Nov 2019 12:31:57 -0300
"Daniel W. S. Almeida" <dwlsalmeida@gmail.com> escreveu:

> From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
> 
> Before using the DTV frontend core, a bridge driver should register the
> new frontend at the subsystem and unregister it at device detach / removal.

This patch is conceptually wrong. The dummy_dvb_fe is a frontend driver.

As such, it doesn't register itself as a bridge. What we need here is a
separate virtual DVB bridge driver with would register itself as a DVB
adapter and use the dummy_dvb_fe as its frontend.

Regards,
Mauro

> 
> Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
> ---
>  drivers/media/dvb-frontends/dvb_dummy_fe.c | 39 ++++++++++++++++++++--
>  1 file changed, 37 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/dvb-frontends/dvb_dummy_fe.c b/drivers/media/dvb-frontends/dvb_dummy_fe.c
> index 4db679cb70ad..1ccb58c67e8e 100644
> --- a/drivers/media/dvb-frontends/dvb_dummy_fe.c
> +++ b/drivers/media/dvb-frontends/dvb_dummy_fe.c
> @@ -13,12 +13,12 @@
>  #include <media/dvb_frontend.h>
>  #include "dvb_dummy_fe.h"
>  
> +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
>  
>  struct dvb_dummy_fe_state {
>  	struct dvb_frontend frontend;
>  };
>  
> -
>  static int dvb_dummy_fe_read_status(struct dvb_frontend *fe,
>  				    enum fe_status *status)
>  {
> @@ -84,7 +84,36 @@ static int dvb_dummy_fe_sleep(struct dvb_frontend* fe)
>  
>  static int dvb_dummy_fe_init(struct dvb_frontend* fe)
>  {
> -	return 0;
> +	int result = 0;
> +	struct dvb_adapter *adapter = fe->dvb;
> +
> +	result = dvb_register_adapter(adapter,
> +				      KBUILD_MODNAME,
> +				      THIS_MODULE,
> +				      adapter->device,
> +				      adapter_nr);
> +
> +	if (!result) {
> +		pr_err("DVB_DUMMY_FE: Failed to register the adapter, errno:%d",
> +			result);
> +		goto err;
> +	}
> +
> +	result = dvb_register_frontend(adapter, fe);
> +	if (!result) {
> +		pr_err("DVB_DUMMY_FE: Failed to register the frontend, errno:%d",
> +			result);
> +		goto err;
> +	}
> +
> +	return result;
> +
> +err:
> +	dvb_unregister_adapter(adapter);
> +	dvb_unregister_frontend(fe);
> +	dvb_frontend_detach(fe);
> +	return result;
> +
>  }
>  
>  static int dvb_dummy_fe_set_tone(struct dvb_frontend *fe,
> @@ -102,6 +131,12 @@ static int dvb_dummy_fe_set_voltage(struct dvb_frontend *fe,
>  static void dvb_dummy_fe_release(struct dvb_frontend* fe)
>  {
>  	struct dvb_dummy_fe_state* state = fe->demodulator_priv;
> +	struct dvb_adapter *adapter = fe->dvb;
> +
> +	dvb_unregister_adapter(adapter);
> +	dvb_unregister_frontend(fe);
> +	dvb_frontend_detach(fe);
> +
>  	kfree(state);
>  }
>  



Cheers,
Mauro
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

WARNING: multiple messages have this Message-ID (diff)
From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
Cc: gregkh@linuxfoundation.org, rfontana@redhat.com,
	kstewart@linuxfoundation.org, tglx@linutronix.de,
	skhan@linuxfoundation.org,
	linux-kernel-mentees@lists.linuxfoundation.org,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: dummy_dvb_fe: register adapter/frontend
Date: Sun, 1 Dec 2019 08:56:02 +0100	[thread overview]
Message-ID: <20191201085602.7212436b@kernel.org> (raw)
In-Reply-To: <20191126153157.26355-1-dwlsalmeida@gmail.com>

Em Tue, 26 Nov 2019 12:31:57 -0300
"Daniel W. S. Almeida" <dwlsalmeida@gmail.com> escreveu:

> From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
> 
> Before using the DTV frontend core, a bridge driver should register the
> new frontend at the subsystem and unregister it at device detach / removal.

This patch is conceptually wrong. The dummy_dvb_fe is a frontend driver.

As such, it doesn't register itself as a bridge. What we need here is a
separate virtual DVB bridge driver with would register itself as a DVB
adapter and use the dummy_dvb_fe as its frontend.

Regards,
Mauro

> 
> Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
> ---
>  drivers/media/dvb-frontends/dvb_dummy_fe.c | 39 ++++++++++++++++++++--
>  1 file changed, 37 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/dvb-frontends/dvb_dummy_fe.c b/drivers/media/dvb-frontends/dvb_dummy_fe.c
> index 4db679cb70ad..1ccb58c67e8e 100644
> --- a/drivers/media/dvb-frontends/dvb_dummy_fe.c
> +++ b/drivers/media/dvb-frontends/dvb_dummy_fe.c
> @@ -13,12 +13,12 @@
>  #include <media/dvb_frontend.h>
>  #include "dvb_dummy_fe.h"
>  
> +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
>  
>  struct dvb_dummy_fe_state {
>  	struct dvb_frontend frontend;
>  };
>  
> -
>  static int dvb_dummy_fe_read_status(struct dvb_frontend *fe,
>  				    enum fe_status *status)
>  {
> @@ -84,7 +84,36 @@ static int dvb_dummy_fe_sleep(struct dvb_frontend* fe)
>  
>  static int dvb_dummy_fe_init(struct dvb_frontend* fe)
>  {
> -	return 0;
> +	int result = 0;
> +	struct dvb_adapter *adapter = fe->dvb;
> +
> +	result = dvb_register_adapter(adapter,
> +				      KBUILD_MODNAME,
> +				      THIS_MODULE,
> +				      adapter->device,
> +				      adapter_nr);
> +
> +	if (!result) {
> +		pr_err("DVB_DUMMY_FE: Failed to register the adapter, errno:%d",
> +			result);
> +		goto err;
> +	}
> +
> +	result = dvb_register_frontend(adapter, fe);
> +	if (!result) {
> +		pr_err("DVB_DUMMY_FE: Failed to register the frontend, errno:%d",
> +			result);
> +		goto err;
> +	}
> +
> +	return result;
> +
> +err:
> +	dvb_unregister_adapter(adapter);
> +	dvb_unregister_frontend(fe);
> +	dvb_frontend_detach(fe);
> +	return result;
> +
>  }
>  
>  static int dvb_dummy_fe_set_tone(struct dvb_frontend *fe,
> @@ -102,6 +131,12 @@ static int dvb_dummy_fe_set_voltage(struct dvb_frontend *fe,
>  static void dvb_dummy_fe_release(struct dvb_frontend* fe)
>  {
>  	struct dvb_dummy_fe_state* state = fe->demodulator_priv;
> +	struct dvb_adapter *adapter = fe->dvb;
> +
> +	dvb_unregister_adapter(adapter);
> +	dvb_unregister_frontend(fe);
> +	dvb_frontend_detach(fe);
> +
>  	kfree(state);
>  }
>  



Cheers,
Mauro

  reply	other threads:[~2019-12-01  7:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 15:31 [Linux-kernel-mentees] [PATCH] media: dummy_dvb_fe: register adapter/frontend Daniel W. S. Almeida
2019-11-26 15:31 ` Daniel W. S. Almeida
2019-12-01  7:56 ` Mauro Carvalho Chehab [this message]
2019-12-01  7:56   ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191201085602.7212436b@kernel.org \
    --to=mchehab@kernel.org \
    --cc=dwlsalmeida@gmail.com \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=rfontana@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.