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]
Date:	Fri, 25 Apr 2014 10:16:42 -0500
From:	Felipe Balbi <balbi@...com>
To:	Chanwoo Choi <cw00.choi@...sung.com>
CC:	<linux-kernel@...r.kernel.org>, <myungjoo.ham@...sung.com>,
	<balbi@...com>, <gg@...mlogic.co.uk>, <kishon@...com>,
	<ckeepax@...nsource.wolfsonmicro.com>, <broonie@...nel.org>,
	<k.kozlowski@...sung.com>, <kyungmin.park@...sung.com>,
	<patches@...nsource.wolfsonmicro.com>
Subject: Re: [PATCHv4 6/9] extcon: arizona: Use devm_extcon_dev_allocate for
 extcon_dev

On Fri, Apr 25, 2014 at 09:42:21AM +0900, Chanwoo Choi wrote:
> This patch use devm_extcon_dev_allocate() to simplify the memory control
> of extcon device.
> 
> Cc: Charles Keepax <ckeepax@...nsource.wolfsonmicro.com>
> Cc: Mark Brown <broonie@...nel.org>
> Cc: patches@...nsource.wolfsonmicro.com
> Signed-off-by: Chanwoo Choi <cw00.choi@...sung.com>
> Acked-by: Charles Keepax <ckeepax@...nsource.wolfsonmicro.com>

Reviewed-by: Felipe Balbi <balbi@...com>

> ---
>  drivers/extcon/extcon-arizona.c | 30 +++++++++++++++++-------------
>  1 file changed, 17 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> index f63fa6f..6c84e3d 100644
> --- a/drivers/extcon/extcon-arizona.c
> +++ b/drivers/extcon/extcon-arizona.c
> @@ -91,7 +91,7 @@ struct arizona_extcon_info {
>  
>  	int hpdet_ip;
>  
> -	struct extcon_dev edev;
> +	struct extcon_dev *edev;
>  };
>  
>  static const struct arizona_micd_config micd_default_modes[] = {
> @@ -546,7 +546,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
>  	}
>  
>  	/* If the cable was removed while measuring ignore the result */
> -	ret = extcon_get_cable_state_(&info->edev, ARIZONA_CABLE_MECHANICAL);
> +	ret = extcon_get_cable_state_(info->edev, ARIZONA_CABLE_MECHANICAL);
>  	if (ret < 0) {
>  		dev_err(arizona->dev, "Failed to check cable state: %d\n",
>  			ret);
> @@ -581,7 +581,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
>  	else
>  		report = ARIZONA_CABLE_HEADPHONE;
>  
> -	ret = extcon_set_cable_state_(&info->edev, report, true);
> +	ret = extcon_set_cable_state_(info->edev, report, true);
>  	if (ret != 0)
>  		dev_err(arizona->dev, "Failed to report HP/line: %d\n",
>  			ret);
> @@ -664,7 +664,7 @@ err:
>  			   ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);
>  
>  	/* Just report headphone */
> -	ret = extcon_update_state(&info->edev,
> +	ret = extcon_update_state(info->edev,
>  				  1 << ARIZONA_CABLE_HEADPHONE,
>  				  1 << ARIZONA_CABLE_HEADPHONE);
>  	if (ret != 0)
> @@ -723,7 +723,7 @@ err:
>  			   ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);
>  
>  	/* Just report headphone */
> -	ret = extcon_update_state(&info->edev,
> +	ret = extcon_update_state(info->edev,
>  				  1 << ARIZONA_CABLE_HEADPHONE,
>  				  1 << ARIZONA_CABLE_HEADPHONE);
>  	if (ret != 0)
> @@ -764,7 +764,7 @@ static void arizona_micd_detect(struct work_struct *work)
>  	mutex_lock(&info->lock);
>  
>  	/* If the cable was removed while measuring ignore the result */
> -	ret = extcon_get_cable_state_(&info->edev, ARIZONA_CABLE_MECHANICAL);
> +	ret = extcon_get_cable_state_(info->edev, ARIZONA_CABLE_MECHANICAL);
>  	if (ret < 0) {
>  		dev_err(arizona->dev, "Failed to check cable state: %d\n",
>  				ret);
> @@ -812,7 +812,7 @@ static void arizona_micd_detect(struct work_struct *work)
>  	if (info->detecting && (val & ARIZONA_MICD_LVL_8)) {
>  		arizona_identify_headphone(info);
>  
> -		ret = extcon_update_state(&info->edev,
> +		ret = extcon_update_state(info->edev,
>  					  1 << ARIZONA_CABLE_MICROPHONE,
>  					  1 << ARIZONA_CABLE_MICROPHONE);
>  
> @@ -999,7 +999,7 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
>  
>  	if (info->last_jackdet == present) {
>  		dev_dbg(arizona->dev, "Detected jack\n");
> -		ret = extcon_set_cable_state_(&info->edev,
> +		ret = extcon_set_cable_state_(info->edev,
>  					      ARIZONA_CABLE_MECHANICAL, true);
>  
>  		if (ret != 0)
> @@ -1038,7 +1038,7 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
>  					 info->micd_ranges[i].key, 0);
>  		input_sync(info->input);
>  
> -		ret = extcon_update_state(&info->edev, 0xffffffff, 0);
> +		ret = extcon_update_state(info->edev, 0xffffffff, 0);
>  		if (ret != 0)
>  			dev_err(arizona->dev, "Removal report failed: %d\n",
>  				ret);
> @@ -1150,11 +1150,15 @@ static int arizona_extcon_probe(struct platform_device *pdev)
>  		break;
>  	}
>  
> -	info->edev.name = "Headset Jack";
> -	info->edev.dev.parent = arizona->dev;
> -	info->edev.supported_cable = arizona_cable;
> +	info->edev = devm_extcon_dev_allocate(&pdev->dev, arizona_cable);
> +	if (IS_ERR(info->edev)) {
> +		dev_err(&pdev->dev, "failed to allocate extcon device\n");
> +		return -ENOMEM;
> +	}
> +	info->edev->name = "Headset Jack";
> +	info->edev->dev.parent = arizona->dev;
>  
> -	ret = devm_extcon_dev_register(&pdev->dev, &info->edev);
> +	ret = devm_extcon_dev_register(&pdev->dev, info->edev);
>  	if (ret < 0) {
>  		dev_err(arizona->dev, "extcon_dev_register() failed: %d\n",
>  			ret);
> -- 
> 1.8.0
> 

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ