From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sylwester Nawrocki Subject: Re: [PATCH V3 1/6] clk: exynos-audss: convert to platform device Date: Wed, 25 Sep 2013 00:31:25 +0200 Message-ID: <524212BD.9070204@gmail.com> References: <1379982078-23381-1-git-send-email-abrestic@chromium.org> <1380046016-5811-1-git-send-email-abrestic@chromium.org> <524200FB.8010004@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Andrew Bresticker Cc: Sylwester Nawrocki , linux-samsung-soc , Tomasz Figa , Rob Herring , Pawel Moll , Mark Rutland , Stephen Warren , Ian Campbell , Rob Landley , Kukjin Kim , Russell King , Mike Turquette , Grant Likely , Sachin Kamat , Jiri Kosina , Rahul Sharma , Leela Krishna Amudala , Stephen Boyd , Tushar Behera , Doug Anderson , Padmavathi Venna , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-doc List-Id: devicetree@vger.kernel.org On 09/25/2013 12:12 AM, Andrew Bresticker wrote: >>> +static int exynos_audss_clk_remove(struct platform_device *pdev) >>> +{ >>> + int i; >>> + >>> + of_clk_del_provider(pdev->dev.of_node); >>> + >>> + for (i = 0; i< EXYNOS_AUDSS_MAX_CLKS; i++) { >>> + if (!IS_ERR_OR_NULL(clk_table[i])) >>> + clk_unregister(clk_table[i]); >>> + } >> >> >> Since we only get here if all the clocks are registered properly and we >> always register EXYNOS_AUDSS_MAX_CLKS clocks, couldn't this simply be: >> >> >> for (i = 0; i< EXYNOS_AUDSS_MAX_CLKS; i++) >> clk_unregister(clk_table[i]); >> >> ? > > Once support is added for Exynos5420, we won't always register > EXYNOS_AUDSS_MAX_CLKS clocks, so we'd still need the NULL check. Then couldn't you use clk_data.clk_num in this loop instead of EXYNOS_AUDSS_MAX_CLKS ? What I'm trying to avoid is assuming NULL as an invalid clock. It's not correct, clock pointers should be only tested with ERR_PTR(). Alternatively you could set the whole clk_table array to, e.g. ERR_PTR(-EINVAL) beforehand, but that shouldn't be necessary when clk_data.clk_num is used, unless there are holes in the array. -- Regards, Sylwester -- 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