lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160428090847.GP4892@dell>
Date:	Thu, 28 Apr 2016 10:08:47 +0100
From:	Lee Jones <lee.jones@...aro.org>
To:	Laxman Dewangan <ldewangan@...dia.com>
Cc:	milo.kim@...com, cw00.choi@...sung.com, k.kozlowski@...sung.com,
	sbkim73@...sung.com, tony@...mide.com,
	linux-kernel@...r.kernel.org, linux-samsung-soc@...r.kernel.org,
	linux-omap@...r.kernel.org
Subject: Re: [PATCH 4/7] mfd: rc5t583: Use devm_mfd_add_devices and
 devm_request_threaded_irq

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@...dia.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ