* [PATCH v11 10/27] iommu/exynos: use managed device helper functions @ 2014-03-14 5:05 Cho KyongHo [not found] ` <20140314140542.f4ded6c50dbd8a1d937bf354-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 15+ messages in thread From: Cho KyongHo @ 2014-03-14 5:05 UTC (permalink / raw) To: Linux ARM Kernel, Linux DeviceTree, Linux IOMMU, Linux Kernel, Linux Samsung SOC Cc: Kukjin Kim, Prathyush, Grant Grundler, Sachin Kamat, Sylwester Nawrocki, Varun Sethi, Antonios Motakis, Tomasz Figa, Rahul Sharma This patch uses managed device helper functions in the probe(). Signed-off-by: Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> --- drivers/iommu/exynos-iommu.c | 64 +++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 38 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 36e6b73..33b424d 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -499,51 +499,48 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) static int exynos_sysmmu_probe(struct platform_device *pdev) { - int ret; + int irq, ret; struct device *dev = &pdev->dev; struct sysmmu_drvdata *data; struct resource *res; - data = kzalloc(sizeof(*data), GFP_KERNEL); - if (!data) { - dev_dbg(dev, "Not enough memory\n"); - ret = -ENOMEM; - goto err_alloc; - } + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { - dev_dbg(dev, "Unable to find IOMEM region\n"); - ret = -ENOENT; - goto err_init; + dev_err(dev, "Unable to find IOMEM region\n"); + return -ENOENT; } - data->sfrbase = ioremap(res->start, resource_size(res)); - if (!data->sfrbase) { - dev_dbg(dev, "Unable to map IOMEM @ PA:%#x\n", res->start); - ret = -ENOENT; - goto err_res; - } + data->sfrbase = devm_ioremap_resource(dev, res); + if (IS_ERR(data->sfrbase)) + return PTR_ERR(data->sfrbase); - ret = platform_get_irq(pdev, 0); - if (ret <= 0) { + irq = platform_get_irq(pdev, 0); + if (irq <= 0) { dev_dbg(dev, "Unable to find IRQ resource\n"); - goto err_irq; + return irq; } - ret = request_irq(ret, exynos_sysmmu_irq, 0, + ret = devm_request_irq(dev, irq, exynos_sysmmu_irq, 0, dev_name(dev), data); if (ret) { - dev_dbg(dev, "Unabled to register interrupt handler\n"); - goto err_irq; + dev_err(dev, "Unabled to register handler of irq %d\n", irq); + return ret; } - if (dev_get_platdata(dev)) { - data->clk = clk_get(dev, "sysmmu"); - if (IS_ERR(data->clk)) { - data->clk = NULL; - dev_dbg(dev, "No clock descriptor registered\n"); - } + data->clk = devm_clk_get(dev, "sysmmu"); + if (IS_ERR(data->clk)) { + dev_info(dev, "No gate clock found!\n"); + data->clk = NULL; + } + + ret = clk_prepare(data->clk); + if (ret) { + dev_err(dev, "Failed to prepare clk\n"); + return ret; } data->sysmmu = dev; @@ -556,17 +553,8 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) pm_runtime_enable(dev); - dev_dbg(dev, "Initialized\n"); + dev_dbg(dev, "Probed and initialized\n"); return 0; -err_irq: - free_irq(platform_get_irq(pdev, 0), data); -err_res: - iounmap(data->sfrbase); -err_init: - kfree(data); -err_alloc: - dev_err(dev, "Failed to initialize\n"); - return ret; } static struct platform_driver exynos_sysmmu_driver = { -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 15+ messages in thread
[parent not found: <20140314140542.f4ded6c50dbd8a1d937bf354-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions [not found] ` <20140314140542.f4ded6c50dbd8a1d937bf354-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> @ 2014-03-14 13:28 ` Tomasz Figa 2014-03-18 10:38 ` Cho KyongHo 2014-03-14 15:22 ` Sachin Kamat 1 sibling, 1 reply; 15+ messages in thread From: Tomasz Figa @ 2014-03-14 13:28 UTC (permalink / raw) To: Cho KyongHo, Linux ARM Kernel, Linux DeviceTree, Linux IOMMU, Linux Kernel, Linux Samsung SOC Cc: Kukjin Kim, Prathyush, Grant Grundler, Sachin Kamat, Sylwester Nawrocki, Varun Sethi, Antonios Motakis, Rahul Sharma Hi KyongHo, On 14.03.2014 06:05, Cho KyongHo wrote: > This patch uses managed device helper functions in the probe(). > > Signed-off-by: Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> > --- > drivers/iommu/exynos-iommu.c | 64 +++++++++++++++++------------------------- > 1 file changed, 26 insertions(+), 38 deletions(-) > > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c > index 36e6b73..33b424d 100644 > --- a/drivers/iommu/exynos-iommu.c > +++ b/drivers/iommu/exynos-iommu.c > @@ -499,51 +499,48 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) > > static int exynos_sysmmu_probe(struct platform_device *pdev) > { > - int ret; > + int irq, ret; > struct device *dev = &pdev->dev; > struct sysmmu_drvdata *data; > struct resource *res; > > - data = kzalloc(sizeof(*data), GFP_KERNEL); > - if (!data) { > - dev_dbg(dev, "Not enough memory\n"); > - ret = -ENOMEM; > - goto err_alloc; > - } > + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); > + if (!data) > + return -ENOMEM; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > if (!res) { > - dev_dbg(dev, "Unable to find IOMEM region\n"); > - ret = -ENOENT; > - goto err_init; > + dev_err(dev, "Unable to find IOMEM region\n"); > + return -ENOENT; > } No need to check for error and print message, because devm_ioremap_resource() already checks the passed resource and handles error cases. Best regards, Tomasz ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions 2014-03-14 13:28 ` Tomasz Figa @ 2014-03-18 10:38 ` Cho KyongHo [not found] ` <20140318193817.3448387b75e109e814b9c025-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 15+ messages in thread From: Cho KyongHo @ 2014-03-18 10:38 UTC (permalink / raw) To: Tomasz Figa Cc: Linux ARM Kernel, Linux DeviceTree, Linux IOMMU, Linux Kernel, Linux Samsung SOC, Antonios Motakis, Grant Grundler, Joerg Roedel, Kukjin Kim, Prathyush, Rahul Sharma, Sachin Kamat, Sylwester Nawrocki, Varun Sethi On Fri, 14 Mar 2014 14:28:36 +0100, Tomasz Figa wrote: > Hi KyongHo, > > On 14.03.2014 06:05, Cho KyongHo wrote: > > This patch uses managed device helper functions in the probe(). > > > > Signed-off-by: Cho KyongHo <pullip.cho@samsung.com> > > --- > > drivers/iommu/exynos-iommu.c | 64 +++++++++++++++++------------------------- > > 1 file changed, 26 insertions(+), 38 deletions(-) > > > > diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c > > index 36e6b73..33b424d 100644 > > --- a/drivers/iommu/exynos-iommu.c > > +++ b/drivers/iommu/exynos-iommu.c > > @@ -499,51 +499,48 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) > > > > static int exynos_sysmmu_probe(struct platform_device *pdev) > > { > > - int ret; > > + int irq, ret; > > struct device *dev = &pdev->dev; > > struct sysmmu_drvdata *data; > > struct resource *res; > > > > - data = kzalloc(sizeof(*data), GFP_KERNEL); > > - if (!data) { > > - dev_dbg(dev, "Not enough memory\n"); > > - ret = -ENOMEM; > > - goto err_alloc; > > - } > > + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); > > + if (!data) > > + return -ENOMEM; > > > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > if (!res) { > > - dev_dbg(dev, "Unable to find IOMEM region\n"); > > - ret = -ENOENT; > > - goto err_init; > > + dev_err(dev, "Unable to find IOMEM region\n"); > > + return -ENOENT; > > } > > No need to check for error and print message, because > devm_ioremap_resource() already checks the passed resource and handles > error cases. > Yes but devm_ioremap_resource() just tells that the given 'res' is not correct. I think the message in the driver is more informative. Thanks. KyongHo ^ permalink raw reply [flat|nested] 15+ messages in thread
[parent not found: <20140318193817.3448387b75e109e814b9c025-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions [not found] ` <20140318193817.3448387b75e109e814b9c025-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> @ 2014-03-18 15:12 ` Tomasz Figa 2014-03-18 23:59 ` Jingoo Han 0 siblings, 1 reply; 15+ messages in thread From: Tomasz Figa @ 2014-03-18 15:12 UTC (permalink / raw) To: Cho KyongHo Cc: Linux DeviceTree, Linux Samsung SOC, Prathyush, Grant Grundler, Linux Kernel, Sachin Kamat, Linux IOMMU, Kukjin Kim, Sylwester Nawrocki, Varun Sethi, Antonios Motakis, Linux ARM Kernel, Rahul Sharma On 18.03.2014 11:38, Cho KyongHo wrote: > On Fri, 14 Mar 2014 14:28:36 +0100, Tomasz Figa wrote: >> Hi KyongHo, >> >> On 14.03.2014 06:05, Cho KyongHo wrote: >>> This patch uses managed device helper functions in the probe(). >>> >>> Signed-off-by: Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> >>> --- >>> drivers/iommu/exynos-iommu.c | 64 +++++++++++++++++------------------------- >>> 1 file changed, 26 insertions(+), 38 deletions(-) >>> >>> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c >>> index 36e6b73..33b424d 100644 >>> --- a/drivers/iommu/exynos-iommu.c >>> +++ b/drivers/iommu/exynos-iommu.c >>> @@ -499,51 +499,48 @@ void exynos_sysmmu_tlb_invalidate(struct device *dev) >>> >>> static int exynos_sysmmu_probe(struct platform_device *pdev) >>> { >>> - int ret; >>> + int irq, ret; >>> struct device *dev = &pdev->dev; >>> struct sysmmu_drvdata *data; >>> struct resource *res; >>> >>> - data = kzalloc(sizeof(*data), GFP_KERNEL); >>> - if (!data) { >>> - dev_dbg(dev, "Not enough memory\n"); >>> - ret = -ENOMEM; >>> - goto err_alloc; >>> - } >>> + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); >>> + if (!data) >>> + return -ENOMEM; >>> >>> res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >>> if (!res) { >>> - dev_dbg(dev, "Unable to find IOMEM region\n"); >>> - ret = -ENOENT; >>> - goto err_init; >>> + dev_err(dev, "Unable to find IOMEM region\n"); >>> + return -ENOENT; >>> } >> >> No need to check for error and print message, because >> devm_ioremap_resource() already checks the passed resource and handles >> error cases. >> > > Yes but devm_ioremap_resource() just tells that the given 'res' is not > correct. I think the message in the driver is more informative. The common practice used in Linux kernel is to not duplicate such messages. It is obvious that devm_ioremap_resource() printing such message is related to an IOMEM resource anyway, as you can't used it with other types of resources. Best regards, Tomasz ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions 2014-03-18 15:12 ` Tomasz Figa @ 2014-03-18 23:59 ` Jingoo Han [not found] ` <001201cf4306$0e16e540$2a44afc0$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 15+ messages in thread From: Jingoo Han @ 2014-03-18 23:59 UTC (permalink / raw) To: 'Tomasz Figa', 'Cho KyongHo' Cc: 'Linux DeviceTree', 'Linux Samsung SOC', 'Prathyush', 'Grant Grundler', 'Joerg Roedel', 'Jingoo Han', 'Linux Kernel', 'Sachin Kamat', 'Linux IOMMU', 'Kukjin Kim', 'Sylwester Nawrocki', 'Varun Sethi', 'Antonios Motakis', 'Linux ARM Kernel', 'Rahul Sharma' On Wednesday, March 19, 2014 12:12 AM, Tomasz Figa wrote: > On 18.03.2014 11:38, Cho KyongHo wrote: > > On Fri, 14 Mar 2014 14:28:36 +0100, Tomasz Figa wrote: > >> On 14.03.2014 06:05, Cho KyongHo wrote: > >>> This patch uses managed device helper functions in the probe(). > >>> > >>> Signed-off-by: Cho KyongHo <pullip.cho@samsung.com> > >>> --- > >>> drivers/iommu/exynos-iommu.c | 64 +++++++++++++++++------------------------- > >>> 1 file changed, 26 insertions(+), 38 deletions(-) > >>> > >>> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c > >>> index 36e6b73..33b424d 100644 > >>> --- a/drivers/iommu/exynos-iommu.c > >>> +++ b/drivers/iommu/exynos-iommu.c [.....] > >>> res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > >>> if (!res) { > >>> - dev_dbg(dev, "Unable to find IOMEM region\n"); > >>> - ret = -ENOENT; > >>> - goto err_init; > >>> + dev_err(dev, "Unable to find IOMEM region\n"); > >>> + return -ENOENT; > >>> } > >> > >> No need to check for error and print message, because > >> devm_ioremap_resource() already checks the passed resource and handles > >> error cases. > >> > > > > Yes but devm_ioremap_resource() just tells that the given 'res' is not > > correct. I think the message in the driver is more informative. > > The common practice used in Linux kernel is to not duplicate such > messages. It is obvious that devm_ioremap_resource() printing such > message is related to an IOMEM resource anyway, as you can't used it > with other types of resources. +1 I agree with Tomasz Figa's opinion. These messages have been being removed from Linux kernel. Thank you. Best regards, Jingoo Han ^ permalink raw reply [flat|nested] 15+ messages in thread
[parent not found: <001201cf4306$0e16e540$2a44afc0$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions [not found] ` <001201cf4306$0e16e540$2a44afc0$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> @ 2014-03-19 8:56 ` Cho KyongHo 0 siblings, 0 replies; 15+ messages in thread From: Cho KyongHo @ 2014-03-19 8:56 UTC (permalink / raw) To: Jingoo Han Cc: 'Linux DeviceTree', 'Linux Samsung SOC', 'Prathyush', 'Grant Grundler', 'Tomasz Figa', 'Linux Kernel', 'Sachin Kamat', 'Linux IOMMU', 'Kukjin Kim', 'Sylwester Nawrocki', 'Varun Sethi', 'Antonios Motakis', 'Linux ARM Kernel', 'Rahul Sharma' On Wed, 19 Mar 2014 08:59:09 +0900, Jingoo Han wrote: > On Wednesday, March 19, 2014 12:12 AM, Tomasz Figa wrote: > > On 18.03.2014 11:38, Cho KyongHo wrote: > > > On Fri, 14 Mar 2014 14:28:36 +0100, Tomasz Figa wrote: > > >> On 14.03.2014 06:05, Cho KyongHo wrote: > > >>> This patch uses managed device helper functions in the probe(). > > >>> > > >>> Signed-off-by: Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> > > >>> --- > > >>> drivers/iommu/exynos-iommu.c | 64 +++++++++++++++++------------------------- > > >>> 1 file changed, 26 insertions(+), 38 deletions(-) > > >>> > > >>> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c > > >>> index 36e6b73..33b424d 100644 > > >>> --- a/drivers/iommu/exynos-iommu.c > > >>> +++ b/drivers/iommu/exynos-iommu.c > > [.....] > > > >>> res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > >>> if (!res) { > > >>> - dev_dbg(dev, "Unable to find IOMEM region\n"); > > >>> - ret = -ENOENT; > > >>> - goto err_init; > > >>> + dev_err(dev, "Unable to find IOMEM region\n"); > > >>> + return -ENOENT; > > >>> } > > >> > > >> No need to check for error and print message, because > > >> devm_ioremap_resource() already checks the passed resource and handles > > >> error cases. > > >> > > > > > > Yes but devm_ioremap_resource() just tells that the given 'res' is not > > > correct. I think the message in the driver is more informative. > > > > The common practice used in Linux kernel is to not duplicate such > > messages. It is obvious that devm_ioremap_resource() printing such > > message is related to an IOMEM resource anyway, as you can't used it > > with other types of resources. > > +1 > > I agree with Tomasz Figa's opinion. > These messages have been being removed from Linux kernel. > Thank you. > Ok. Thank you for the advice. Kyong Ho ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions [not found] ` <20140314140542.f4ded6c50dbd8a1d937bf354-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 2014-03-14 13:28 ` Tomasz Figa @ 2014-03-14 15:22 ` Sachin Kamat [not found] ` <CAK9yfHw7zYaX9EYFE+m3Mh-u8Uiyubx-cS0EwPmfW+0weLiBKw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 1 sibling, 1 reply; 15+ messages in thread From: Sachin Kamat @ 2014-03-14 15:22 UTC (permalink / raw) To: Cho KyongHo Cc: Linux DeviceTree, Linux Samsung SOC, Prathyush, Grant Grundler, Linux Kernel, Linux IOMMU, Kukjin Kim, Sylwester Nawrocki, Varun Sethi, Antonios Motakis, Tomasz Figa, Linux ARM Kernel, Rahul Sharma Hi KyongHo, On 14 March 2014 10:35, Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: > This patch uses managed device helper functions in the probe(). > > Signed-off-by: Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> > --- [snip] > + data->clk = devm_clk_get(dev, "sysmmu"); > + if (IS_ERR(data->clk)) { > + dev_info(dev, "No gate clock found!\n"); > + data->clk = NULL; > + } Why aren't you returning from here upon error? > + > + ret = clk_prepare(data->clk); > + if (ret) { > + dev_err(dev, "Failed to prepare clk\n"); > + return ret; > } > > data->sysmmu = dev; > @@ -556,17 +553,8 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) > > pm_runtime_enable(dev); > > - dev_dbg(dev, "Initialized\n"); > + dev_dbg(dev, "Probed and initialized\n"); This message looks redundant. -- With warm regards, Sachin ^ permalink raw reply [flat|nested] 15+ messages in thread
[parent not found: <CAK9yfHw7zYaX9EYFE+m3Mh-u8Uiyubx-cS0EwPmfW+0weLiBKw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions [not found] ` <CAK9yfHw7zYaX9EYFE+m3Mh-u8Uiyubx-cS0EwPmfW+0weLiBKw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2014-03-18 11:09 ` Cho KyongHo 2014-03-18 15:14 ` Tomasz Figa 0 siblings, 1 reply; 15+ messages in thread From: Cho KyongHo @ 2014-03-18 11:09 UTC (permalink / raw) To: Sachin Kamat Cc: Linux DeviceTree, Linux Samsung SOC, Prathyush, Grant Grundler, Linux Kernel, Linux IOMMU, Kukjin Kim, Sylwester Nawrocki, Varun Sethi, Antonios Motakis, Tomasz Figa, Linux ARM Kernel, Rahul Sharma On Fri, 14 Mar 2014 20:52:43 +0530, Sachin Kamat wrote: > Hi KyongHo, > > On 14 March 2014 10:35, Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: > > This patch uses managed device helper functions in the probe(). > > > > Signed-off-by: Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> > > --- > [snip] > > > + data->clk = devm_clk_get(dev, "sysmmu"); > > + if (IS_ERR(data->clk)) { > > + dev_info(dev, "No gate clock found!\n"); > > + data->clk = NULL; > > + } > > Why aren't you returning from here upon error? It is for the case of a System MMU which does not need clock gating. > > + > > + ret = clk_prepare(data->clk); > > + if (ret) { > > + dev_err(dev, "Failed to prepare clk\n"); > > + return ret; > > } > > > > data->sysmmu = dev; > > @@ -556,17 +553,8 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) > > > > pm_runtime_enable(dev); > > > > - dev_dbg(dev, "Initialized\n"); > > + dev_dbg(dev, "Probed and initialized\n"); > > This message looks redundant. Ok. Do you mean that checking sysfs does the same? Thank you. KyongHo. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions 2014-03-18 11:09 ` Cho KyongHo @ 2014-03-18 15:14 ` Tomasz Figa [not found] ` <532862ED.8040809-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 15+ messages in thread From: Tomasz Figa @ 2014-03-18 15:14 UTC (permalink / raw) To: Cho KyongHo, Sachin Kamat Cc: Linux ARM Kernel, Linux DeviceTree, Linux IOMMU, Linux Kernel, Linux Samsung SOC, Antonios Motakis, Grant Grundler, Joerg Roedel, Kukjin Kim, Prathyush, Rahul Sharma, Sylwester Nawrocki, Varun Sethi On 18.03.2014 12:09, Cho KyongHo wrote: > On Fri, 14 Mar 2014 20:52:43 +0530, Sachin Kamat wrote: >> Hi KyongHo, >> >> On 14 March 2014 10:35, Cho KyongHo <pullip.cho@samsung.com> wrote: >>> This patch uses managed device helper functions in the probe(). >>> >>> Signed-off-by: Cho KyongHo <pullip.cho@samsung.com> >>> --- >> [snip] >> >>> + data->clk = devm_clk_get(dev, "sysmmu"); >>> + if (IS_ERR(data->clk)) { >>> + dev_info(dev, "No gate clock found!\n"); >>> + data->clk = NULL; >>> + } >> >> Why aren't you returning from here upon error? > > It is for the case of a System MMU which does not need clock gating. > Are there really such cases? Best regards, Tomasz ^ permalink raw reply [flat|nested] 15+ messages in thread
[parent not found: <532862ED.8040809-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions [not found] ` <532862ED.8040809-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> @ 2014-03-19 8:59 ` Cho KyongHo [not found] ` <20140319175927.a3feadcacbffe80eca1d3421-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 15+ messages in thread From: Cho KyongHo @ 2014-03-19 8:59 UTC (permalink / raw) To: Tomasz Figa Cc: Linux DeviceTree, Linux Samsung SOC, Prathyush, Sachin Kamat, Linux Kernel, Grant Grundler, Linux IOMMU, Kukjin Kim, Sylwester Nawrocki, Varun Sethi, Antonios Motakis, Linux ARM Kernel, Rahul Sharma On Tue, 18 Mar 2014 16:14:53 +0100, Tomasz Figa wrote: > On 18.03.2014 12:09, Cho KyongHo wrote: > > On Fri, 14 Mar 2014 20:52:43 +0530, Sachin Kamat wrote: > >> Hi KyongHo, > >> > >> On 14 March 2014 10:35, Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: > >>> This patch uses managed device helper functions in the probe(). > >>> > >>> Signed-off-by: Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> > >>> --- > >> [snip] > >> > >>> + data->clk = devm_clk_get(dev, "sysmmu"); > >>> + if (IS_ERR(data->clk)) { > >>> + dev_info(dev, "No gate clock found!\n"); > >>> + data->clk = NULL; > >>> + } > >> > >> Why aren't you returning from here upon error? > > > > It is for the case of a System MMU which does not need clock gating. > > > > Are there really such cases? > Yes. Especially in the case of initial stage of new SoC development. I have experianced some software workaround for H/W restriction needs prevention of clock gating for some devices. Regards, KyongHo ^ permalink raw reply [flat|nested] 15+ messages in thread
[parent not found: <20140319175927.a3feadcacbffe80eca1d3421-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions [not found] ` <20140319175927.a3feadcacbffe80eca1d3421-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> @ 2014-03-19 9:01 ` Sachin Kamat 2014-03-19 12:08 ` Tomasz Figa 0 siblings, 1 reply; 15+ messages in thread From: Sachin Kamat @ 2014-03-19 9:01 UTC (permalink / raw) To: Cho KyongHo Cc: Linux DeviceTree, Linux Samsung SOC, Prathyush, Grant Grundler, Tomasz Figa, Linux Kernel, Linux IOMMU, Kukjin Kim, Sylwester Nawrocki, Varun Sethi, Antonios Motakis, Linux ARM Kernel, Rahul Sharma On 19 March 2014 14:29, Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: > On Tue, 18 Mar 2014 16:14:53 +0100, Tomasz Figa wrote: >> On 18.03.2014 12:09, Cho KyongHo wrote: >> > On Fri, 14 Mar 2014 20:52:43 +0530, Sachin Kamat wrote: >> >> Hi KyongHo, >> >> >> >> On 14 March 2014 10:35, Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: >> >>> This patch uses managed device helper functions in the probe(). >> >>> >> >>> Signed-off-by: Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> >> >>> --- >> >> [snip] >> >> >> >>> + data->clk = devm_clk_get(dev, "sysmmu"); >> >>> + if (IS_ERR(data->clk)) { >> >>> + dev_info(dev, "No gate clock found!\n"); >> >>> + data->clk = NULL; >> >>> + } >> >> >> >> Why aren't you returning from here upon error? >> > >> > It is for the case of a System MMU which does not need clock gating. >> > >> >> Are there really such cases? >> > > Yes. > Especially in the case of initial stage of new SoC development. > > I have experianced some software workaround for H/W restriction > needs prevention of clock gating for some devices. So aren't these basically some exceptions/hacks rather than the usual way of functioning of the device? -- With warm regards, Sachin ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions 2014-03-19 9:01 ` Sachin Kamat @ 2014-03-19 12:08 ` Tomasz Figa [not found] ` <532988CA.4000008-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 15+ messages in thread From: Tomasz Figa @ 2014-03-19 12:08 UTC (permalink / raw) To: Sachin Kamat, Cho KyongHo Cc: Linux ARM Kernel, Linux DeviceTree, Linux IOMMU, Linux Kernel, Linux Samsung SOC, Antonios Motakis, Grant Grundler, Joerg Roedel, Kukjin Kim, Prathyush, Rahul Sharma, Sylwester Nawrocki, Varun Sethi On 19.03.2014 10:01, Sachin Kamat wrote: > On 19 March 2014 14:29, Cho KyongHo <pullip.cho@samsung.com> wrote: >> On Tue, 18 Mar 2014 16:14:53 +0100, Tomasz Figa wrote: >>> On 18.03.2014 12:09, Cho KyongHo wrote: >>>> On Fri, 14 Mar 2014 20:52:43 +0530, Sachin Kamat wrote: >>>>> Hi KyongHo, >>>>> >>>>> On 14 March 2014 10:35, Cho KyongHo <pullip.cho@samsung.com> wrote: >>>>>> This patch uses managed device helper functions in the probe(). >>>>>> >>>>>> Signed-off-by: Cho KyongHo <pullip.cho@samsung.com> >>>>>> --- >>>>> [snip] >>>>> >>>>>> + data->clk = devm_clk_get(dev, "sysmmu"); >>>>>> + if (IS_ERR(data->clk)) { >>>>>> + dev_info(dev, "No gate clock found!\n"); >>>>>> + data->clk = NULL; >>>>>> + } >>>>> >>>>> Why aren't you returning from here upon error? >>>> >>>> It is for the case of a System MMU which does not need clock gating. >>>> >>> >>> Are there really such cases? >>> >> >> Yes. >> Especially in the case of initial stage of new SoC development. >> >> I have experianced some software workaround for H/W restriction >> needs prevention of clock gating for some devices. > > So aren't these basically some exceptions/hacks rather than the usual way > of functioning of the device? > This actually raises a good question, whether we really need to support such early development SoC versions in mainline. Another thing is that if you need to assure that a clock is ungated, you must acquire it and prepare_enable explicitly, so I don't think this kind of handling is correct. Best regards, Tomasz ^ permalink raw reply [flat|nested] 15+ messages in thread
[parent not found: <532988CA.4000008-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions [not found] ` <532988CA.4000008-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> @ 2014-03-20 10:03 ` Cho KyongHo 2014-03-20 10:44 ` Tomasz Figa 0 siblings, 1 reply; 15+ messages in thread From: Cho KyongHo @ 2014-03-20 10:03 UTC (permalink / raw) To: Tomasz Figa Cc: Sachin Kamat, Linux ARM Kernel, Linux DeviceTree, Linux IOMMU, Linux Kernel, Linux Samsung SOC, Antonios Motakis, Grant Grundler, Joerg Roedel, Kukjin Kim, Prathyush, Rahul Sharma, Sylwester Nawrocki, Varun Sethi On Wed, 19 Mar 2014 13:08:42 +0100, Tomasz Figa wrote: > On 19.03.2014 10:01, Sachin Kamat wrote: > > On 19 March 2014 14:29, Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: > >> On Tue, 18 Mar 2014 16:14:53 +0100, Tomasz Figa wrote: > >>> On 18.03.2014 12:09, Cho KyongHo wrote: > >>>> On Fri, 14 Mar 2014 20:52:43 +0530, Sachin Kamat wrote: > >>>>> Hi KyongHo, > >>>>> > >>>>> On 14 March 2014 10:35, Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: > >>>>>> This patch uses managed device helper functions in the probe(). > >>>>>> > >>>>>> Signed-off-by: Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> > >>>>>> --- > >>>>> [snip] > >>>>> > >>>>>> + data->clk = devm_clk_get(dev, "sysmmu"); > >>>>>> + if (IS_ERR(data->clk)) { > >>>>>> + dev_info(dev, "No gate clock found!\n"); > >>>>>> + data->clk = NULL; > >>>>>> + } > >>>>> > >>>>> Why aren't you returning from here upon error? > >>>> > >>>> It is for the case of a System MMU which does not need clock gating. > >>>> > >>> > >>> Are there really such cases? > >>> > >> > >> Yes. > >> Especially in the case of initial stage of new SoC development. > >> > >> I have experianced some software workaround for H/W restriction > >> needs prevention of clock gating for some devices. > > > > So aren't these basically some exceptions/hacks rather than the usual way > > of functioning of the device? > > > > This actually raises a good question, whether we really need to support > such early development SoC versions in mainline. > > Another thing is that if you need to assure that a clock is ungated, you > must acquire it and prepare_enable explicitly, so I don't think this > kind of handling is correct. > On early development step of a new SoC, clock related stuffs and some device drivers like display controller are usually developed in parallel. In that case, -ENOENT from clk_get() must not treated as an error. "[PATCH v11 20/17] iommu/exynos: allow having multiple System MMUs for a master H/W" patch distinguishes -ENOENT from other error values returned by devm_clk_get(). Regards, KyongHo -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions 2014-03-20 10:03 ` Cho KyongHo @ 2014-03-20 10:44 ` Tomasz Figa [not found] ` <532AC6A2.9070307-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 15+ messages in thread From: Tomasz Figa @ 2014-03-20 10:44 UTC (permalink / raw) To: Cho KyongHo, Tomasz Figa Cc: Linux DeviceTree, Linux Samsung SOC, Prathyush, Sachin Kamat, Joerg Roedel, Linux Kernel, Grant Grundler, Linux IOMMU, Kukjin Kim, Sylwester Nawrocki, Varun Sethi, Antonios Motakis, Linux ARM Kernel, Rahul Sharma On 20.03.2014 11:03, Cho KyongHo wrote: > On Wed, 19 Mar 2014 13:08:42 +0100, Tomasz Figa wrote: >> On 19.03.2014 10:01, Sachin Kamat wrote: >>> On 19 March 2014 14:29, Cho KyongHo <pullip.cho@samsung.com> wrote: >>>> On Tue, 18 Mar 2014 16:14:53 +0100, Tomasz Figa wrote: >>>>> On 18.03.2014 12:09, Cho KyongHo wrote: >>>>>> On Fri, 14 Mar 2014 20:52:43 +0530, Sachin Kamat wrote: >>>>>>> Hi KyongHo, >>>>>>> >>>>>>> On 14 March 2014 10:35, Cho KyongHo <pullip.cho@samsung.com> wrote: >>>>>>>> This patch uses managed device helper functions in the probe(). >>>>>>>> >>>>>>>> Signed-off-by: Cho KyongHo <pullip.cho@samsung.com> >>>>>>>> --- >>>>>>> [snip] >>>>>>> >>>>>>>> + data->clk = devm_clk_get(dev, "sysmmu"); >>>>>>>> + if (IS_ERR(data->clk)) { >>>>>>>> + dev_info(dev, "No gate clock found!\n"); >>>>>>>> + data->clk = NULL; >>>>>>>> + } >>>>>>> >>>>>>> Why aren't you returning from here upon error? >>>>>> >>>>>> It is for the case of a System MMU which does not need clock gating. >>>>>> >>>>> >>>>> Are there really such cases? >>>>> >>>> >>>> Yes. >>>> Especially in the case of initial stage of new SoC development. >>>> >>>> I have experianced some software workaround for H/W restriction >>>> needs prevention of clock gating for some devices. >>> >>> So aren't these basically some exceptions/hacks rather than the usual way >>> of functioning of the device? >>> >> >> This actually raises a good question, whether we really need to support >> such early development SoC versions in mainline. >> >> Another thing is that if you need to assure that a clock is ungated, you >> must acquire it and prepare_enable explicitly, so I don't think this >> kind of handling is correct. >> > On early development step of a new SoC, clock related stuffs and > some device drivers like display controller are usually developed in parallel. > > In that case, -ENOENT from clk_get() must not treated as an error. > "[PATCH v11 20/17] iommu/exynos: allow having multiple System MMUs for a master H/W" > patch distinguishes -ENOENT from other error values returned by devm_clk_get(). I still don't think upstream is right place for such development hacks and such assumption will mask potential errors caused by clocks unspecified in DT. If such thing is needed for development, an extra patch might be kept in development tree, until clock driver is implemented or a dummy fixed-rate clock might be specified in DT. Best regards, Tomasz ^ permalink raw reply [flat|nested] 15+ messages in thread
[parent not found: <532AC6A2.9070307-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH v11 10/27] iommu/exynos: use managed device helper functions [not found] ` <532AC6A2.9070307-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2014-03-21 4:49 ` Cho KyongHo 0 siblings, 0 replies; 15+ messages in thread From: Cho KyongHo @ 2014-03-21 4:49 UTC (permalink / raw) To: Tomasz Figa Cc: Linux DeviceTree, Linux Samsung SOC, Prathyush, Sachin Kamat, Tomasz Figa, Linux Kernel, Grant Grundler, Linux IOMMU, Kukjin Kim, Sylwester Nawrocki, Antonios Motakis, Varun Sethi, Linux ARM Kernel, Rahul Sharma On Thu, 20 Mar 2014 11:44:50 +0100, Tomasz Figa wrote: > On 20.03.2014 11:03, Cho KyongHo wrote: > > On Wed, 19 Mar 2014 13:08:42 +0100, Tomasz Figa wrote: > >> On 19.03.2014 10:01, Sachin Kamat wrote: > >>> On 19 March 2014 14:29, Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: > >>>> On Tue, 18 Mar 2014 16:14:53 +0100, Tomasz Figa wrote: > >>>>> On 18.03.2014 12:09, Cho KyongHo wrote: > >>>>>> On Fri, 14 Mar 2014 20:52:43 +0530, Sachin Kamat wrote: > >>>>>>> Hi KyongHo, > >>>>>>> > >>>>>>> On 14 March 2014 10:35, Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: > >>>>>>>> This patch uses managed device helper functions in the probe(). > >>>>>>>> > >>>>>>>> Signed-off-by: Cho KyongHo <pullip.cho-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> > >>>>>>>> --- > >>>>>>> [snip] > >>>>>>> > >>>>>>>> + data->clk = devm_clk_get(dev, "sysmmu"); > >>>>>>>> + if (IS_ERR(data->clk)) { > >>>>>>>> + dev_info(dev, "No gate clock found!\n"); > >>>>>>>> + data->clk = NULL; > >>>>>>>> + } > >>>>>>> > >>>>>>> Why aren't you returning from here upon error? > >>>>>> > >>>>>> It is for the case of a System MMU which does not need clock gating. > >>>>>> > >>>>> > >>>>> Are there really such cases? > >>>>> > >>>> > >>>> Yes. > >>>> Especially in the case of initial stage of new SoC development. > >>>> > >>>> I have experianced some software workaround for H/W restriction > >>>> needs prevention of clock gating for some devices. > >>> > >>> So aren't these basically some exceptions/hacks rather than the usual way > >>> of functioning of the device? > >>> > >> > >> This actually raises a good question, whether we really need to support > >> such early development SoC versions in mainline. > >> > >> Another thing is that if you need to assure that a clock is ungated, you > >> must acquire it and prepare_enable explicitly, so I don't think this > >> kind of handling is correct. > >> > > On early development step of a new SoC, clock related stuffs and > > some device drivers like display controller are usually developed in parallel. > > > > In that case, -ENOENT from clk_get() must not treated as an error. > > "[PATCH v11 20/17] iommu/exynos: allow having multiple System MMUs for a master H/W" > > patch distinguishes -ENOENT from other error values returned by devm_clk_get(). > > I still don't think upstream is right place for such development hacks > and such assumption will mask potential errors caused by clocks > unspecified in DT. > > If such thing is needed for development, an extra patch might be kept in > development tree, until clock driver is implemented or a dummy > fixed-rate clock might be specified in DT. > Ok. Now I understand. Error from clk_get() will be failure of probe in the next patch series. Thanks. KyongHo ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2014-03-21 4:49 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-03-14 5:05 [PATCH v11 10/27] iommu/exynos: use managed device helper functions Cho KyongHo [not found] ` <20140314140542.f4ded6c50dbd8a1d937bf354-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 2014-03-14 13:28 ` Tomasz Figa 2014-03-18 10:38 ` Cho KyongHo [not found] ` <20140318193817.3448387b75e109e814b9c025-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 2014-03-18 15:12 ` Tomasz Figa 2014-03-18 23:59 ` Jingoo Han [not found] ` <001201cf4306$0e16e540$2a44afc0$%han-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 2014-03-19 8:56 ` Cho KyongHo 2014-03-14 15:22 ` Sachin Kamat [not found] ` <CAK9yfHw7zYaX9EYFE+m3Mh-u8Uiyubx-cS0EwPmfW+0weLiBKw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2014-03-18 11:09 ` Cho KyongHo 2014-03-18 15:14 ` Tomasz Figa [not found] ` <532862ED.8040809-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 2014-03-19 8:59 ` Cho KyongHo [not found] ` <20140319175927.a3feadcacbffe80eca1d3421-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 2014-03-19 9:01 ` Sachin Kamat 2014-03-19 12:08 ` Tomasz Figa [not found] ` <532988CA.4000008-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 2014-03-20 10:03 ` Cho KyongHo 2014-03-20 10:44 ` Tomasz Figa [not found] ` <532AC6A2.9070307-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2014-03-21 4:49 ` Cho KyongHo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).