* Re: [PATCH 3/5] usb: dwc3: dwc3-omap: Add dwc3_omap_extcon_register function [not found] ` <1399540900-13701-4-git-send-email-george.cherian@ti.com> @ 2014-05-08 9:31 ` Kishon Vijay Abraham I 0 siblings, 0 replies; 4+ messages in thread From: Kishon Vijay Abraham I @ 2014-05-08 9:31 UTC (permalink / raw) To: George Cherian, linux-kernel, linux-omap, linux-usb; +Cc: balbi, gregkh, rogerq On Thursday 08 May 2014 02:51 PM, George Cherian wrote: > Move the extcon related code to its own function. > Improve code readability, decrease the dwc3_probe() size. > > Signed-off-by: George Cherian <george.cherian@ti.com> > --- > drivers/usb/dwc3/dwc3-omap.c | 65 ++++++++++++++++++++++++++------------------ > 1 file changed, 39 insertions(+), 26 deletions(-) > > diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c > index b739a24..0b9b1d8 100644 > --- a/drivers/usb/dwc3/dwc3-omap.c > +++ b/drivers/usb/dwc3/dwc3-omap.c > @@ -450,6 +450,42 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap) > dwc3_omap_write_utmi_status(omap, reg); > } > > +static int dwc3_omap_extcon_register(struct dwc3_omap *omap) > +{ > + u32 ret; 'ret' shouldn't be unsigned. Thanks Kishon > + struct device_node *node = omap->dev->of_node; > + struct extcon_dev *edev; > + > + if (of_property_read_bool(node, "extcon")) { > + edev = extcon_get_edev_by_phandle(omap->dev, 0); > + if (IS_ERR(edev)) { > + dev_vdbg(omap->dev, "couldn't get extcon device\n"); > + return -EPROBE_DEFER; > + } > + > + omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier; > + ret = extcon_register_interest(&omap->extcon_vbus_dev, > + edev->name, "USB", > + &omap->vbus_nb); > + if (ret < 0) > + dev_vdbg(omap->dev, "failed to register notifier for USB\n"); > + > + omap->id_nb.notifier_call = dwc3_omap_id_notifier; > + ret = extcon_register_interest(&omap->extcon_id_dev, > + edev->name, "USB-HOST", > + &omap->id_nb); > + if (ret < 0) > + dev_vdbg(omap->dev, "failed to register notifier for USB-HOST\n"); > + > + if (extcon_get_cable_state(edev, "USB") == true) > + dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); > + if (extcon_get_cable_state(edev, "USB-HOST") == true) > + dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); > + } > + > + return 0; > +} > + > static int dwc3_omap_probe(struct platform_device *pdev) > { > struct device_node *node = pdev->dev.of_node; > @@ -457,7 +493,6 @@ static int dwc3_omap_probe(struct platform_device *pdev) > struct dwc3_omap *omap; > struct resource *res; > struct device *dev = &pdev->dev; > - struct extcon_dev *edev; > struct regulator *vbus_reg = NULL; > > int ret = -ENOMEM; > @@ -529,31 +564,9 @@ static int dwc3_omap_probe(struct platform_device *pdev) > > dwc3_omap_enable_irqs(omap); > > - if (of_property_read_bool(node, "extcon")) { > - edev = extcon_get_edev_by_phandle(dev, 0); > - if (IS_ERR(edev)) { > - dev_vdbg(dev, "couldn't get extcon device\n"); > - ret = -EPROBE_DEFER; > - goto err2; > - } > - > - omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier; > - ret = extcon_register_interest(&omap->extcon_vbus_dev, > - edev->name, "USB", &omap->vbus_nb); > - if (ret < 0) > - dev_vdbg(dev, "failed to register notifier for USB\n"); > - omap->id_nb.notifier_call = dwc3_omap_id_notifier; > - ret = extcon_register_interest(&omap->extcon_id_dev, edev->name, > - "USB-HOST", &omap->id_nb); > - if (ret < 0) > - dev_vdbg(dev, > - "failed to register notifier for USB-HOST\n"); > - > - if (extcon_get_cable_state(edev, "USB") == true) > - dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); > - if (extcon_get_cable_state(edev, "USB-HOST") == true) > - dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); > - } > + ret = dwc3_omap_extcon_register(omap); > + if (ret < 0) > + goto err2; > > ret = of_platform_populate(node, NULL, NULL, dev); > if (ret) { > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 3/5] usb: dwc3: dwc3-omap: Add dwc3_omap_extcon_register function @ 2014-05-08 9:31 ` Kishon Vijay Abraham I 0 siblings, 0 replies; 4+ messages in thread From: Kishon Vijay Abraham I @ 2014-05-08 9:31 UTC (permalink / raw) To: George Cherian, linux-kernel, linux-omap, linux-usb; +Cc: balbi, gregkh, rogerq On Thursday 08 May 2014 02:51 PM, George Cherian wrote: > Move the extcon related code to its own function. > Improve code readability, decrease the dwc3_probe() size. > > Signed-off-by: George Cherian <george.cherian@ti.com> > --- > drivers/usb/dwc3/dwc3-omap.c | 65 ++++++++++++++++++++++++++------------------ > 1 file changed, 39 insertions(+), 26 deletions(-) > > diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c > index b739a24..0b9b1d8 100644 > --- a/drivers/usb/dwc3/dwc3-omap.c > +++ b/drivers/usb/dwc3/dwc3-omap.c > @@ -450,6 +450,42 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap) > dwc3_omap_write_utmi_status(omap, reg); > } > > +static int dwc3_omap_extcon_register(struct dwc3_omap *omap) > +{ > + u32 ret; 'ret' shouldn't be unsigned. Thanks Kishon > + struct device_node *node = omap->dev->of_node; > + struct extcon_dev *edev; > + > + if (of_property_read_bool(node, "extcon")) { > + edev = extcon_get_edev_by_phandle(omap->dev, 0); > + if (IS_ERR(edev)) { > + dev_vdbg(omap->dev, "couldn't get extcon device\n"); > + return -EPROBE_DEFER; > + } > + > + omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier; > + ret = extcon_register_interest(&omap->extcon_vbus_dev, > + edev->name, "USB", > + &omap->vbus_nb); > + if (ret < 0) > + dev_vdbg(omap->dev, "failed to register notifier for USB\n"); > + > + omap->id_nb.notifier_call = dwc3_omap_id_notifier; > + ret = extcon_register_interest(&omap->extcon_id_dev, > + edev->name, "USB-HOST", > + &omap->id_nb); > + if (ret < 0) > + dev_vdbg(omap->dev, "failed to register notifier for USB-HOST\n"); > + > + if (extcon_get_cable_state(edev, "USB") == true) > + dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); > + if (extcon_get_cable_state(edev, "USB-HOST") == true) > + dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); > + } > + > + return 0; > +} > + > static int dwc3_omap_probe(struct platform_device *pdev) > { > struct device_node *node = pdev->dev.of_node; > @@ -457,7 +493,6 @@ static int dwc3_omap_probe(struct platform_device *pdev) > struct dwc3_omap *omap; > struct resource *res; > struct device *dev = &pdev->dev; > - struct extcon_dev *edev; > struct regulator *vbus_reg = NULL; > > int ret = -ENOMEM; > @@ -529,31 +564,9 @@ static int dwc3_omap_probe(struct platform_device *pdev) > > dwc3_omap_enable_irqs(omap); > > - if (of_property_read_bool(node, "extcon")) { > - edev = extcon_get_edev_by_phandle(dev, 0); > - if (IS_ERR(edev)) { > - dev_vdbg(dev, "couldn't get extcon device\n"); > - ret = -EPROBE_DEFER; > - goto err2; > - } > - > - omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier; > - ret = extcon_register_interest(&omap->extcon_vbus_dev, > - edev->name, "USB", &omap->vbus_nb); > - if (ret < 0) > - dev_vdbg(dev, "failed to register notifier for USB\n"); > - omap->id_nb.notifier_call = dwc3_omap_id_notifier; > - ret = extcon_register_interest(&omap->extcon_id_dev, edev->name, > - "USB-HOST", &omap->id_nb); > - if (ret < 0) > - dev_vdbg(dev, > - "failed to register notifier for USB-HOST\n"); > - > - if (extcon_get_cable_state(edev, "USB") == true) > - dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); > - if (extcon_get_cable_state(edev, "USB-HOST") == true) > - dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); > - } > + ret = dwc3_omap_extcon_register(omap); > + if (ret < 0) > + goto err2; > > ret = of_platform_populate(node, NULL, NULL, dev); > if (ret) { > ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 0/5] Cleanup and fixes for dwc3-omap @ 2014-05-08 9:33 George Cherian 2014-05-08 9:33 ` George Cherian 0 siblings, 1 reply; 4+ messages in thread From: George Cherian @ 2014-05-08 9:33 UTC (permalink / raw) To: linux-kernel, linux-omap, linux-usb Cc: balbi, gregkh, rogerq, kishon, George Cherian The series does some refactoring on dwc3_probe() Patch 1-3 - reduce the size of dwc3_probe() Patch 4 - Fix the crash on dwc3_omap removal Patch 5 - Addresses the issue of xhci hang while resuming from system sleep. George Cherian (5): usb: dwc3: dwc3-omap: Add dwc3_omap_map_offset function usb: dwc3: dwc3-omap: Add dwc3_omap_set_utmi_mode() function usb: dwc3: dwc3-omap: Add dwc3_omap_extcon_register function usb: dwc3: dwc3-omap: Fix the crash on module removal usb: dwc3: dwc3-omap: Disable/Enable core interrupts in Suspend/Resume drivers/usb/dwc3/dwc3-omap.c | 211 +++++++++++++++++++++++-------------------- 1 file changed, 111 insertions(+), 100 deletions(-) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/5] usb: dwc3: dwc3-omap: Add dwc3_omap_extcon_register function 2014-05-08 9:33 [PATCH 0/5] Cleanup and fixes for dwc3-omap George Cherian @ 2014-05-08 9:33 ` George Cherian 0 siblings, 0 replies; 4+ messages in thread From: George Cherian @ 2014-05-08 9:33 UTC (permalink / raw) To: linux-kernel, linux-omap, linux-usb Cc: balbi, gregkh, rogerq, kishon, George Cherian Move the extcon related code to its own function. Improve code readability, decrease the dwc3_probe() size. Signed-off-by: George Cherian <george.cherian@ti.com> --- drivers/usb/dwc3/dwc3-omap.c | 65 ++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index b739a24..0b9b1d8 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -450,6 +450,42 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap) dwc3_omap_write_utmi_status(omap, reg); } +static int dwc3_omap_extcon_register(struct dwc3_omap *omap) +{ + u32 ret; + struct device_node *node = omap->dev->of_node; + struct extcon_dev *edev; + + if (of_property_read_bool(node, "extcon")) { + edev = extcon_get_edev_by_phandle(omap->dev, 0); + if (IS_ERR(edev)) { + dev_vdbg(omap->dev, "couldn't get extcon device\n"); + return -EPROBE_DEFER; + } + + omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier; + ret = extcon_register_interest(&omap->extcon_vbus_dev, + edev->name, "USB", + &omap->vbus_nb); + if (ret < 0) + dev_vdbg(omap->dev, "failed to register notifier for USB\n"); + + omap->id_nb.notifier_call = dwc3_omap_id_notifier; + ret = extcon_register_interest(&omap->extcon_id_dev, + edev->name, "USB-HOST", + &omap->id_nb); + if (ret < 0) + dev_vdbg(omap->dev, "failed to register notifier for USB-HOST\n"); + + if (extcon_get_cable_state(edev, "USB") == true) + dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); + if (extcon_get_cable_state(edev, "USB-HOST") == true) + dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); + } + + return 0; +} + static int dwc3_omap_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; @@ -457,7 +493,6 @@ static int dwc3_omap_probe(struct platform_device *pdev) struct dwc3_omap *omap; struct resource *res; struct device *dev = &pdev->dev; - struct extcon_dev *edev; struct regulator *vbus_reg = NULL; int ret = -ENOMEM; @@ -529,31 +564,9 @@ static int dwc3_omap_probe(struct platform_device *pdev) dwc3_omap_enable_irqs(omap); - if (of_property_read_bool(node, "extcon")) { - edev = extcon_get_edev_by_phandle(dev, 0); - if (IS_ERR(edev)) { - dev_vdbg(dev, "couldn't get extcon device\n"); - ret = -EPROBE_DEFER; - goto err2; - } - - omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier; - ret = extcon_register_interest(&omap->extcon_vbus_dev, - edev->name, "USB", &omap->vbus_nb); - if (ret < 0) - dev_vdbg(dev, "failed to register notifier for USB\n"); - omap->id_nb.notifier_call = dwc3_omap_id_notifier; - ret = extcon_register_interest(&omap->extcon_id_dev, edev->name, - "USB-HOST", &omap->id_nb); - if (ret < 0) - dev_vdbg(dev, - "failed to register notifier for USB-HOST\n"); - - if (extcon_get_cable_state(edev, "USB") == true) - dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); - if (extcon_get_cable_state(edev, "USB-HOST") == true) - dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); - } + ret = dwc3_omap_extcon_register(omap); + if (ret < 0) + goto err2; ret = of_platform_populate(node, NULL, NULL, dev); if (ret) { -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/5] usb: dwc3: dwc3-omap: Add dwc3_omap_extcon_register function @ 2014-05-08 9:33 ` George Cherian 0 siblings, 0 replies; 4+ messages in thread From: George Cherian @ 2014-05-08 9:33 UTC (permalink / raw) To: linux-kernel, linux-omap, linux-usb Cc: balbi, gregkh, rogerq, kishon, George Cherian Move the extcon related code to its own function. Improve code readability, decrease the dwc3_probe() size. Signed-off-by: George Cherian <george.cherian@ti.com> --- drivers/usb/dwc3/dwc3-omap.c | 65 ++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index b739a24..0b9b1d8 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -450,6 +450,42 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap) dwc3_omap_write_utmi_status(omap, reg); } +static int dwc3_omap_extcon_register(struct dwc3_omap *omap) +{ + u32 ret; + struct device_node *node = omap->dev->of_node; + struct extcon_dev *edev; + + if (of_property_read_bool(node, "extcon")) { + edev = extcon_get_edev_by_phandle(omap->dev, 0); + if (IS_ERR(edev)) { + dev_vdbg(omap->dev, "couldn't get extcon device\n"); + return -EPROBE_DEFER; + } + + omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier; + ret = extcon_register_interest(&omap->extcon_vbus_dev, + edev->name, "USB", + &omap->vbus_nb); + if (ret < 0) + dev_vdbg(omap->dev, "failed to register notifier for USB\n"); + + omap->id_nb.notifier_call = dwc3_omap_id_notifier; + ret = extcon_register_interest(&omap->extcon_id_dev, + edev->name, "USB-HOST", + &omap->id_nb); + if (ret < 0) + dev_vdbg(omap->dev, "failed to register notifier for USB-HOST\n"); + + if (extcon_get_cable_state(edev, "USB") == true) + dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); + if (extcon_get_cable_state(edev, "USB-HOST") == true) + dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); + } + + return 0; +} + static int dwc3_omap_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; @@ -457,7 +493,6 @@ static int dwc3_omap_probe(struct platform_device *pdev) struct dwc3_omap *omap; struct resource *res; struct device *dev = &pdev->dev; - struct extcon_dev *edev; struct regulator *vbus_reg = NULL; int ret = -ENOMEM; @@ -529,31 +564,9 @@ static int dwc3_omap_probe(struct platform_device *pdev) dwc3_omap_enable_irqs(omap); - if (of_property_read_bool(node, "extcon")) { - edev = extcon_get_edev_by_phandle(dev, 0); - if (IS_ERR(edev)) { - dev_vdbg(dev, "couldn't get extcon device\n"); - ret = -EPROBE_DEFER; - goto err2; - } - - omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier; - ret = extcon_register_interest(&omap->extcon_vbus_dev, - edev->name, "USB", &omap->vbus_nb); - if (ret < 0) - dev_vdbg(dev, "failed to register notifier for USB\n"); - omap->id_nb.notifier_call = dwc3_omap_id_notifier; - ret = extcon_register_interest(&omap->extcon_id_dev, edev->name, - "USB-HOST", &omap->id_nb); - if (ret < 0) - dev_vdbg(dev, - "failed to register notifier for USB-HOST\n"); - - if (extcon_get_cable_state(edev, "USB") == true) - dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); - if (extcon_get_cable_state(edev, "USB-HOST") == true) - dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); - } + ret = dwc3_omap_extcon_register(omap); + if (ret < 0) + goto err2; ret = of_platform_populate(node, NULL, NULL, dev); if (ret) { -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-08 9:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1399540900-13701-1-git-send-email-george.cherian@ti.com>
[not found] ` <1399540900-13701-4-git-send-email-george.cherian@ti.com>
2014-05-08 9:31 ` [PATCH 3/5] usb: dwc3: dwc3-omap: Add dwc3_omap_extcon_register function Kishon Vijay Abraham I
2014-05-08 9:31 ` Kishon Vijay Abraham I
2014-05-08 9:33 [PATCH 0/5] Cleanup and fixes for dwc3-omap George Cherian
2014-05-08 9:33 ` [PATCH 3/5] usb: dwc3: dwc3-omap: Add dwc3_omap_extcon_register function George Cherian
2014-05-08 9:33 ` George Cherian
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.