extcon : register for cable interest by cable name
Quoted 11 lines
There are some scnearios where a driver/framework needs to register interest for a particular cable without specifying the extcon device name. One such scenario is charger notifications. The platform will have charger cabel which will be bound to any extcon device. It's not mandatory for the charger driver to know which extcon device it should use. This patch enables the support for registering interest for a cable just by cable name wihtout specifying the extcon device name
Signed-off-by Jenny TC <[email protected]>---
[]
Review
Quoted 3 lines
(quoted diff) +3
-0+extern struct extcon_dev *register_interest_cable_byname + (struct extcon_specific_cable_nb *extcon_dev, + const char *cable_name, struct notifier_block *nb);
What about allowing extcon_register_interest() to support the functionality?
I.e., allowing extcon_register_interest() to accept NULL extcon_name.
ps. anyway, usually, the "platforms" have the list of node paths, don't they?
Cheers!
MyungJoo �淸�{.n�+돴윯돪�+%듚�깁負쪐w��{.n�+돴쪐{깸G쳺��{ay����,j�f"톒쉹��묎�z_溫(�쉸듶줷"얎�m����G쳺�◀?솳鈺�&x�~뤳턨O뺞촾퇉v�^�m����띠�◀?뻀�
Quoted 12 lines
Subject: Re: [PATCH] extcon : register for cable interest by cable name
Quoted 8 lines
There are some scnearios where a driver/framework needs to register interest for a particular cable without specifying the extcon device name. One such scenario is charger notifications. The platform will have charger cabel which will be bound to any extcon device. It's not mandatory for the charger driver to know which extcon device it should use. This patch enables the support for registering interest for a cable just by cable name wihtout specifying the extcon device name
Quoted 9 lines
Quoted 2 lines
Signed-off-by Jenny TC <[email protected]>---
[]
Review
Quoted 3 lines
(quoted diff) +3
-0+extern struct extcon_dev *register_interest_cable_byname + (struct extcon_specific_cable_nb *extcon_dev, + const char *cable_name, struct notifier_block *nb);What about allowing
extcon_register_interest()to support the functionality?
register_interest_cable_byname internally uses extcon_register_interest function.
If we want to use extcon_register_interest() in both scenarios, then we need to define two local functions
extcon_register_interest__ and register_interest_cable_byname.
Then the code would be
int extcon_register_interest(struct extcon_specific_cable_nb *obj,
const char *extcon_name, const char *cable_name,
struct notifier_block *nb) {
if (extcon_name == NULL)
return register_interest_cable_byname(obj,cable_name,nb);
else
return extcon_register_interest__(obj,extcon_name,cable_name,nb);
}Is that fine?
Quoted 5 lines
I.e., allowing
extcon_register_interest()to accept NULLextcon_name.ps. anyway, usually, the "platforms" have the list of node paths, don't they?
My intention is to make it generic and less dependent on platform data. This way the same consumer driver can work on any platform without looking for extcon dev name in the platform data. For example a charger driver can work on any platform without knowing the extcon provider name for The charger cable.
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 19 lines · Jenny
Quoted 19 lines
Subject: Re: [PATCH] extcon : register for cable interest by cable name
Quoted 10 lines
There are some scnearios where a driver/framework needs to register interest for a particular cable without specifying the extcon device name. One such scenario is charger notifications. The platform will have charger cabel which will be bound to any extcon device. It's not mandatory for the charger driver to know which extcon device it should use. This patch enables the support for registering interest for a cable just by cable name wihtout specifying the extcon device name
Signed-off-by Jenny TC <[email protected]>---
[]
Quoted 3 lines
(quoted diff) +3
-0+extern struct extcon_dev *register_interest_cable_byname + (struct extcon_specific_cable_nb *extcon_dev, + const char *cable_name, struct notifier_block *nb);
Quoted 5 lines
Quoted 2 lines
What about allowing
extcon_register_interest()to support the functionality?
register_interest_cable_bynameinternally usesextcon_register_interestfunction.
If we want to useextcon_register_interest()in both scenarios, then we need to define two local functions
Then, you can use recursion. (calling recursively if the extcon_name is NULL and when it calls recursively itself, extcon_name should not be NULL)
Quoted 29 lines
extcon_register_interest__andregister_interest_cable_byname.Then the code would be
int extcon_register_interest(struct
extcon_specific_cable_nb*obj,const char *extcon_name, const char *cable_name, struct notifier_block *nb) { if (extcon_name == NULL) return register_interest_cable_byname(obj,cable_name,nb); else return extcon_register_interest__(obj,extcon_name,cable_name,nb); }Is that fine?
Quoted 5 lines
I.e., allowing
extcon_register_interest()to accept NULLextcon_name.ps. anyway, usually, the "platforms" have the list of node paths, don't they?
My intention is to make it generic and less dependent on platform data. This way the same consumer driver can work on any platform without looking for extcon dev name in the platform data. For example a charger driver can work on any platform without knowing the extcon provider name for The charger cable.
Signature · 2 lines
MyungJoo Ham, Ph.D. Mobile Software Platform Lab, DMC Business, Samsung Electronics