Re: [PATCH v5] extcon-axp288: Add axp288 extcon driver support

From: Chanwoo Choi
Date: Tue Apr 28 2015 - 09:02:41 EST


Hi Ram,

On Tue, Apr 28, 2015 at 9:17 PM, Pallala, Ramakrishna
<ramakrishna.pallala@xxxxxxxxx> wrote:
> Hi Choi,
>
>> On Tue, Apr 28, 2015 at 8:20 PM, Pallala, Ramakrishna
>> >> > > > diff --git a/include/linux/mfd/axp20x.h
>> >> > > > b/include/linux/mfd/axp20x.h index dfabd6d..81152e2 100644
>> >> > > > --- a/include/linux/mfd/axp20x.h
>> >> > > > +++ b/include/linux/mfd/axp20x.h
>> >> > > > @@ -275,4 +275,13 @@ struct axp20x_fg_pdata {
>> >> > > > int thermistor_curve[MAX_THERM_CURVE_SIZE][2];
>> >> > > > };
>> >> > > >
>> >> > > > +#define AXP288_EXTCON_CABLE_SDP "SLOW-CHARGER"
>> >> > > > +#define AXP288_EXTCON_CABLE_CDP "CHARGE-
>> >> > > DOWNSTREAM"
>> >> > > > +#define AXP288_EXTCON_CABLE_DCP "FAST-CHARGER"
>> >> > >
>> >> > > #defines are meant to make things *easier* for humans to read. It
>> >> > > is my opinion that these negatively impact the readability of the code.
>> >> > These macros will be used in extcon and charger drivers. How can I
>> >> > make it
>> >> more readable?
>> >>
>> >> If the things you're defining are more readable than the defines
>> >> themselves you're doing the opposite of what I'd expect.
>> >>
>> >> How about:
>> >>
>> >> AXP288_EXTCON_SLOW_CHARGER_CABLE
>> >> AXP288_EXTCON_FAST_CHARGER_CABLE
>> >> AXP288_EXTCON_CHARGE_DOWNSTREAM_CABLE
>> >
>> > Ok I will change the names similar to the above ones.
>>
>> This cable names are used in only extcon driver.
>> I think that you don't need to define them on header file.
>> You better to move this definition to extcon driver.
>>
>> Also, I'll review your patch on other mail.
>
> Based on the these cable types I will be setting the charging parameters.
> How will I know which charger cable is connected in extcon consumer driver?

I'm working to implement the unique id for all external connectors instead of
string name when registering the external connectors [1]. But It is
not completed and ongoing.
[1] https://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/commit/?h=v4.2/extcon-next&id=52d1f16a650cc3b20ab5d5e281b874cfc5f659bc

Also, extcon consumer driver can use the unique id (enum extcon) when
executing extcon_register_interest() function.
After implementing patch[1], all extcon provider/consumer driver would
not pass the string of external connector directly.

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/