From: Kishon Vijay Abraham I <kishon@ti.com> To: Chanwoo Choi <cw00.choi@samsung.com> Cc: <gregkh@linuxfoundation.org>, <balbi@ti.com>, <myungjoo.ham@samsung.com>, <linux-kernel@vger.kernel.org>, <linux-usb@vger.kernel.org>, <linux-omap@vger.kernel.org> Subject: Re: [PATCH 1/2] extcon: of: Remove unnecessary function call by using the name of device_node Date: Thu, 20 Mar 2014 10:50:51 +0530 [thread overview] Message-ID: <532A7AB3.8000706@ti.com> (raw) In-Reply-To: <532A50CD.7030601@samsung.com> Hi, On Thursday 20 March 2014 07:52 AM, Chanwoo Choi wrote: > Hi, > > On 03/19/2014 09:08 PM, Kishon Vijay Abraham I wrote: >> Hi, >> >> On Tuesday 18 March 2014 05:34 PM, Chanwoo Choi wrote: >>> This patch remove unnecessary function call in of_extcon_get_extcon_dev() >>> by using the name of device_node structure. >>> >>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> >>> --- >>> drivers/extcon/of_extcon.c | 12 ++---------- >>> 1 file changed, 2 insertions(+), 10 deletions(-) >>> >>> diff --git a/drivers/extcon/of_extcon.c b/drivers/extcon/of_extcon.c >>> index 72173ec..0a29f82 100644 >>> --- a/drivers/extcon/of_extcon.c >>> +++ b/drivers/extcon/of_extcon.c >>> @@ -32,7 +32,6 @@ struct extcon_dev *of_extcon_get_extcon_dev(struct device *dev, int index) >>> { >>> struct device_node *node; >>> struct extcon_dev *edev; >>> - struct platform_device *extcon_parent_dev; >>> >>> if (!dev->of_node) { >>> dev_dbg(dev, "device does not have a device node entry\n"); >>> @@ -46,16 +45,9 @@ struct extcon_dev *of_extcon_get_extcon_dev(struct device *dev, int index) >>> return ERR_PTR(-ENODEV); >>> } >>> >>> - extcon_parent_dev = of_find_device_by_node(node); >>> - if (!extcon_parent_dev) { >>> - dev_dbg(dev, "unable to find device by node\n"); >>> - return ERR_PTR(-EPROBE_DEFER); >>> - } >>> - >>> - edev = extcon_get_extcon_dev(dev_name(&extcon_parent_dev->dev)); >>> + edev = extcon_get_extcon_dev(node->name); >> >> Since you no longer want to use device names I think you should add this too to >> warn users if they rely on using the device name. > > Previous of_extcon_get_extcon_dev() support only platform device using of_find_device_by_node. > > If extcon device is based on i2c/spi/pci and so on, of_extcon_get_extcon_dev() can't > find device instance for device name. So, I change device name from the name of platform device > to the name of dt node. That's fine. But we have to fix extcon_dev_register() too, to not use device names right? We have to warn extcon users not to use device names right? > > >> diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c >> index bc4c789..025eb39 100644 >> --- a/drivers/extcon/extcon-class.c >> +++ b/drivers/extcon/extcon-class.c >> @@ -601,7 +601,6 @@ int extcon_dev_register(struct extcon_dev *edev) >> edev->dev.class = extcon_class; >> edev->dev.release = extcon_dev_release; >> >> - edev->name = edev->name ? edev->name : dev_name(edev->dev.parent); >> //The user should always pass the 'name' as we no longer use device name while >> getting extcon device. And this name should also be the 'node' name? >> if (IS_ERR_OR_NULL(edev->name)) { >> dev_err(&edev->dev, >> "extcon device name is null\n"); >> >> Btw changing to node name from device name breaks dwc3 in OMAP5 and you would >> need this too.. >> >> diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c >> index 2aea4bc..cea8cd3 100644 >> --- a/drivers/extcon/extcon-palmas.c >> +++ b/drivers/extcon/extcon-palmas.c >> @@ -188,6 +188,7 @@ static int palmas_usb_probe(struct platform_device *pdev) >> >> palmas_usb->edev.supported_cable = palmas_extcon_cable; >> palmas_usb->edev.dev.parent = palmas_usb->dev; >> + palmas_usb->edev.name = "palmas_usb"; >> palmas_usb->edev.mutually_exclusive = mutually_exclusive; >> >> status = extcon_dev_register(&palmas_usb->edev); >> >> Cheers >> Kishon >> > > If node name is same as extcon device name, don't need some modification. > Also, you can modify node name in some OMAP dts file insead of modification of extcon-palmas.c node name in OMAP dts is already 'palmas_usb'. But since we were not setting 'edev.name' in extcon-palmas.c, extcon_dev_register used device name of palmas (palmas_usb.7 in my case). So extcon-palmas.c needs the fix. Cheers Kishon
WARNING: multiple messages have this Message-ID (diff)
From: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org> To: Chanwoo Choi <cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org, balbi-l0cyMroinI0@public.gmane.org, myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: Re: [PATCH 1/2] extcon: of: Remove unnecessary function call by using the name of device_node Date: Thu, 20 Mar 2014 10:50:51 +0530 [thread overview] Message-ID: <532A7AB3.8000706@ti.com> (raw) In-Reply-To: <532A50CD.7030601-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> Hi, On Thursday 20 March 2014 07:52 AM, Chanwoo Choi wrote: > Hi, > > On 03/19/2014 09:08 PM, Kishon Vijay Abraham I wrote: >> Hi, >> >> On Tuesday 18 March 2014 05:34 PM, Chanwoo Choi wrote: >>> This patch remove unnecessary function call in of_extcon_get_extcon_dev() >>> by using the name of device_node structure. >>> >>> Signed-off-by: Chanwoo Choi <cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> >>> --- >>> drivers/extcon/of_extcon.c | 12 ++---------- >>> 1 file changed, 2 insertions(+), 10 deletions(-) >>> >>> diff --git a/drivers/extcon/of_extcon.c b/drivers/extcon/of_extcon.c >>> index 72173ec..0a29f82 100644 >>> --- a/drivers/extcon/of_extcon.c >>> +++ b/drivers/extcon/of_extcon.c >>> @@ -32,7 +32,6 @@ struct extcon_dev *of_extcon_get_extcon_dev(struct device *dev, int index) >>> { >>> struct device_node *node; >>> struct extcon_dev *edev; >>> - struct platform_device *extcon_parent_dev; >>> >>> if (!dev->of_node) { >>> dev_dbg(dev, "device does not have a device node entry\n"); >>> @@ -46,16 +45,9 @@ struct extcon_dev *of_extcon_get_extcon_dev(struct device *dev, int index) >>> return ERR_PTR(-ENODEV); >>> } >>> >>> - extcon_parent_dev = of_find_device_by_node(node); >>> - if (!extcon_parent_dev) { >>> - dev_dbg(dev, "unable to find device by node\n"); >>> - return ERR_PTR(-EPROBE_DEFER); >>> - } >>> - >>> - edev = extcon_get_extcon_dev(dev_name(&extcon_parent_dev->dev)); >>> + edev = extcon_get_extcon_dev(node->name); >> >> Since you no longer want to use device names I think you should add this too to >> warn users if they rely on using the device name. > > Previous of_extcon_get_extcon_dev() support only platform device using of_find_device_by_node. > > If extcon device is based on i2c/spi/pci and so on, of_extcon_get_extcon_dev() can't > find device instance for device name. So, I change device name from the name of platform device > to the name of dt node. That's fine. But we have to fix extcon_dev_register() too, to not use device names right? We have to warn extcon users not to use device names right? > > >> diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c >> index bc4c789..025eb39 100644 >> --- a/drivers/extcon/extcon-class.c >> +++ b/drivers/extcon/extcon-class.c >> @@ -601,7 +601,6 @@ int extcon_dev_register(struct extcon_dev *edev) >> edev->dev.class = extcon_class; >> edev->dev.release = extcon_dev_release; >> >> - edev->name = edev->name ? edev->name : dev_name(edev->dev.parent); >> //The user should always pass the 'name' as we no longer use device name while >> getting extcon device. And this name should also be the 'node' name? >> if (IS_ERR_OR_NULL(edev->name)) { >> dev_err(&edev->dev, >> "extcon device name is null\n"); >> >> Btw changing to node name from device name breaks dwc3 in OMAP5 and you would >> need this too.. >> >> diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c >> index 2aea4bc..cea8cd3 100644 >> --- a/drivers/extcon/extcon-palmas.c >> +++ b/drivers/extcon/extcon-palmas.c >> @@ -188,6 +188,7 @@ static int palmas_usb_probe(struct platform_device *pdev) >> >> palmas_usb->edev.supported_cable = palmas_extcon_cable; >> palmas_usb->edev.dev.parent = palmas_usb->dev; >> + palmas_usb->edev.name = "palmas_usb"; >> palmas_usb->edev.mutually_exclusive = mutually_exclusive; >> >> status = extcon_dev_register(&palmas_usb->edev); >> >> Cheers >> Kishon >> > > If node name is same as extcon device name, don't need some modification. > Also, you can modify node name in some OMAP dts file insead of modification of extcon-palmas.c node name in OMAP dts is already 'palmas_usb'. But since we were not setting 'edev.name' in extcon-palmas.c, extcon_dev_register used device name of palmas (palmas_usb.7 in my case). So extcon-palmas.c needs the fix. Cheers Kishon -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-03-20 5:20 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-03-18 12:04 [PATCH 0/2] extcon: of: Update OF helper function Chanwoo Choi 2014-03-18 12:04 ` [PATCH 1/2] extcon: of: Remove unnecessary function call by using the name of device_node Chanwoo Choi 2014-03-19 12:08 ` Kishon Vijay Abraham I 2014-03-19 12:08 ` Kishon Vijay Abraham I 2014-03-20 2:22 ` Chanwoo Choi 2014-03-20 5:20 ` Kishon Vijay Abraham I [this message] 2014-03-20 5:20 ` Kishon Vijay Abraham I 2014-03-20 6:56 ` Chanwoo Choi 2014-03-20 8:42 ` Kishon Vijay Abraham I 2014-03-20 8:42 ` Kishon Vijay Abraham I 2014-03-18 12:04 ` [PATCH 2/2] extcon: Move OF helper function to extcon core and change function name Chanwoo Choi 2014-03-18 15:54 ` Felipe Balbi 2014-03-18 15:54 ` Felipe Balbi
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=532A7AB3.8000706@ti.com \ --to=kishon@ti.com \ --cc=balbi@ti.com \ --cc=cw00.choi@samsung.com \ --cc=gregkh@linuxfoundation.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-omap@vger.kernel.org \ --cc=linux-usb@vger.kernel.org \ --cc=myungjoo.ham@samsung.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.