From: Masahiro Yamada <yamada.masahiro@socionext.com> To: linux-usb@vger.kernel.org, Felipe Balbi <felipe.balbi@linux.intel.com> Cc: Rob Herring <robh@kernel.org>, Roger Quadros <rogerq@ti.com>, Martin Blumenstingl <martin.blumenstingl@googlemail.com>, Masami Hiramatsu <mhiramat@kernel.org>, Jassi Brar <jaswinder.singh@linaro.org>, Kunihiko Hayashi <hayashi.kunihiko@socionext.com>, Masahiro Yamada <yamada.masahiro@socionext.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Felipe Balbi <balbi@kernel.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org> Subject: Re: [PATCH v2 1/2] usb: dwc3: use local copy of resource to fix-up register offset Date: Tue, 1 May 2018 23:07:11 +0900 [thread overview] Message-ID: <CAK7LNAQ45=EM2pu01MYA7AuXRfqYCLzzOR3sTa+RmaK09CYtJw@mail.gmail.com> (raw) In-Reply-To: <1524135818-14825-2-git-send-email-yamada.masahiro@socionext.com> Hi Felipe, 2018-04-19 20:03 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>: > It is not a good idea to directly modify the resource of a platform > device. Modify its local copy, and pass it to devm_ioremap_resource() > so that we do not need to restore it in the failure path and the remove > hook. > > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> > Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org> I want this patch applied first unless you are opposed to this clean-up. I'd like to avoid re-sending a trivial patch like this. > --- > > Changes in v2: None > > drivers/usb/dwc3/core.c | 32 ++++++++------------------------ > 1 file changed, 8 insertions(+), 24 deletions(-) > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index a15648d..8e66edd 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -1245,7 +1245,7 @@ static void dwc3_check_params(struct dwc3 *dwc) > static int dwc3_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > - struct resource *res; > + struct resource *res, dwc_res; > struct dwc3 *dwc; > > int ret; > @@ -1270,20 +1270,19 @@ static int dwc3_probe(struct platform_device *pdev) > dwc->xhci_resources[0].flags = res->flags; > dwc->xhci_resources[0].name = res->name; > > - res->start += DWC3_GLOBALS_REGS_START; > - > /* > * Request memory region but exclude xHCI regs, > * since it will be requested by the xhci-plat driver. > */ > - regs = devm_ioremap_resource(dev, res); > - if (IS_ERR(regs)) { > - ret = PTR_ERR(regs); > - goto err0; > - } > + dwc_res = *res; > + dwc_res.start += DWC3_GLOBALS_REGS_START; > + > + regs = devm_ioremap_resource(dev, &dwc_res); > + if (IS_ERR(regs)) > + return PTR_ERR(regs); > > dwc->regs = regs; > - dwc->regs_size = resource_size(res); > + dwc->regs_size = resource_size(&dwc_res); > > dwc3_get_properties(dwc); > > @@ -1350,29 +1349,14 @@ static int dwc3_probe(struct platform_device *pdev) > pm_runtime_put_sync(&pdev->dev); > pm_runtime_disable(&pdev->dev); > > -err0: > - /* > - * restore res->start back to its original value so that, in case the > - * probe is deferred, we don't end up getting error in request the > - * memory region the next time probe is called. > - */ > - res->start -= DWC3_GLOBALS_REGS_START; > - > return ret; > } > > static int dwc3_remove(struct platform_device *pdev) > { > struct dwc3 *dwc = platform_get_drvdata(pdev); > - struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > pm_runtime_get_sync(&pdev->dev); > - /* > - * restore res->start back to its original value so that, in case the > - * probe is deferred, we don't end up getting error in request the > - * memory region the next time probe is called. > - */ > - res->start -= DWC3_GLOBALS_REGS_START; > > dwc3_debugfs_exit(dwc); > dwc3_core_exit_mode(dwc); > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards Masahiro Yamada
WARNING: multiple messages have this Message-ID (diff)
From: Masahiro Yamada <yamada.masahiro@socionext.com> To: linux-usb@vger.kernel.org, Felipe Balbi <felipe.balbi@linux.intel.com> Cc: Rob Herring <robh@kernel.org>, Roger Quadros <rogerq@ti.com>, Martin Blumenstingl <martin.blumenstingl@googlemail.com>, Masami Hiramatsu <mhiramat@kernel.org>, Jassi Brar <jaswinder.singh@linaro.org>, Kunihiko Hayashi <hayashi.kunihiko@socionext.com>, Masahiro Yamada <yamada.masahiro@socionext.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Felipe Balbi <balbi@kernel.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org> Subject: [v2,1/2] usb: dwc3: use local copy of resource to fix-up register offset Date: Tue, 1 May 2018 23:07:11 +0900 [thread overview] Message-ID: <CAK7LNAQ45=EM2pu01MYA7AuXRfqYCLzzOR3sTa+RmaK09CYtJw@mail.gmail.com> (raw) Hi Felipe, 2018-04-19 20:03 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>: > It is not a good idea to directly modify the resource of a platform > device. Modify its local copy, and pass it to devm_ioremap_resource() > so that we do not need to restore it in the failure path and the remove > hook. > > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> > Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org> I want this patch applied first unless you are opposed to this clean-up. I'd like to avoid re-sending a trivial patch like this. > --- > > Changes in v2: None > > drivers/usb/dwc3/core.c | 32 ++++++++------------------------ > 1 file changed, 8 insertions(+), 24 deletions(-) > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index a15648d..8e66edd 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -1245,7 +1245,7 @@ static void dwc3_check_params(struct dwc3 *dwc) > static int dwc3_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > - struct resource *res; > + struct resource *res, dwc_res; > struct dwc3 *dwc; > > int ret; > @@ -1270,20 +1270,19 @@ static int dwc3_probe(struct platform_device *pdev) > dwc->xhci_resources[0].flags = res->flags; > dwc->xhci_resources[0].name = res->name; > > - res->start += DWC3_GLOBALS_REGS_START; > - > /* > * Request memory region but exclude xHCI regs, > * since it will be requested by the xhci-plat driver. > */ > - regs = devm_ioremap_resource(dev, res); > - if (IS_ERR(regs)) { > - ret = PTR_ERR(regs); > - goto err0; > - } > + dwc_res = *res; > + dwc_res.start += DWC3_GLOBALS_REGS_START; > + > + regs = devm_ioremap_resource(dev, &dwc_res); > + if (IS_ERR(regs)) > + return PTR_ERR(regs); > > dwc->regs = regs; > - dwc->regs_size = resource_size(res); > + dwc->regs_size = resource_size(&dwc_res); > > dwc3_get_properties(dwc); > > @@ -1350,29 +1349,14 @@ static int dwc3_probe(struct platform_device *pdev) > pm_runtime_put_sync(&pdev->dev); > pm_runtime_disable(&pdev->dev); > > -err0: > - /* > - * restore res->start back to its original value so that, in case the > - * probe is deferred, we don't end up getting error in request the > - * memory region the next time probe is called. > - */ > - res->start -= DWC3_GLOBALS_REGS_START; > - > return ret; > } > > static int dwc3_remove(struct platform_device *pdev) > { > struct dwc3 *dwc = platform_get_drvdata(pdev); > - struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > pm_runtime_get_sync(&pdev->dev); > - /* > - * restore res->start back to its original value so that, in case the > - * probe is deferred, we don't end up getting error in request the > - * memory region the next time probe is called. > - */ > - res->start -= DWC3_GLOBALS_REGS_START; > > dwc3_debugfs_exit(dwc); > dwc3_core_exit_mode(dwc); > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-05-01 14:08 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-19 11:03 [PATCH v2 0/2] usb: dwc3: support clocks and resets for DWC3 core Masahiro Yamada 2018-04-19 11:03 ` [PATCH v2 1/2] usb: dwc3: use local copy of resource to fix-up register offset Masahiro Yamada 2018-04-19 11:03 ` [v2,1/2] " Masahiro Yamada 2018-05-01 14:07 ` Masahiro Yamada [this message] 2018-05-01 14:07 ` Masahiro Yamada 2018-04-19 11:03 ` [PATCH v2 2/2] usb: dwc3: support clocks and resets for DWC3 core Masahiro Yamada 2018-04-19 11:03 ` [v2,2/2] " Masahiro Yamada 2018-04-23 17:44 ` [PATCH v2 2/2] " Martin Blumenstingl 2018-04-23 17:44 ` [v2,2/2] " Martin Blumenstingl 2018-04-24 1:17 ` [PATCH v2 2/2] " Masahiro Yamada 2018-04-24 1:17 ` [v2,2/2] " Masahiro Yamada 2018-04-28 2:41 ` [PATCH v2 2/2] " Masahiro Yamada 2018-04-28 2:41 ` [v2,2/2] " Masahiro Yamada 2018-04-28 14:20 ` [PATCH v2 2/2] " Martin Blumenstingl 2018-04-28 14:20 ` [v2,2/2] " Martin Blumenstingl 2018-05-10 9:24 ` [PATCH v2 2/2] " Masahiro Yamada 2018-05-10 9:24 ` [v2,2/2] " Masahiro Yamada 2018-04-25 15:21 ` [PATCH v2 2/2] " Rob Herring 2018-04-25 15:21 ` [v2,2/2] " Rob Herring 2018-04-27 16:20 ` [PATCH v2 2/2] " Masahiro Yamada 2018-04-27 16:20 ` [v2,2/2] " Masahiro Yamada 2018-04-27 18:40 ` [PATCH v2 2/2] " Rob Herring 2018-04-27 18:40 ` [v2,2/2] " Rob Herring 2018-04-24 0:11 ` [PATCH v2 0/2] " Manu Gautam 2018-04-24 1:36 ` Masahiro Yamada
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='CAK7LNAQ45=EM2pu01MYA7AuXRfqYCLzzOR3sTa+RmaK09CYtJw@mail.gmail.com' \ --to=yamada.masahiro@socionext.com \ --cc=balbi@kernel.org \ --cc=felipe.balbi@linux.intel.com \ --cc=gregkh@linuxfoundation.org \ --cc=hayashi.kunihiko@socionext.com \ --cc=jaswinder.singh@linaro.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-usb@vger.kernel.org \ --cc=martin.blumenstingl@googlemail.com \ --cc=mhiramat@kernel.org \ --cc=robh@kernel.org \ --cc=rogerq@ti.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.