* [PATCH] extcon: max77693: Use max77693_update_reg for rmw operations
@ 2012-10-02 15:59 Axel Lin
2012-10-04 1:33 ` Chanwoo Choi
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-10-02 15:59 UTC (permalink / raw)
To: linux-kernel; +Cc: MyungJoo Ham, Chanwoo Choi
This simplifies the code.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/extcon/extcon-max77693.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index e21387e..e0ed622 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -239,25 +239,19 @@ const char *max77693_extcon_cable[] = {
static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
enum max77693_muic_adc_debounce_time time)
{
- int ret = 0;
- u8 ctrl3;
+ int ret;
switch (time) {
case ADC_DEBOUNCE_TIME_5MS:
case ADC_DEBOUNCE_TIME_10MS:
case ADC_DEBOUNCE_TIME_25MS:
case ADC_DEBOUNCE_TIME_38_62MS:
- ret = max77693_read_reg(info->max77693->regmap_muic,
- MAX77693_MUIC_REG_CTRL3, &ctrl3);
- ctrl3 &= ~CONTROL3_ADCDBSET_MASK;
- ctrl3 |= (time << CONTROL3_ADCDBSET_SHIFT);
-
- ret = max77693_write_reg(info->max77693->regmap_muic,
- MAX77693_MUIC_REG_CTRL3, ctrl3);
- if (ret) {
+ ret = max77693_update_reg(info->max77693->regmap_muic,
+ MAX77693_MUIC_REG_CTRL3,
+ time << CONTROL3_ADCDBSET_SHIFT,
+ CONTROL3_ADCDBSET_MASK);
+ if (ret)
dev_err(info->dev, "failed to set ADC debounce time\n");
- ret = -EINVAL;
- }
break;
default:
dev_err(info->dev, "invalid ADC debounce time\n");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] extcon: max77693: Use max77693_update_reg for rmw operations
2012-10-02 15:59 [PATCH] extcon: max77693: Use max77693_update_reg for rmw operations Axel Lin
@ 2012-10-04 1:33 ` Chanwoo Choi
0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2012-10-04 1:33 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, MyungJoo Ham, Greg KH
On 10/03/2012 12:59 AM, Axel Lin wrote:
> This simplifies the code.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/extcon/extcon-max77693.c | 18 ++++++------------
> 1 file changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
> index e21387e..e0ed622 100644
> --- a/drivers/extcon/extcon-max77693.c
> +++ b/drivers/extcon/extcon-max77693.c
> @@ -239,25 +239,19 @@ const char *max77693_extcon_cable[] = {
> static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
> enum max77693_muic_adc_debounce_time time)
> {
> - int ret = 0;
> - u8 ctrl3;
> + int ret;
>
> switch (time) {
> case ADC_DEBOUNCE_TIME_5MS:
> case ADC_DEBOUNCE_TIME_10MS:
> case ADC_DEBOUNCE_TIME_25MS:
> case ADC_DEBOUNCE_TIME_38_62MS:
> - ret = max77693_read_reg(info->max77693->regmap_muic,
> - MAX77693_MUIC_REG_CTRL3, &ctrl3);
> - ctrl3 &= ~CONTROL3_ADCDBSET_MASK;
> - ctrl3 |= (time << CONTROL3_ADCDBSET_SHIFT);
> -
> - ret = max77693_write_reg(info->max77693->regmap_muic,
> - MAX77693_MUIC_REG_CTRL3, ctrl3);
> - if (ret) {
> + ret = max77693_update_reg(info->max77693->regmap_muic,
> + MAX77693_MUIC_REG_CTRL3,
> + time << CONTROL3_ADCDBSET_SHIFT,
> + CONTROL3_ADCDBSET_MASK);
> + if (ret)
> dev_err(info->dev, "failed to set ADC debounce time\n");
> - ret = -EINVAL;
> - }
> break;
> default:
> dev_err(info->dev, "invalid ADC debounce time\n");
Applied, thanks.
Cheers,
Chanwoo Choi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-04 1:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-02 15:59 [PATCH] extcon: max77693: Use max77693_update_reg for rmw operations Axel Lin
2012-10-04 1:33 ` Chanwoo Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox