Re: [PATCH] leds: lm3642: Use regmap_update_bits() in lm3642_chip_init()
On Mon, Sep 24, 2012 at 8:58 AM, gshark wrote: > 2012년 09월 22일 15:40, Axel Lin 쓴 글: > >> Use regmap_update_bits() to replace regmap_read() + regmap_write(). >> With this patch, we only show the error message when regmap_update_bits() >> fails. > > Looks good..You're right. Thank you Alex. >> >> >> Signed-off-by: Axel Lin > > Acked-by: G.Shark Jeong > Thanks, applied to my for-next. -Bryan >> --- >> drivers/leds/leds-lm3642.c | 15 +++ >> 1 file changed, 3 insertions(+), 12 deletions(-) >> >> diff --git a/drivers/leds/leds-lm3642.c b/drivers/leds/leds-lm3642.c >> index 924853b..3285006 100644 >> --- a/drivers/leds/leds-lm3642.c >> +++ b/drivers/leds/leds-lm3642.c >> @@ -95,23 +95,14 @@ struct lm3642_chip_data { >> /* chip initialize */ >> static int __devinit lm3642_chip_init(struct lm3642_chip_data *chip) >> { >> - unsigned int reg_val; >> int ret; >> struct lm3642_platform_data *pdata = chip->pdata; >> /* set enable register */ >> - ret = regmap_read(chip->regmap, REG_ENABLE, _val); >> + ret = regmap_update_bits(chip->regmap, REG_ENABLE, >> EX_PIN_ENABLE_MASK, >> +pdata->tx_pin); >> if (ret < 0) >> - goto out; >> - >> - reg_val &= (~EX_PIN_ENABLE_MASK); >> - reg_val |= pdata->tx_pin; >> - ret = regmap_write(chip->regmap, REG_ENABLE, reg_val); >> - if (ret < 0) >> - goto out; >> - >> -out: >> - dev_err(chip->dev, "Failed to read REG_ENABLE Register\n"); >> + dev_err(chip->dev, "Failed to update REG_ENABLE >> Register\n"); >> return ret; >> } >> > > -- Bryan Wu Kernel Developer+86.186-168-78255 Mobile Canonical Ltd. www.canonical.com Ubuntu - Linux for human beings | www.ubuntu.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] leds: lm3642: Use regmap_update_bits() in lm3642_chip_init()
On Mon, Sep 24, 2012 at 8:58 AM, gshark gshark.je...@gmail.com wrote: 2012년 09월 22일 15:40, Axel Lin 쓴 글: Use regmap_update_bits() to replace regmap_read() + regmap_write(). With this patch, we only show the error message when regmap_update_bits() fails. Looks good..You're right. Thank you Alex. Signed-off-by: Axel Lin axel@ingics.com Acked-by: G.Shark Jeonggshark.je...@gmail.com Thanks, applied to my for-next. -Bryan --- drivers/leds/leds-lm3642.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/leds/leds-lm3642.c b/drivers/leds/leds-lm3642.c index 924853b..3285006 100644 --- a/drivers/leds/leds-lm3642.c +++ b/drivers/leds/leds-lm3642.c @@ -95,23 +95,14 @@ struct lm3642_chip_data { /* chip initialize */ static int __devinit lm3642_chip_init(struct lm3642_chip_data *chip) { - unsigned int reg_val; int ret; struct lm3642_platform_data *pdata = chip-pdata; /* set enable register */ - ret = regmap_read(chip-regmap, REG_ENABLE, reg_val); + ret = regmap_update_bits(chip-regmap, REG_ENABLE, EX_PIN_ENABLE_MASK, +pdata-tx_pin); if (ret 0) - goto out; - - reg_val = (~EX_PIN_ENABLE_MASK); - reg_val |= pdata-tx_pin; - ret = regmap_write(chip-regmap, REG_ENABLE, reg_val); - if (ret 0) - goto out; - -out: - dev_err(chip-dev, Failed to read REG_ENABLE Register\n); + dev_err(chip-dev, Failed to update REG_ENABLE Register\n); return ret; } -- Bryan Wu bryan...@canonical.com Kernel Developer+86.186-168-78255 Mobile Canonical Ltd. www.canonical.com Ubuntu - Linux for human beings | www.ubuntu.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] leds: lm3642: Use regmap_update_bits() in lm3642_chip_init()
2012년 09월 22일 15:40, Axel Lin 쓴 글: Use regmap_update_bits() to replace regmap_read() + regmap_write(). With this patch, we only show the error message when regmap_update_bits() fails. Looks good..You're right. Thank you Alex. Signed-off-by: Axel Lin Acked-by: G.Shark Jeong --- drivers/leds/leds-lm3642.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/leds/leds-lm3642.c b/drivers/leds/leds-lm3642.c index 924853b..3285006 100644 --- a/drivers/leds/leds-lm3642.c +++ b/drivers/leds/leds-lm3642.c @@ -95,23 +95,14 @@ struct lm3642_chip_data { /* chip initialize */ static int __devinit lm3642_chip_init(struct lm3642_chip_data *chip) { - unsigned int reg_val; int ret; struct lm3642_platform_data *pdata = chip->pdata; /* set enable register */ - ret = regmap_read(chip->regmap, REG_ENABLE, _val); + ret = regmap_update_bits(chip->regmap, REG_ENABLE, EX_PIN_ENABLE_MASK, +pdata->tx_pin); if (ret < 0) - goto out; - - reg_val &= (~EX_PIN_ENABLE_MASK); - reg_val |= pdata->tx_pin; - ret = regmap_write(chip->regmap, REG_ENABLE, reg_val); - if (ret < 0) - goto out; - -out: - dev_err(chip->dev, "Failed to read REG_ENABLE Register\n"); + dev_err(chip->dev, "Failed to update REG_ENABLE Register\n"); return ret; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] leds: lm3642: Use regmap_update_bits() in lm3642_chip_init()
2012년 09월 22일 15:40, Axel Lin 쓴 글: Use regmap_update_bits() to replace regmap_read() + regmap_write(). With this patch, we only show the error message when regmap_update_bits() fails. Looks good..You're right. Thank you Alex. Signed-off-by: Axel Lin axel@ingics.com Acked-by: G.Shark Jeonggshark.je...@gmail.com --- drivers/leds/leds-lm3642.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/leds/leds-lm3642.c b/drivers/leds/leds-lm3642.c index 924853b..3285006 100644 --- a/drivers/leds/leds-lm3642.c +++ b/drivers/leds/leds-lm3642.c @@ -95,23 +95,14 @@ struct lm3642_chip_data { /* chip initialize */ static int __devinit lm3642_chip_init(struct lm3642_chip_data *chip) { - unsigned int reg_val; int ret; struct lm3642_platform_data *pdata = chip-pdata; /* set enable register */ - ret = regmap_read(chip-regmap, REG_ENABLE, reg_val); + ret = regmap_update_bits(chip-regmap, REG_ENABLE, EX_PIN_ENABLE_MASK, +pdata-tx_pin); if (ret 0) - goto out; - - reg_val = (~EX_PIN_ENABLE_MASK); - reg_val |= pdata-tx_pin; - ret = regmap_write(chip-regmap, REG_ENABLE, reg_val); - if (ret 0) - goto out; - -out: - dev_err(chip-dev, Failed to read REG_ENABLE Register\n); + dev_err(chip-dev, Failed to update REG_ENABLE Register\n); return ret; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] leds: lm3642: Use regmap_update_bits() in lm3642_chip_init()
Use regmap_update_bits() to replace regmap_read() + regmap_write(). With this patch, we only show the error message when regmap_update_bits() fails. Signed-off-by: Axel Lin --- drivers/leds/leds-lm3642.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/leds/leds-lm3642.c b/drivers/leds/leds-lm3642.c index 924853b..3285006 100644 --- a/drivers/leds/leds-lm3642.c +++ b/drivers/leds/leds-lm3642.c @@ -95,23 +95,14 @@ struct lm3642_chip_data { /* chip initialize */ static int __devinit lm3642_chip_init(struct lm3642_chip_data *chip) { - unsigned int reg_val; int ret; struct lm3642_platform_data *pdata = chip->pdata; /* set enable register */ - ret = regmap_read(chip->regmap, REG_ENABLE, _val); + ret = regmap_update_bits(chip->regmap, REG_ENABLE, EX_PIN_ENABLE_MASK, +pdata->tx_pin); if (ret < 0) - goto out; - - reg_val &= (~EX_PIN_ENABLE_MASK); - reg_val |= pdata->tx_pin; - ret = regmap_write(chip->regmap, REG_ENABLE, reg_val); - if (ret < 0) - goto out; - -out: - dev_err(chip->dev, "Failed to read REG_ENABLE Register\n"); + dev_err(chip->dev, "Failed to update REG_ENABLE Register\n"); return ret; } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] leds: lm3642: Use regmap_update_bits() in lm3642_chip_init()
Use regmap_update_bits() to replace regmap_read() + regmap_write(). With this patch, we only show the error message when regmap_update_bits() fails. Signed-off-by: Axel Lin axel@ingics.com --- drivers/leds/leds-lm3642.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/leds/leds-lm3642.c b/drivers/leds/leds-lm3642.c index 924853b..3285006 100644 --- a/drivers/leds/leds-lm3642.c +++ b/drivers/leds/leds-lm3642.c @@ -95,23 +95,14 @@ struct lm3642_chip_data { /* chip initialize */ static int __devinit lm3642_chip_init(struct lm3642_chip_data *chip) { - unsigned int reg_val; int ret; struct lm3642_platform_data *pdata = chip-pdata; /* set enable register */ - ret = regmap_read(chip-regmap, REG_ENABLE, reg_val); + ret = regmap_update_bits(chip-regmap, REG_ENABLE, EX_PIN_ENABLE_MASK, +pdata-tx_pin); if (ret 0) - goto out; - - reg_val = (~EX_PIN_ENABLE_MASK); - reg_val |= pdata-tx_pin; - ret = regmap_write(chip-regmap, REG_ENABLE, reg_val); - if (ret 0) - goto out; - -out: - dev_err(chip-dev, Failed to read REG_ENABLE Register\n); + dev_err(chip-dev, Failed to update REG_ENABLE Register\n); return ret; } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/