linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: milo.kim@ti.com, cw00.choi@samsung.com, k.kozlowski@samsung.com,
	sbkim73@samsung.com, tony@atomide.com,
	linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-omap@vger.kernel.org
Subject: Re: [PATCH 4/7] mfd: rc5t583: Use devm_mfd_add_devices and devm_request_threaded_irq
Date: Thu, 28 Apr 2016 10:08:47 +0100	[thread overview]
Message-ID: <20160428090847.GP4892@dell> (raw)
In-Reply-To: <1461241558-26983-5-git-send-email-ldewangan@nvidia.com>

On Thu, 21 Apr 2016, Laxman Dewangan wrote:

> Use devm_mfd_add_devices() for adding MFD child devices and
> devm_request_threaded_irq() for IRQ registration.
> 
> This reduces the need of remove callback for removing MFD child
> devices and unregistering IRQ.
> 
> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
> ---
>  drivers/mfd/rc5t583-irq.c | 11 ++---------
>  drivers/mfd/rc5t583.c     | 24 +++---------------------
>  2 files changed, 5 insertions(+), 30 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/rc5t583-irq.c b/drivers/mfd/rc5t583-irq.c
> index 3f8812d..f8dde59 100644
> --- a/drivers/mfd/rc5t583-irq.c
> +++ b/drivers/mfd/rc5t583-irq.c
> @@ -389,17 +389,10 @@ int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base)
>  		irq_clear_status_flags(__irq, IRQ_NOREQUEST);
>  	}
>  
> -	ret = request_threaded_irq(irq, NULL, rc5t583_irq, IRQF_ONESHOT,
> -				"rc5t583", rc5t583);
> +	ret = devm_request_threaded_irq(rc5t583->dev, irq, NULL, rc5t583_irq,
> +					IRQF_ONESHOT, "rc5t583", rc5t583);
>  	if (ret < 0)
>  		dev_err(rc5t583->dev,
>  			"Error in registering interrupt error: %d\n", ret);
>  	return ret;
>  }
> -
> -int rc5t583_irq_exit(struct rc5t583 *rc5t583)
> -{
> -	if (rc5t583->chip_irq)
> -		free_irq(rc5t583->chip_irq, rc5t583);
> -	return 0;
> -}
> diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c
> index fc2b2d9..d12243d 100644
> --- a/drivers/mfd/rc5t583.c
> +++ b/drivers/mfd/rc5t583.c
> @@ -252,7 +252,6 @@ static int rc5t583_i2c_probe(struct i2c_client *i2c,
>  	struct rc5t583 *rc5t583;
>  	struct rc5t583_platform_data *pdata = dev_get_platdata(&i2c->dev);
>  	int ret;
> -	bool irq_init_success = false;
>  
>  	if (!pdata) {
>  		dev_err(&i2c->dev, "Err: Platform data not found\n");
> @@ -284,32 +283,16 @@ static int rc5t583_i2c_probe(struct i2c_client *i2c,
>  		/* Still continue with warning, if irq init fails */
>  		if (ret)
>  			dev_warn(&i2c->dev, "IRQ init failed: %d\n", ret);
> -		else
> -			irq_init_success = true;
>  	}
>  
> -	ret = mfd_add_devices(rc5t583->dev, -1, rc5t583_subdevs,
> -			      ARRAY_SIZE(rc5t583_subdevs), NULL, 0, NULL);
> +	ret = devm_mfd_add_devices(rc5t583->dev, -1, rc5t583_subdevs,
> +				   ARRAY_SIZE(rc5t583_subdevs), NULL, 0, NULL);
>  	if (ret) {
>  		dev_err(&i2c->dev, "add mfd devices failed: %d\n", ret);
> -		goto err_add_devs;
> +		return ret;
>  	}
>  
>  	return 0;
> -
> -err_add_devs:
> -	if (irq_init_success)
> -		rc5t583_irq_exit(rc5t583);
> -	return ret;
> -}
> -
> -static int  rc5t583_i2c_remove(struct i2c_client *i2c)
> -{
> -	struct rc5t583 *rc5t583 = i2c_get_clientdata(i2c);
> -
> -	mfd_remove_devices(rc5t583->dev);
> -	rc5t583_irq_exit(rc5t583);
> -	return 0;
>  }
>  
>  static const struct i2c_device_id rc5t583_i2c_id[] = {
> @@ -324,7 +307,6 @@ static struct i2c_driver rc5t583_i2c_driver = {
>  		   .name = "rc5t583",
>  		   },
>  	.probe = rc5t583_i2c_probe,
> -	.remove = rc5t583_i2c_remove,
>  	.id_table = rc5t583_i2c_id,
>  };
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2016-04-28  9:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21 12:25 [PATCH 0/7] mfd: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Laxman Dewangan
2016-04-21 12:25 ` [PATCH 1/7] mfd: as3722: " Laxman Dewangan
2016-04-28  9:07   ` Lee Jones
2016-04-21 12:25 ` [PATCH 2/7] mfd: lp8788: " Laxman Dewangan
2016-04-21 23:15   ` Kim, Milo
2016-04-22  8:50     ` Laxman Dewangan
2016-04-21 12:25 ` [PATCH 3/7] mfd: max77686: " Laxman Dewangan
2016-04-25 10:57   ` Krzysztof Kozlowski
2016-04-28  9:01     ` Lee Jones
2016-04-28 10:02       ` Laxman Dewangan
2016-04-28 10:39         ` Krzysztof Kozlowski
2016-04-28  9:08   ` Lee Jones
2016-04-21 12:25 ` [PATCH 4/7] mfd: rc5t583: Use devm_mfd_add_devices and devm_request_threaded_irq Laxman Dewangan
2016-04-28  9:08   ` Lee Jones [this message]
2016-04-21 12:25 ` [PATCH 5/7] mfd: sec: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Laxman Dewangan
2016-04-25 12:45   ` Krzysztof Kozlowski
2016-04-28  9:10   ` Lee Jones
2016-04-21 12:25 ` [PATCH 6/7] mfd: tps65910: " Laxman Dewangan
2016-04-28  9:10   ` Lee Jones
2016-04-21 12:25 ` [PATCH 7/7] mfd: wl1273-core: Use devm_mfd_add_devices() for mfd_device registration Laxman Dewangan
2016-04-28  9:11   ` Lee Jones
2016-04-25 10:56 ` [PATCH 0/7] mfd: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Krzysztof Kozlowski
2016-04-25 12:52   ` Laxman Dewangan

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=20160428090847.GP4892@dell \
    --to=lee.jones@linaro.org \
    --cc=cw00.choi@samsung.com \
    --cc=k.kozlowski@samsung.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=milo.kim@ti.com \
    --cc=sbkim73@samsung.com \
    --cc=tony@atomide.com \
    /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;
as well as URLs for NNTP newsgroup(s).