From: Chanwoo Choi <cw00.choi@samsung.com>
To: Andi Shyti <andi.shyti@gmail.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Jaewon Kim <jaewon02.kim@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
linux-kernel@vger.kernel.org, Andi Shyti <andi.shyti@samsung.com>,
Andi Shyti <andi@etezian.org>
Subject: Re: [PATCH v2 1/2] extcon: max77843: improve the code and minimize duplicated lines
Date: Mon, 03 Apr 2017 16:53:30 +0900 [thread overview]
Message-ID: <58E1FF7A.6020603@samsung.com> (raw)
In-Reply-To: <20170402053542.29570-2-andi@etezian.org>
Hi,
Actually, I checked this patch on following four case.
It is same operation between before and after.
-------------------------------------------------------------
| adc | chg_type |
-------------------------------------------------------------
case 1 | MAX77843_MUIC_ADC_GROUND | MAX77843_MUIC_CHG_NONE |
case 2 | MAX77843_MUIC_ADC_GROUND | |
case 3 | | MAX77843_MUIC_CHG_NONE |
case 4 | | |
-------------------------------------------------------------
But, I don't want to apply this patch.
By applying this patch, I think there is no huge benefits
and certainly I prefer to remain the all descriptions for specific use-case.
(- This patch deletes the 13 lines and add new 8 lines except for the comment.)
On 2017년 04월 02일 14:35, Andi Shyti wrote:
> From: Andi Shyti <andi.shyti@samsung.com>
>
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---
> drivers/extcon/extcon-max77843.c | 33 ++++++++-------------------------
> 1 file changed, 8 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
> index 6e722d552cf1..fcdabc4b4025 100644
> --- a/drivers/extcon/extcon-max77843.c
> +++ b/drivers/extcon/extcon-max77843.c
> @@ -264,37 +264,20 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
> chg_type = info->status[MAX77843_MUIC_STATUS2] &
> MAX77843_MUIC_STATUS2_CHGTYP_MASK;
>
> - /* Check GROUND accessory with charger cable */
> - if (adc == MAX77843_MUIC_ADC_GROUND) {
> - if (chg_type == MAX77843_MUIC_CHG_NONE) {
> - /*
> - * The following state when charger cable is
> - * disconnected but the GROUND accessory still
> - * connected.
> - */
> - *attached = false;
> - cable_type = info->prev_chg_type;
> - info->prev_chg_type = MAX77843_MUIC_CHG_NONE;
> - } else {
> -
> - /*
> - * The following state when charger cable is
> - * connected on the GROUND accessory.
> - */
> - *attached = true;
> - cable_type = MAX77843_MUIC_CHG_GND;
> - info->prev_chg_type = MAX77843_MUIC_CHG_GND;
> - }
> - break;
> - }
> -
> if (chg_type == MAX77843_MUIC_CHG_NONE) {
> *attached = false;
> cable_type = info->prev_chg_type;
> info->prev_chg_type = MAX77843_MUIC_CHG_NONE;
> } else {
> *attached = true;
> - cable_type = info->prev_chg_type = chg_type;
> + switch (adc) {
> + case MAX77843_MUIC_ADC_GROUND:
> + info->prev_chg_type = MAX77843_MUIC_CHG_GND;
> + break;
> + default:
> + info->prev_chg_type = chg_type;
> + }
> + cable_type = info->prev_chg_type;
> }
> break;
> case MAX77843_CABLE_GROUP_ADC_GND:
>
--
Best Regards,
Chanwoo Choi
Samsung Electronics
next prev parent reply other threads:[~2017-04-03 7:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-02 5:35 [PATCH v2 0/2] Add support for USB accessories in the max77843 extcon Andi Shyti
2017-04-02 5:35 ` [PATCH v2 1/2] extcon: max77843: improve the code and minimize duplicated lines Andi Shyti
2017-04-03 7:53 ` Chanwoo Choi [this message]
2017-04-02 5:35 ` [PATCH v2 2/2] extcon: max77843: support USB accessories as external USB hosts Andi Shyti
2017-04-03 8:27 ` Chanwoo Choi
2017-04-03 9:41 ` Andi Shyti
2017-04-03 10:08 ` Chanwoo Choi
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=58E1FF7A.6020603@samsung.com \
--to=cw00.choi@samsung.com \
--cc=andi.shyti@gmail.com \
--cc=andi.shyti@samsung.com \
--cc=andi@etezian.org \
--cc=jaewon02.kim@samsung.com \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=sw0312.kim@samsung.com \
/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.