From: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
To: Arun Kumar K <arun.kk@samsung.com>
Cc: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
devicetree@vger.kernel.org, s.nawrocki@samsung.com,
hverkuil@xs4all.nl, swarren@wwwdotorg.org, mark.rutland@arm.com,
Pawel.Moll@arm.com, galak@codeaurora.org, a.hajda@samsung.com,
sachin.kamat@linaro.org, shaik.ameer@samsung.com,
kilyeon.im@samsung.com, arunkk.samsung@gmail.com
Subject: Re: [PATCH v8 02/12] [media] exynos5-fimc-is: Add driver core files
Date: Mon, 16 Sep 2013 23:59:24 +0200 [thread overview]
Message-ID: <52377F3C.5070508@gmail.com> (raw)
In-Reply-To: <1378987669-10870-3-git-send-email-arun.kk@samsung.com>
On 09/12/2013 02:07 PM, Arun Kumar K wrote:
>
> +static int fimc_is_probe(struct platform_device *pdev)
> +{
> + struct device *dev =&pdev->dev;
> + struct resource *res;
> + struct fimc_is *is;
> + void __iomem *regs;
> + struct device_node *node;
> + int irq, ret;
> + int i;
> +
> + dev_dbg(dev, "FIMC-IS Probe Enter\n");
> +
> + if (!pdev->dev.of_node)
nit: Could be simplified to:
if (!dev->of_node)
> + return -ENODEV;
> +
> + is = devm_kzalloc(&pdev->dev, sizeof(*is), GFP_KERNEL);
> + if (!is)
> + return -ENOMEM;
> +
> + is->pdev = pdev;
> +
> + is->drvdata = fimc_is_get_drvdata(pdev);
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + regs = devm_ioremap_resource(dev, res);
> + if (IS_ERR(regs))
> + return PTR_ERR(regs);
> +
> + /* Get the PMU base */
> + node = of_parse_phandle(dev->of_node, "samsung,pmu", 0);
> + if (!node)
> + return -ENODEV;
> + is->pmu_regs = of_iomap(node, 0);
> + if (!is->pmu_regs)
> + return -ENOMEM;
> +
> + irq = irq_of_parse_and_map(dev->of_node, 0);
> + if (irq< 0) {
> + dev_err(dev, "Failed to get IRQ\n");
> + return irq;
> + }
> +
> + ret = fimc_is_configure_clocks(is);
> + if (ret< 0) {
> + dev_err(dev, "clocks configuration failed\n");
> + goto err_clk;
> + }
> +
> + platform_set_drvdata(pdev, is);
> + pm_runtime_enable(dev);
> +
> + ret = pm_runtime_get_sync(dev);
> + if (ret< 0)
> + goto err_pm;
Is activating the device at this point really needed ? Perhaps you
could drop the pm_runtime_get/put calls ?
> + is->alloc_ctx = vb2_dma_contig_init_ctx(dev);
> + if (IS_ERR(is->alloc_ctx)) {
> + ret = PTR_ERR(is->alloc_ctx);
> + goto err_vb;
> + }
> +
> + /* Get IS-sensor contexts */
> + ret = fimc_is_parse_sensor(is);
> + if (ret< 0)
> + goto err_vb;
> +
> + /* Initialize FIMC Pipeline */
> + for (i = 0; i< is->drvdata->num_instances; i++) {
> + ret = fimc_is_pipeline_init(&is->pipeline[i], i, is);
> + if (ret< 0)
> + goto err_sd;
> + }
> +
> + /* Initialize FIMC Interface */
> + ret = fimc_is_interface_init(&is->interface, regs, irq);
> + if (ret< 0)
> + goto err_sd;
> +
> + pm_runtime_put(dev);
> +
> + dev_dbg(dev, "FIMC-IS registered successfully\n");
> +
> + return 0;
> +
> +err_sd:
> + fimc_is_pipelines_destroy(is);
> +err_vb:
> + vb2_dma_contig_cleanup_ctx(is->alloc_ctx);
> +err_pm:
> + pm_runtime_put(dev);
> +err_clk:
> + fimc_is_put_clocks(is);
> +
> + return ret;
> +}
> +
> +int fimc_is_clk_enable(struct fimc_is *is)
> +{
> + int ret;
> +
> + ret = clk_enable(is->clock[IS_CLK_ISP]);
> + if (ret)
> + return ret;
> + ret = clk_enable(is->clock[IS_CLK_MCU_ISP]);
Shouldn't you disable the first enabled clock when this call fails ?
> + return ret;
> +}
[...]
> +static void *fimc_is_get_drvdata(struct platform_device *pdev)
> +{
> + struct fimc_is_drvdata *driver_data = NULL;
> +
> + if (pdev->dev.of_node) {
pdev->dev.of_node is being tested against NULL before call to this
function, you could make this code slightly simpler with that assumption.
> + const struct of_device_id *match;
> + match = of_match_node(exynos5_fimc_is_match,
> + pdev->dev.of_node);
> + if (match)
> + driver_data = (struct fimc_is_drvdata *)match->data;
> + }
> + return driver_data;
> +}
--
Thanks,
Sylwester
next prev parent reply other threads:[~2013-09-16 21:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-12 12:07 [PATCH v8 00/12] Exynos5 IS driver Arun Kumar K
2013-09-12 12:07 ` [PATCH v8 01/12] [media] exynos5-fimc-is: Add Exynos5 FIMC-IS device tree bindings documentation Arun Kumar K
2013-09-12 12:07 ` [PATCH v8 02/12] [media] exynos5-fimc-is: Add driver core files Arun Kumar K
2013-09-16 21:59 ` Sylwester Nawrocki [this message]
2013-09-12 12:07 ` [PATCH v8 03/12] [media] exynos5-fimc-is: Add common driver header files Arun Kumar K
2013-09-12 12:07 ` [PATCH v8 04/12] [media] exynos5-fimc-is: Add register definition and context header Arun Kumar K
2013-09-12 12:07 ` [PATCH v8 05/12] [media] exynos5-fimc-is: Add isp subdev Arun Kumar K
2013-09-12 12:07 ` [PATCH v8 06/12] [media] exynos5-fimc-is: Add scaler subdev Arun Kumar K
2013-09-12 12:07 ` [PATCH v8 07/12] [media] exynos5-fimc-is: Add sensor interface Arun Kumar K
2013-09-12 12:07 ` [PATCH v8 08/12] [media] exynos5-fimc-is: Add the hardware pipeline control Arun Kumar K
2013-09-12 12:07 ` [PATCH v8 09/12] [media] exynos5-fimc-is: Add the hardware interface module Arun Kumar K
2013-09-12 12:07 ` [PATCH v8 10/12] [media] exynos5-is: Add Kconfig and Makefile Arun Kumar K
2013-09-12 12:07 ` [PATCH v8 11/12] V4L: s5k6a3: Change sensor min/max resolutions Arun Kumar K
2013-09-12 12:07 ` [PATCH v8 12/12] V4L: Add driver for s5k4e5 image sensor Arun Kumar K
2013-09-13 12:55 ` Philipp Zabel
2013-09-13 16:14 ` Stephen Warren
[not found] ` <1379076935.4396.13.camel-/rZezPiN1rtR6QfukMTsflXZhhPuCNm+@public.gmane.org>
2013-09-16 5:59 ` Arun Kumar K
2013-09-16 5:59 ` Arun Kumar K
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=52377F3C.5070508@gmail.com \
--to=sylvester.nawrocki@gmail.com \
--cc=Pawel.Moll@arm.com \
--cc=a.hajda@samsung.com \
--cc=arun.kk@samsung.com \
--cc=arunkk.samsung@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=hverkuil@xs4all.nl \
--cc=kilyeon.im@samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=s.nawrocki@samsung.com \
--cc=sachin.kamat@linaro.org \
--cc=shaik.ameer@samsung.com \
--cc=swarren@wwwdotorg.org \
/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: link
Be 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.