Re: [PATCH V2 4/4] extcon: palmas: Option to disable ID/VBUS detection based on platform

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 10 July 2013 01:04 PM, Chanwoo Choi wrote:
On 07/10/2013 04:13 PM, Laxman Dewangan wrote:
On Wednesday 10 July 2013 12:25 PM, Chanwoo Choi wrote:
I did not like to break the TI design/code and hence added the option such that if there is no initialisation of this member or dts entry then assume it as the cable detection is enabled. Hence it need explicitly entry for disable the cable type detction. This is what for platform data structure.

On other structure, I use as other way to use in rest of code to make logic as

if (palmas_usb->enable_id_detction)
    xxx.

rathar than

if (!palmas_usb->disable_id_detction)
    xxx.


On rest of code, do now wan to use the pdata.
This patch store same meaning to two different variables which are included in different structure.
If we try to change the state of vbus/id detection on runtime, we have to modify two variables.
I think it isn't right.

struct palmas_platform_data {
	....
	bool disable_vbus_detection;
	bool disable_id_detection;
};

struct palmas_usb {
	...
	bool enable_vbus_detection;
	bool enable_id_detection;
};

You could only use the variables in struct palmas_usb without variables in struct palmas_platform_data
because extcon-palmas driver store only the pointer of 'struct palmas_usb' to dev->p->driver_data
by using platform_set_drvdata().

It is meaning to use 'struct palmas_usb' on other function except for palmas_usb_probe() in extcon-palmas.c.


if (node && !pdata) {
	...
	palmas_usb->wakeup = of_property_red_bool(node, "ti,wakeup);
	palmas_usb->enable_vbus_detection = of_property_red_bool(node, "ti,enable_vbus_detection);
	palmas_usb->enable_id_detection = of_property_red_bool(node, "ti,enable_id_detection);
} else (!pdata) {
	palmas_usb->wakeup = true;
	palmas_usb->enable_vbus_detection = true;
	palmas_usb->enable_id_detection = true;
}


Thanks for detail explanation.

I agree with you on this code. This code support the option if driver is invoked from DT and assume true always if it is from board file.

As all Tegra platforms have been moved to the DTS, I do not see any issue on this change.

I will post the new version of this change (patch 4/4) as all others are already merged.

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux