public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: "Frank Schäfer" <fschaefer.oss@googlemail.com>
To: Mauro Carvalho Chehab <m.chehab@samsung.com>, unlisted-recipients:;
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: Re: [PATCH 2/2] em28xx-dvb: remove one level of identation at fini callback
Date: Sat, 08 Mar 2014 19:31:02 +0100	[thread overview]
Message-ID: <531B61E6.1050801@googlemail.com> (raw)
In-Reply-To: <1394281177-5920-2-git-send-email-m.chehab@samsung.com>


Am 08.03.2014 13:19, schrieb Mauro Carvalho Chehab:
> Simplify the logic a little by removing one level of identation.
> Also, it only makes sense to print something if the .fini callback
> is actually doing something.
>
> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
> ---
>  drivers/media/usb/em28xx/em28xx-dvb.c | 48 +++++++++++++++++++----------------
>  1 file changed, 26 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
> index cacdca3a3412..6638394b3457 100644
> --- a/drivers/media/usb/em28xx/em28xx-dvb.c
> +++ b/drivers/media/usb/em28xx/em28xx-dvb.c
> @@ -1543,6 +1543,9 @@ static inline void prevent_sleep(struct dvb_frontend_ops *ops)
>  
>  static int em28xx_dvb_fini(struct em28xx *dev)
>  {
> +	struct em28xx_dvb *dvb;
> +	struct i2c_client *client;
> +
>  	if (dev->is_audio_only) {
>  		/* Shouldn't initialize IR for this interface */
>  		return 0;
> @@ -1553,35 +1556,36 @@ static int em28xx_dvb_fini(struct em28xx *dev)
>  		return 0;
>  	}
>  
> -	em28xx_info("Closing DVB extension");
> +	if (!dev->dvb)
> +		return 0;
>  
> -	if (dev->dvb) {
> -		struct em28xx_dvb *dvb = dev->dvb;
> -		struct i2c_client *client = dvb->i2c_client_tuner;
> +	em28xx_info("Closing DVB extension");
>  
> -		em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE);
> +	dvb = dev->dvb;
> +	client = dvb->i2c_client_tuner;
>  
> -		if (dev->disconnected) {
> -			/* We cannot tell the device to sleep
> -			 * once it has been unplugged. */
> -			if (dvb->fe[0])
> -				prevent_sleep(&dvb->fe[0]->ops);
> -			if (dvb->fe[1])
> -				prevent_sleep(&dvb->fe[1]->ops);
> -		}
> +	em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE);
>  
> -		/* remove I2C tuner */
> -		if (client) {
> -			module_put(client->dev.driver->owner);
> -			i2c_unregister_device(client);
> -		}
> +	if (dev->disconnected) {
> +		/* We cannot tell the device to sleep
> +		 * once it has been unplugged. */
> +		if (dvb->fe[0])
> +			prevent_sleep(&dvb->fe[0]->ops);
> +		if (dvb->fe[1])
> +			prevent_sleep(&dvb->fe[1]->ops);
> +	}
>  
> -		em28xx_unregister_dvb(dvb);
> -		kfree(dvb);
> -		dev->dvb = NULL;
> -		kref_put(&dev->ref, em28xx_free_device);
> +	/* remove I2C tuner */
> +	if (client) {
> +		module_put(client->dev.driver->owner);
> +		i2c_unregister_device(client);
>  	}
>  
> +	em28xx_unregister_dvb(dvb);
> +	kfree(dvb);
> +	dev->dvb = NULL;
> +	kref_put(&dev->ref, em28xx_free_device);
> +
>  	return 0;
>  }
>  

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>




  reply	other threads:[~2014-03-08 18:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-08 12:19 [PATCH v4 1/2] em28xx: Only deallocate struct em28xx after finishing all extensions Mauro Carvalho Chehab
2014-03-08 12:19 ` [PATCH 2/2] em28xx-dvb: remove one level of identation at fini callback Mauro Carvalho Chehab
2014-03-08 18:31   ` Frank Schäfer [this message]
2014-03-08 18:29 ` [PATCH v4 1/2] em28xx: Only deallocate struct em28xx after finishing all extensions Frank Schäfer

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=531B61E6.1050801@googlemail.com \
    --to=fschaefer.oss@googlemail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=mchehab@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox