[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGTfZH3ezhJ3+gQ+mYGmXdzAxUeJnQ8C-7xuO_G2uS1k+Lp+SA@mail.gmail.com>
Date: Sun, 17 May 2015 16:58:19 +0900
From: Chanwoo Choi <cwchoi00@...il.com>
To: Krzysztof Kozlowski <k.kozlowski@...sung.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
"myungjoo.ham@...sung.com" <myungjoo.ham@...sung.com>,
Charles Keepax <ckeepax@...nsource.wolfsonmicro.com>,
gg@...mlogic.co.uk, Kishon Vijay Abraham I <kishon@...com>,
jaewon02.kim@...sung.com, Roger Quadros <rogerq@...com>,
"Pallala, Ramakrishna" <ramakrishna.pallala@...el.com>,
george.cherian@...com, Felipe Balbi <balbi@...com>,
Aaro Koskinen <aaro.koskinen@....fi>
Subject: Re: [PATCH 2/2] extcon: Update the prototype of extcon_register_notifier()
with enum extcon
On Sun, May 17, 2015 at 4:41 PM, Krzysztof Kozlowski
<k.kozlowski@...sung.com> wrote:
> 2015-05-15 23:31 GMT+09:00 Chanwoo Choi <cw00.choi@...sung.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@...sung.com>
>> Cc: MyungJoo Ham <myungjoo.ham@...sung.com>
>> Cc: George Cherian <george.cherian@...com>
>> Cc: Felipe Balbi <balbi@...com>
>> Cc: Aaro Koskinen <aaro.koskinen@....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()?
As I replied on other patch, I'm having the plan to extend the number
of supported external connectors of each extcon device. I'll consider
to use the test_bit() on next time for updating extcon core.
>
> The patch itself looks good and change above is not actually related
> to the code here, so:
> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@...sung.com>
Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists