linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Chanwoo Choi <cw00.choi@samsung.com>
Cc: linux-kernel@vger.kernel.org, myungjoo.ham@samsung.com,
	Kozik <k.kozlowski@samsung.com>,
	ckeepax@opensource.wolfsonmicro.com, gg@slimlogic.co.uk,
	kishon@ti.com, jaewon02.kim@samsung.com, rogerq@ti.com,
	ramakrishna.pallala@intel.com, george.cherian@ti.com,
	balbi@ti.com, aaro.koskinen@iki.fi
Subject: Re: [PATCH 2/2] extcon: Update the prototype of extcon_register_notifier() with enum extcon
Date: Sun, 17 May 2015 16:41:57 +0900	[thread overview]
Message-ID: <CAJKOXPergrE6R-iuBkOwzh+Jno5sfNy26M6qsFz8mJFQX97b=A@mail.gmail.com> (raw)
In-Reply-To: <1431700278-30465-3-git-send-email-cw00.choi@samsung.com>

2015-05-15 23:31 GMT+09:00 Chanwoo Choi <cw00.choi@samsung.com>:
> Previously, extcon consumer driver used the extcon_register_interest()
> to register the notifier chain and then to receive the notifier event
> when external connector's state is changed. When registering the notifier chain
> for specific external connector with extcon_register_interest(), it used the
> the string name of external connector directly. There are potential problem
> because of unclear, non-standard and inconsequent cable name. Namely,
> it is not appropriate method to identify each external connector.
>
> So, this patch modify the prototype of extcon_register_notifier() by using
> the 'enum extcon' which are the unique id for each external connector
> instead of unclear string method.
>
> - Previously, the extcon consumer driver used the extcon_register_interest()
> with 'cable_name' to point out the specific external connector. Also. it used
> the un-needed structure (struct extcon_specific_cable_nb).
> : int extcon_register_interest(struct extcon_specific_cable_nb *obj,
>                              const char *extcon_name, const char *cable_name,
>                              struct notifier_block *nb)
>
> - Newly, the updated extcon_register_notifier() would definitely support
> the same feature to detech the changed state of external connector without
> any specific structure (struct extcon_specific_cable_nb).
> : int extcon_register_notifier(struct extcon_dev *edev, enum extcon id,
>                              struct notifier_block *nb)
>
> This patch support the both extcon_register_interest() and new extcon_register_
> notifier(). But the extcon_{register|unregister}_interest() will be deprecated
> because extcon core would support the notifier event for extcon consumer driver
> with only updated extcon_register_notifier() and 'extcon_specific_cable_nb'
> will be removed if there are no extcon consumer driver with legacy
> extcon_{register|unregister}_interest().
>
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> Cc: George Cherian <george.cherian@ti.com>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> ---
>  drivers/extcon/extcon.c | 91 ++++++++++++++++++++++++++-----------------------
>  include/linux/extcon.h  | 17 +++++----
>  2 files changed, 56 insertions(+), 52 deletions(-)
>
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index 4aeb585..14c8c95 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -111,6 +111,16 @@ static int check_mutually_exclusive(struct extcon_dev *edev, u32 new_state)
>         return 0;
>  }
>
> +static bool is_extcon_changed(u32 prev, u32 new, int idx, bool *attached)
> +{
> +       if (((prev >> idx) & 0x1) != ((new >> idx) & 0x1)) {

How about switching "state" to unsigned long and using bit operations
everywhere, like test_bit()?

The patch itself looks good and change above is not actually related
to the code here, so:
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

  reply	other threads:[~2015-05-17  7:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 14:31 [PATCH 0/2] extcon: Use the unique id for each cable and update the extcon notifier Chanwoo Choi
2015-05-15 14:31 ` [PATCH 1/2] extcon: Use the unique id for external connector instead of string Chanwoo Choi
2015-05-15 14:49   ` Roger Quadros
2015-05-15 15:16   ` Charles Keepax
2015-05-15 15:57   ` Pallala, Ramakrishna
2015-05-17  7:10   ` Krzysztof Kozlowski
2015-05-17  7:53     ` Chanwoo Choi
2015-05-17  9:09       ` Krzysztof Kozlowski
2015-05-19 12:28       ` Chanwoo Choi
2015-05-20  3:24         ` Krzysztof Kozlowski
2015-05-20  3:48           ` Chanwoo Choi
2015-05-15 14:31 ` [PATCH 2/2] extcon: Update the prototype of extcon_register_notifier() with enum extcon Chanwoo Choi
2015-05-17  7:41   ` Krzysztof Kozlowski [this message]
2015-05-17  7:58     ` 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='CAJKOXPergrE6R-iuBkOwzh+Jno5sfNy26M6qsFz8mJFQX97b=A@mail.gmail.com' \
    --to=k.kozlowski@samsung.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=balbi@ti.com \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=cw00.choi@samsung.com \
    --cc=george.cherian@ti.com \
    --cc=gg@slimlogic.co.uk \
    --cc=jaewon02.kim@samsung.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=ramakrishna.pallala@intel.com \
    --cc=rogerq@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).