diff mbox series

[v5,7/9] media: adv748x: only activate DAI if it is described in device tree

Message ID c3c8ece14c0fbc987dc201c9b61dd22d98f83056.1585852001.git.alexander.riesen@cetitec.com (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series media: adv748x: add support for HDMI audio | expand

Commit Message

Alex Riesen April 2, 2020, 6:34 p.m. UTC
To avoid setting it up even if the hardware is not actually connected
to anything physically.

Besides, the bindings explicitly notes that port definitions are
"optional if they are not connected to anything at the hardware level".

Signed-off-by: Alexander Riesen <alexander.riesen@cetitec.com>
---
 drivers/media/i2c/adv748x/adv748x-dai.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Kieran Bingham June 18, 2020, 4:17 p.m. UTC | #1
Hi Alex,

On 02/04/2020 19:34, Alex Riesen wrote:
> To avoid setting it up even if the hardware is not actually connected
> to anything physically.
> 
> Besides, the bindings explicitly notes that port definitions are
> "optional if they are not connected to anything at the hardware level".
> 
> Signed-off-by: Alexander Riesen <alexander.riesen@cetitec.com>
> ---
>  drivers/media/i2c/adv748x/adv748x-dai.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/media/i2c/adv748x/adv748x-dai.c b/drivers/media/i2c/adv748x/adv748x-dai.c
> index 185f78023e91..f9cc47fa9ad1 100644
> --- a/drivers/media/i2c/adv748x/adv748x-dai.c
> +++ b/drivers/media/i2c/adv748x/adv748x-dai.c
> @@ -216,6 +216,11 @@ int adv748x_dai_init(struct adv748x_dai *dai)
>  	int ret;
>  	struct adv748x_state *state = adv748x_dai_to_state(dai);
>  
> +	if (!state->endpoints[ADV748X_PORT_I2S]) {
> +		adv_info(state, "no I2S port, DAI disabled\n");
> +		ret = 0;
> +		goto fail;

How about just 'return 0'?

> +	}

And a blank line here ...

Otherwise,

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

This could also be folded into 5/9 too I guess?, though it is easier to
review the sequential additions, rather than the one-big-feature
addition ;-)


>  	dai->mclk_name = kasprintf(GFP_KERNEL, "%s.%s-i2s-mclk",
>  				   state->dev->driver->name,
>  				   dev_name(state->dev));
>
Alex Riesen June 19, 2020, 9:10 a.m. UTC | #2
Kieran Bingham, Thu, Jun 18, 2020 18:17:04 +0200:
> On 02/04/2020 19:34, Alex Riesen wrote:
> > To avoid setting it up even if the hardware is not actually connected
> > to anything physically.
> > 
> > Besides, the bindings explicitly notes that port definitions are
> > "optional if they are not connected to anything at the hardware level".
> > 
> > Signed-off-by: Alexander Riesen <alexander.riesen@cetitec.com>
> > ---
> >  drivers/media/i2c/adv748x/adv748x-dai.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/drivers/media/i2c/adv748x/adv748x-dai.c b/drivers/media/i2c/adv748x/adv748x-dai.c
> > index 185f78023e91..f9cc47fa9ad1 100644
> > --- a/drivers/media/i2c/adv748x/adv748x-dai.c
> > +++ b/drivers/media/i2c/adv748x/adv748x-dai.c
> > @@ -216,6 +216,11 @@ int adv748x_dai_init(struct adv748x_dai *dai)
> >  	int ret;
> >  	struct adv748x_state *state = adv748x_dai_to_state(dai);
> >  
> > +	if (!state->endpoints[ADV748X_PORT_I2S]) {
> > +		adv_info(state, "no I2S port, DAI disabled\n");
> > +		ret = 0;
> > +		goto fail;
> 
> How about just 'return 0'?

Indeed. In the retrospect, the whole event of loading the DAI driver does not
feel that important anymore to warrant logging on info prio.

> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> 
> This could also be folded into 5/9 too I guess?, though it is easier to
> review the sequential additions, rather than the one-big-feature
> addition ;-)

I would prefer to have it separately, if you don't mind: maybe not a big one,
but loading a driver without hardware for it *is* an event.

Thanks,
Alex
diff mbox series

Patch

diff --git a/drivers/media/i2c/adv748x/adv748x-dai.c b/drivers/media/i2c/adv748x/adv748x-dai.c
index 185f78023e91..f9cc47fa9ad1 100644
--- a/drivers/media/i2c/adv748x/adv748x-dai.c
+++ b/drivers/media/i2c/adv748x/adv748x-dai.c
@@ -216,6 +216,11 @@  int adv748x_dai_init(struct adv748x_dai *dai)
 	int ret;
 	struct adv748x_state *state = adv748x_dai_to_state(dai);
 
+	if (!state->endpoints[ADV748X_PORT_I2S]) {
+		adv_info(state, "no I2S port, DAI disabled\n");
+		ret = 0;
+		goto fail;
+	}
 	dai->mclk_name = kasprintf(GFP_KERNEL, "%s.%s-i2s-mclk",
 				   state->dev->driver->name,
 				   dev_name(state->dev));