All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Josh Cartwright <joshc@codeaurora.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 2/9] Input: pmic8xxx-keypad - Migrate to devm_* APIs
Date: Wed, 26 Feb 2014 16:20:13 -0800	[thread overview]
Message-ID: <530E84BD.4010403@codeaurora.org> (raw)
In-Reply-To: <20140227000919.GE18563@joshc.qualcomm.com>

On 02/26/14 16:09, Josh Cartwright wrote:
> On Wed, Feb 26, 2014 at 11:05:55AM -0800, Stephen Boyd wrote:
>> Simplify the error paths and reduce the lines of code in this
>> driver by using the devm_* APIs.
>>
>> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
>> ---
>>  drivers/input/keyboard/pmic8xxx-keypad.c | 62 +++++++++-----------------------
>>  1 file changed, 17 insertions(+), 45 deletions(-)
>>
>> diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c
>> index 2c9f19ac35ea..4e6bfbf94ae4 100644
>> --- a/drivers/input/keyboard/pmic8xxx-keypad.c
>> +++ b/drivers/input/keyboard/pmic8xxx-keypad.c
> [..]
>> @@ -634,7 +629,7 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
>>  					kp->keycodes, kp->input);
>>  	if (rc) {
>>  		dev_err(&pdev->dev, "failed to build keymap\n");
>> -		goto err_get_irq;
>> +		return rc;
>>  	}
>>  
>>  	if (pdata->rep)
>> @@ -650,7 +645,7 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
>>  	rc = pmic8xxx_kpd_init(kp);
>>  	if (rc < 0) {
>>  		dev_err(&pdev->dev, "unable to initialize keypad controller\n");
>> -		goto err_get_irq;
>> +		return rc;
>>  	}
>>  
>>  	rc = pmic8xxx_kp_config_gpio(pdata->cols_gpio_start,
>> @@ -667,24 +662,26 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
>>  		goto err_gpio_config;
> See below.
>
>>  	}
>>  
>> -	rc = request_any_context_irq(kp->key_sense_irq, pmic8xxx_kp_irq,
>> -				 IRQF_TRIGGER_RISING, "pmic-keypad", kp);
>> +	rc = devm_request_any_context_irq(&pdev->dev, kp->key_sense_irq,
>> +			pmic8xxx_kp_irq, IRQF_TRIGGER_RISING, "pmic-keypad",
>> +			kp);
>>  	if (rc < 0) {
>>  		dev_err(&pdev->dev, "failed to request keypad sense irq\n");
>> -		goto err_get_irq;
>> +		return rc;
>>  	}
>>  
>> -	rc = request_any_context_irq(kp->key_stuck_irq, pmic8xxx_kp_stuck_irq,
>> -				 IRQF_TRIGGER_RISING, "pmic-keypad-stuck", kp);
>> +	rc = devm_request_any_context_irq(&pdev->dev, kp->key_stuck_irq,
>> +			pmic8xxx_kp_stuck_irq, IRQF_TRIGGER_RISING,
>> +			"pmic-keypad-stuck", kp);
>>  	if (rc < 0) {
>>  		dev_err(&pdev->dev, "failed to request keypad stuck irq\n");
>> -		goto err_req_stuck_irq;
>> +		return rc;
>>  	}
>>  
>>  	rc = pmic8xxx_kp_read_u8(kp, &ctrl_val, KEYP_CTRL);
>>  	if (rc < 0) {
>>  		dev_err(&pdev->dev, "failed to read KEYP_CTRL register\n");
>> -		goto err_pmic_reg_read;
>> +		return rc;
>>  	}
>>  
>>  	kp->ctrl_reg = ctrl_val;
>> @@ -692,36 +689,12 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
>>  	rc = input_register_device(kp->input);
>>  	if (rc < 0) {
>>  		dev_err(&pdev->dev, "unable to register keypad input device\n");
>> -		goto err_pmic_reg_read;
>> +		return rc;
>>  	}
>>  
>>  	device_init_wakeup(&pdev->dev, pdata->wakeup);
>>  
>>  	return 0;
>> -
>> -err_pmic_reg_read:
>> -	free_irq(kp->key_stuck_irq, kp);
>> -err_req_stuck_irq:
>> -	free_irq(kp->key_sense_irq, kp);
>> -err_gpio_config:
> You're removing this label, even though it's still used above. :(
>

Ah, thanks. Will fix.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 2/9] Input: pmic8xxx-keypad - Migrate to devm_* APIs
Date: Wed, 26 Feb 2014 16:20:13 -0800	[thread overview]
Message-ID: <530E84BD.4010403@codeaurora.org> (raw)
In-Reply-To: <20140227000919.GE18563@joshc.qualcomm.com>

On 02/26/14 16:09, Josh Cartwright wrote:
> On Wed, Feb 26, 2014 at 11:05:55AM -0800, Stephen Boyd wrote:
>> Simplify the error paths and reduce the lines of code in this
>> driver by using the devm_* APIs.
>>
>> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
>> ---
>>  drivers/input/keyboard/pmic8xxx-keypad.c | 62 +++++++++-----------------------
>>  1 file changed, 17 insertions(+), 45 deletions(-)
>>
>> diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c
>> index 2c9f19ac35ea..4e6bfbf94ae4 100644
>> --- a/drivers/input/keyboard/pmic8xxx-keypad.c
>> +++ b/drivers/input/keyboard/pmic8xxx-keypad.c
> [..]
>> @@ -634,7 +629,7 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
>>  					kp->keycodes, kp->input);
>>  	if (rc) {
>>  		dev_err(&pdev->dev, "failed to build keymap\n");
>> -		goto err_get_irq;
>> +		return rc;
>>  	}
>>  
>>  	if (pdata->rep)
>> @@ -650,7 +645,7 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
>>  	rc = pmic8xxx_kpd_init(kp);
>>  	if (rc < 0) {
>>  		dev_err(&pdev->dev, "unable to initialize keypad controller\n");
>> -		goto err_get_irq;
>> +		return rc;
>>  	}
>>  
>>  	rc = pmic8xxx_kp_config_gpio(pdata->cols_gpio_start,
>> @@ -667,24 +662,26 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
>>  		goto err_gpio_config;
> See below.
>
>>  	}
>>  
>> -	rc = request_any_context_irq(kp->key_sense_irq, pmic8xxx_kp_irq,
>> -				 IRQF_TRIGGER_RISING, "pmic-keypad", kp);
>> +	rc = devm_request_any_context_irq(&pdev->dev, kp->key_sense_irq,
>> +			pmic8xxx_kp_irq, IRQF_TRIGGER_RISING, "pmic-keypad",
>> +			kp);
>>  	if (rc < 0) {
>>  		dev_err(&pdev->dev, "failed to request keypad sense irq\n");
>> -		goto err_get_irq;
>> +		return rc;
>>  	}
>>  
>> -	rc = request_any_context_irq(kp->key_stuck_irq, pmic8xxx_kp_stuck_irq,
>> -				 IRQF_TRIGGER_RISING, "pmic-keypad-stuck", kp);
>> +	rc = devm_request_any_context_irq(&pdev->dev, kp->key_stuck_irq,
>> +			pmic8xxx_kp_stuck_irq, IRQF_TRIGGER_RISING,
>> +			"pmic-keypad-stuck", kp);
>>  	if (rc < 0) {
>>  		dev_err(&pdev->dev, "failed to request keypad stuck irq\n");
>> -		goto err_req_stuck_irq;
>> +		return rc;
>>  	}
>>  
>>  	rc = pmic8xxx_kp_read_u8(kp, &ctrl_val, KEYP_CTRL);
>>  	if (rc < 0) {
>>  		dev_err(&pdev->dev, "failed to read KEYP_CTRL register\n");
>> -		goto err_pmic_reg_read;
>> +		return rc;
>>  	}
>>  
>>  	kp->ctrl_reg = ctrl_val;
>> @@ -692,36 +689,12 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
>>  	rc = input_register_device(kp->input);
>>  	if (rc < 0) {
>>  		dev_err(&pdev->dev, "unable to register keypad input device\n");
>> -		goto err_pmic_reg_read;
>> +		return rc;
>>  	}
>>  
>>  	device_init_wakeup(&pdev->dev, pdata->wakeup);
>>  
>>  	return 0;
>> -
>> -err_pmic_reg_read:
>> -	free_irq(kp->key_stuck_irq, kp);
>> -err_req_stuck_irq:
>> -	free_irq(kp->key_sense_irq, kp);
>> -err_gpio_config:
> You're removing this label, even though it's still used above. :(
>

Ah, thanks. Will fix.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

  reply	other threads:[~2014-02-27  0:20 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-26 19:05 [PATCH v3 0/9] Use regmap+devm+DT in pm8xxx input drivers Stephen Boyd
2014-02-26 19:05 ` Stephen Boyd
2014-02-26 19:05 ` [PATCH v3 1/9] Input: pmic8xxx-pwrkey - Migrate to regmap APIs Stephen Boyd
2014-02-26 19:05   ` Stephen Boyd
2014-02-26 19:05   ` Stephen Boyd
2014-02-26 23:59   ` Josh Cartwright
2014-02-26 23:59     ` Josh Cartwright
2014-02-27  0:05     ` Stephen Boyd
2014-02-27  0:05       ` Stephen Boyd
2014-02-27  0:13       ` Josh Cartwright
2014-02-27  0:13         ` Josh Cartwright
2014-02-27  0:20         ` Stephen Boyd
2014-02-27  0:20           ` Stephen Boyd
2014-02-27  0:30           ` Josh Cartwright
2014-02-27  0:30             ` Josh Cartwright
2014-02-27  0:43             ` Stephen Boyd
2014-02-27  0:43               ` Stephen Boyd
2014-02-27  2:31               ` Josh Cartwright
2014-02-27  2:31                 ` Josh Cartwright
2014-02-26 19:05 ` [PATCH v3 2/9] Input: pmic8xxx-keypad - Migrate to devm_* APIs Stephen Boyd
2014-02-26 19:05   ` Stephen Boyd
2014-02-27  0:09   ` Josh Cartwright
2014-02-27  0:09     ` Josh Cartwright
2014-02-27  0:20     ` Stephen Boyd [this message]
2014-02-27  0:20       ` Stephen Boyd
2014-02-26 19:05 ` [PATCH v3 3/9] Input: pmic8xxx-keypad - Migrate to regmap APIs Stephen Boyd
2014-02-26 19:05   ` Stephen Boyd
2014-02-26 19:05 ` [PATCH v3 4/9] Input: pmic8xxx-pwrkey - Migrate to DT Stephen Boyd
2014-02-26 19:05   ` Stephen Boyd
2014-02-26 19:05 ` [PATCH v3 5/9] Input: pm8xxx-vibrator - Add DT match table Stephen Boyd
2014-02-26 19:05   ` Stephen Boyd
2014-02-26 19:05 ` [PATCH v3 6/9] Input: pmic8xxx-keypad - Migrate to DT Stephen Boyd
2014-02-26 19:05   ` Stephen Boyd
2014-02-26 19:06 ` [PATCH v3 7/9] devicetree: bindings: Document PM8921/8058 keypads Stephen Boyd
2014-02-26 19:06   ` Stephen Boyd
2014-02-26 19:06   ` Stephen Boyd
2014-02-26 19:06 ` [PATCH v3 8/9] devicetree: bindings: Document PM8921/8058 power keys Stephen Boyd
2014-02-26 19:06   ` Stephen Boyd
2014-02-26 19:06   ` Stephen Boyd
2014-02-26 19:06 ` [PATCH v3 9/9] devicetree: bindings: Document PM8921/8058 vibrators Stephen Boyd
2014-02-26 19:06   ` Stephen Boyd
2014-02-26 19:06   ` Stephen Boyd

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=530E84BD.4010403@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=joshc@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.