- 08 12月, 2021 1 次提交
-
-
由 Mike Tipton 提交于
Before commit fc0c209c ("clk: Allow parents to be specified without string names") child clks couldn't find their parent until the parent clk was added to a list in __clk_core_init(). After that commit, child clks can reference their parent clks directly via a clk_hw pointer, or they can lookup that clk_hw pointer via DT if the parent clk is registered with an OF clk provider. The common clk framework treats hw->core being non-NULL as "the clk is registered" per the logic within clk_core_fill_parent_index(): parent = entry->hw->core; /* * We have a direct reference but it isn't registered yet? * Orphan it and let clk_reparent() update the orphan status * when the parent is registered. */ if (!parent) Therefore we need to be extra careful to not set hw->core until the clk is fully registered with the clk framework. Otherwise we can get into a situation where a child finds a parent clk and we move the child clk off the orphan list when the parent isn't actually registered, wrecking our enable accounting and breaking critical clks. Consider the following scenario: CPU0 CPU1 ---- ---- struct clk_hw clkBad; struct clk_hw clkA; clkA.init.parent_hws = { &clkBad }; clk_hw_register(&clkA) clk_hw_register(&clkBad) ... __clk_register() hw->core = core ... __clk_register() __clk_core_init() clk_prepare_lock() __clk_init_parent() clk_core_get_parent_by_index() clk_core_fill_parent_index() if (entry->hw) { parent = entry->hw->core; At this point, 'parent' points to clkBad even though clkBad hasn't been fully registered yet. Ouch! A similar problem can happen if a clk controller registers orphan clks that are referenced in the DT node of another clk controller. Let's fix all this by only setting the hw->core pointer underneath the clk prepare lock in __clk_core_init(). This way we know that clk_core_fill_parent_index() can't see hw->core be non-NULL until the clk is fully registered. Fixes: fc0c209c ("clk: Allow parents to be specified without string names") Signed-off-by: NMike Tipton <quic_mdtipton@quicinc.com> Link: https://lore.kernel.org/r/20211109043438.4639-1-quic_mdtipton@quicinc.com [sboyd@kernel.org: Reword commit text, update comment] Signed-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 27 10月, 2021 1 次提交
-
-
由 Claudiu Beznea 提交于
In case clock flags contains CLK_GET_RATE_NOCACHE the clk_rate_get() will return the cached rate. Thus, use clk_core_get_rate_recalc() which takes proper action when clock flags contains CLK_GET_RATE_NOCACHE. Signed-off-by: NClaudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/20211011112719.3951784-16-claudiu.beznea@microchip.comAcked-by: NNicolas Ferre <nicolas.ferre@microchip.com> [sboyd@kernel.org: Grab prepare lock around operation] Signed-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 11 5月, 2021 1 次提交
-
-
由 Tudor Ambarus 提交于
commit 6579c8d9 ("clk: Mark fwnodes when their clock provider is added") revealed that clk/bcm/clk-raspberrypi.c driver calls devm_of_clk_add_hw_provider(), with a NULL dev->of_node, which resulted in a NULL pointer dereference in of_clk_add_hw_provider() when calling fwnode_dev_initialized(). Returning 0 is reducing the if conditions in driver code and is being consistent with the CONFIG_OF=n inline stub that returns 0 when CONFIG_OF is disabled. The downside is that drivers will maybe register clkdev lookups when they don't need to and waste some memory. Fixes: 6579c8d9 ("clk: Mark fwnodes when their clock provider is added") Fixes: 3c9ea428 ("clk: Mark fwnodes when their clock provider is added/removed") Reported-by: NMarek Szyprowski <m.szyprowski@samsung.com> Tested-by: NGuenter Roeck <linux@roeck-us.net> Tested-by: NNathan Chancellor <nathan@kernel.org> Reviewed-by: NStephen Boyd <sboyd@kernel.org> Reviewed-by: NSaravana Kannan <saravanak@google.com> Reviewed-by: NNicolas Saenz Julienne <nsaenz@kernel.org> Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Link: https://lore.kernel.org/r/20210426065618.588144-1-tudor.ambarus@microchip.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 03 4月, 2021 2 次提交
-
-
由 Lukasz Bartosik 提交于
Fix invalid usage of a list_for_each_entry cursor in clk_notifier_unregister(). When list is empty or if the list is completely traversed (without breaking from the loop on one of the entries) then the list cursor does not point to a valid entry and therefore should not be used. The patch fixes a logical bug that hasn't been seen in pratice however it is analogus to the bug fixed in clk_notifier_register(). The issue was dicovered when running 5.12-rc1 kernel on x86_64 with KASAN enabled: BUG: KASAN: global-out-of-bounds in clk_notifier_register+0xab/0x230 Read of size 8 at addr ffffffffa0d10588 by task swapper/0/1 CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.12.0-rc1 #1 Hardware name: Google Caroline/Caroline, BIOS Google_Caroline.7820.430.0 07/20/2018 Call Trace: dump_stack+0xee/0x15c print_address_description+0x1e/0x2dc kasan_report+0x188/0x1ce ? clk_notifier_register+0xab/0x230 ? clk_prepare_lock+0x15/0x7b ? clk_notifier_register+0xab/0x230 clk_notifier_register+0xab/0x230 dw8250_probe+0xc01/0x10d4 ... Memory state around the buggy address: ffffffffa0d10480: 00 00 00 00 00 03 f9 f9 f9 f9 f9 f9 00 00 00 00 ffffffffa0d10500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 f9 >ffffffffa0d10580: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffffffffa0d10600: 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9 00 00 00 00 ffffffffa0d10680: 00 00 00 00 00 00 00 00 f9 f9 f9 f9 00 00 00 00 ================================================================== Fixes: b2476490 ("clk: introduce the common clock framework") Reported-by: NLukasz Majczak <lma@semihalf.com> Signed-off-by: NLukasz Bartosik <lb@semihalf.com> Link: https://lore.kernel.org/r/20210401225149.18826-2-lb@semihalf.comSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
由 Lukasz Bartosik 提交于
Fix invalid usage of a list_for_each_entry cursor in clk_notifier_register(). When list is empty or if the list is completely traversed (without breaking from the loop on one of the entries) then the list cursor does not point to a valid entry and therefore should not be used. The issue was dicovered when running 5.12-rc1 kernel on x86_64 with KASAN enabled: BUG: KASAN: global-out-of-bounds in clk_notifier_register+0xab/0x230 Read of size 8 at addr ffffffffa0d10588 by task swapper/0/1 CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.12.0-rc1 #1 Hardware name: Google Caroline/Caroline, BIOS Google_Caroline.7820.430.0 07/20/2018 Call Trace: dump_stack+0xee/0x15c print_address_description+0x1e/0x2dc kasan_report+0x188/0x1ce ? clk_notifier_register+0xab/0x230 ? clk_prepare_lock+0x15/0x7b ? clk_notifier_register+0xab/0x230 clk_notifier_register+0xab/0x230 dw8250_probe+0xc01/0x10d4 ... Memory state around the buggy address: ffffffffa0d10480: 00 00 00 00 00 03 f9 f9 f9 f9 f9 f9 00 00 00 00 ffffffffa0d10500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 f9 >ffffffffa0d10580: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffffffffa0d10600: 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9 00 00 00 00 ffffffffa0d10680: 00 00 00 00 00 00 00 00 f9 f9 f9 f9 00 00 00 00 ================================================================== Fixes: b2476490 ("clk: introduce the common clock framework") Reported-by: NLukasz Majczak <lma@semihalf.com> Signed-off-by: NLukasz Bartosik <lb@semihalf.com> Link: https://lore.kernel.org/r/20210401225149.18826-1-lb@semihalf.comSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 27 3月, 2021 1 次提交
-
-
由 Geert Uytterhoeven 提交于
The comments for clk_core_determine_round_nolock() contain a double "if": one at the end of a line, followed by another one at the beginning of the next line. Drop the former. Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20210326120833.1578153-1-geert+renesas@glider.beSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 23 3月, 2021 1 次提交
-
-
由 Tudor Ambarus 提交于
This is a follow-up for: commit 3c9ea428 ("clk: Mark fwnodes when their clock provider is added/removed") The above commit updated the deprecated of_clk_add_provider(), but missed to update the preferred of_clk_add_hw_provider(). Update it now. Signed-off-by: NTudor Ambarus <tudor.ambarus@microchip.com> Acked-by: NStephen Boyd <sboyd@kernel.org> Reviewed-by: NSaravana Kannan <saravanak@google.com> Link: https://lore.kernel.org/r/20210210114435.122242-2-tudor.ambarus@microchip.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 14 3月, 2021 1 次提交
-
-
由 Rasmus Villemoes 提交于
Use clk_core_enable_lock() and clk_core_disable_lock() in a few places rather than open-coding them. Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk> Link: https://lore.kernel.org/r/20210305003334.575831-1-linux@rasmusvillemoes.dkSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 09 2月, 2021 1 次提交
-
-
由 Saravana Kannan 提交于
This allows fw_devlink to recognize clock provider drivers that don't use the device-driver model to initialize the device. fw_devlink will use this information to make sure consumers of such clock providers aren't indefinitely blocked from probing, waiting for the power domain device to appear and bind to a driver. Tested-by: NMarek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: NSaravana Kannan <saravanak@google.com> Link: https://lore.kernel.org/r/20210205222644.2357303-9-saravanak@google.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 28 1月, 2021 1 次提交
-
-
由 Nicolas Pitre 提交于
The clock API splits its interface into sleepable ant atomic contexts: - clk_prepare/clk_unprepare for stuff that might sleep - clk_enable_clk_disable for anything that may be done in atomic context The code handling runtime PM for clocks only calls clk_disable() on suspend requests, and clk_enable on resume requests. This means that runtime PM with clock providers that only have the prepare/unprepare methods implemented is basically useless. Many clock implementations can't accommodate atomic contexts. This is often the case when communication with the clock happens through another subsystem like I2C or SCMI. Let's make the clock PM code useful with such clocks by safely invoking clk_prepare/clk_unprepare upon resume/suspend requests. Of course, when such clocks are registered with the PM layer then pm_runtime_irq_safe() can't be used, and neither pm_runtime_suspend() nor pm_runtime_resume() may be invoked in atomic context. For clocks that do implement the enable and disable methods then everything just works as before. A note on sparse: According to https://lwn.net/Articles/109066/ there are things that sparse can't cope with. In particular, pm_clk_op_lock() and pm_clk_op_unlock() may or may not lock/unlock psd->lock depending on some runtime condition. To work around that we tell it the lock is always untaken for the purpose of static analisys. Thanks to Naresh Kamboju for reporting issues with the initial patch. Signed-off-by: NNicolas Pitre <npitre@baylibre.com> Tested-by: NNaresh Kamboju <naresh.kamboju@linaro.org> Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
-
- 17 12月, 2020 2 次提交
-
-
由 Maxime Ripard 提交于
The clk_set_rate "range" functions don't have any tracepoints even though it might be useful. Add some. Signed-off-by: NMaxime Ripard <maxime@cerno.tech> Link: https://lore.kernel.org/r/20201207105050.2096917-1-maxime@cerno.tech [sboyd@kernel.org: Reword commit text] Signed-off-by: NStephen Boyd <sboyd@kernel.org>
-
由 Dmitry Osipenko 提交于
Add "hardware enable" column to the clk summary in order to show actual hardware enable-state of all clocks. The possible states are "Y/N/?", where question mark means that state is unknown, i.e. clock isn't a mux and clk-driver doesn't support is_enabled() callback for this clock. In conjunction with clk_ignore_unused, this tells us what unused clocks are left enabled after bootloader. This is also a useful aid for debugging interactions with firmware which changes clock states without notifying kernel. Signed-off-by: NDmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20201115203432.13934-1-digetx@gmail.comSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 15 11月, 2020 4 次提交
-
-
由 Jerome Brunet 提交于
Add a memory managed variant of clk_notifier_register() to make life easier on clock consumers using notifiers Signed-off-by: NJerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20201021163847.595189-2-jbrunet@baylibre.comSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
由 Jerome Brunet 提交于
clk_register() is deprecated. Using 'clk' member of struct clk_hw is discouraged. With this constraint, it is difficult for driver to register clocks using the clk_hw API and then use the clock with the consumer API This adds a simple helper, clk_hw_get_clk(), to get a struct clk from a struct clk_hw. Like other clk_get() variant, each call to this helper must be balanced with a call to clk_put(). To make life easier on the consumers, a memory managed version is provided as well. Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: NJerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20201021162147.563655-3-jbrunet@baylibre.comTested-by: NKevin Hilman <khilman@baylibre.com> [sboyd@kernel.org: Fix kernel-doc] Signed-off-by: NStephen Boyd <sboyd@kernel.org>
-
由 Jerome Brunet 提交于
In clk-devres.c, devm_clk_release() is used to call clk_put() memory managed clock. In clk.c the same name, in a different scope is used to call clk_unregister(). As it stands, it is not really a problem but it does not readability, especially if we need to call clk_put() on managed clock in clk.c Signed-off-by: NJerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20201021162147.563655-2-jbrunet@baylibre.comTested-by: NKevin Hilman <khilman@baylibre.com> Signed-off-by: NStephen Boyd <sboyd@kernel.org>
-
由 Lukas Bulwahn 提交于
make clang-analyzer on x86_64 defconfig caught my attention with: drivers/clk/clk.c:423:19: warning: Value stored to 'parent' during its initialization is never read [clang-analyzer-deadcode.DeadStores] struct clk_core *parent = ERR_PTR(-ENOENT); ^ Commit fc0c209c ("clk: Allow parents to be specified without string names") introduced clk_core_fill_parent_index() with this unneeded dead-store initialization. So, simply remove this unneeded dead-store initialization to make clang-analyzer happy. As compilers will detect this unneeded assignment and optimize this anyway, the resulting object code is identical before and after this change. No functional change. No change to object code. Signed-off-by: NLukas Bulwahn <lukas.bulwahn@gmail.com> Link: https://lore.kernel.org/r/20201106094820.30167-1-lukas.bulwahn@gmail.comReviewed-by: NNathan Chancellor <natechancellor@gmail.com> Signed-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 26 10月, 2020 1 次提交
-
-
由 Joe Perches 提交于
Use a more generic form for __section that requires quotes to avoid complications with clang and gcc differences. Remove the quote operator # from compiler_attributes.h __section macro. Convert all unquoted __section(foo) uses to quoted __section("foo"). Also convert __attribute__((section("foo"))) uses to __section("foo") even if the __attribute__ has multiple list entry forms. Conversion done using the script at: https://lore.kernel.org/lkml/75393e5ddc272dc7403de74d645e6c6e0f4e70eb.camel@perches.com/2-convert_section.plSigned-off-by: NJoe Perches <joe@perches.com> Reviewed-by: NNick Desaulniers <ndesaulniers@gooogle.com> Reviewed-by: NMiguel Ojeda <ojeda@kernel.org> Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
-
- 04 8月, 2020 1 次提交
-
-
由 Julia Lawall 提交于
The function __clk_get_flags has not been used since the April 2019 commit a348f053 ("ARM: omap2+: hwmod: drop CLK_IS_BASIC flag usage"). Other uses were removed in June 2015, eg by commit 98d8a60e ("clk: Convert __clk_get_flags() to clk_hw_get_flags()"), which shows how clk_hw_get_flags can easily be used instead. Signed-off-by: NJulia Lawall <Julia.Lawall@inria.fr> Link: https://lore.kernel.org/r/1596272022-14173-1-git-send-email-Julia.Lawall@inria.frSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 24 7月, 2020 2 次提交
-
-
由 Stephen Boyd 提交于
Two things aren't documented causing kernel-doc to fail when checking the core clk.c file. Fix them so that this file is clean. Signed-off-by: NStephen Boyd <sboyd@kernel.org> Link: https://lore.kernel.org/r/20200622090935.213833-1-sboyd@kernel.org
-
由 Mike Tipton 提交于
For test and debug purposes, it's simple enough to enable or disable clocks from shell. Add a new debugfs file 'clk_prepare_enable' that calls clk_prepare_enable() when writing "1" and clk_disable_unprepare() when writing "0". This can have security implications, so only support it when the code has been modified to #define CLOCK_ALLOW_WRITE_DEBUGFS. Signed-off-by: NMike Tipton <mdtipton@codeaurora.org> Link: https://lore.kernel.org/r/20200630003024.6282-1-mdtipton@codeaurora.org [sboyd@kernel.org: Reword commit text and remove comment update] Signed-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 22 6月, 2020 1 次提交
-
-
由 Sarang Mairal 提交于
Information about usage and prerequisites for this API. Signed-off-by: NSarang Mairal <sarangmairal@gmail.com> Link: https://lore.kernel.org/r/20200611021941.786-2-sarangmairal@gmail.comSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 26 5月, 2020 1 次提交
-
-
由 Rafael J. Wysocki 提交于
clk_pm_runtime_get() assumes that the PM-runtime usage counter will be dropped by pm_runtime_get_sync() on errors, which is not the case, so PM-runtime references to devices acquired by the former are leaked on errors returned by the latter. Fix this by modifying clk_pm_runtime_get() to drop the reference if pm_runtime_get_sync() returns an error. Fixes: 9a34b453 clk: Add support for runtime PM Cc: 4.15+ <stable@vger.kernel.org> # 4.15+ Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
-
- 06 5月, 2020 2 次提交
-
-
由 YueHaibing 提交于
There's no callers in-tree anymore. Signed-off-by: NYueHaibing <yuehaibing@huawei.com> Link: https://lkml.kernel.org/r/20200505083001.52564-1-yuehaibing@huawei.comSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
由 Marc Zyngier 提交于
On failing to prepare or enable a clock, remove the core structure from the list it has been inserted as it is about to be freed. This otherwise leads to random crashes when subsequent clocks get registered, during which parsing of the clock tree becomes adventurous. Observed with QEMU's RPi-3 emulation. Fixes: 12ead774 ("clk: Don't try to enable critical clocks if prepare failed") Signed-off-by: NMarc Zyngier <maz@kernel.org> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Stephen Boyd <sboyd@kernel.org> Cc: Michael Turquette <mturquette@baylibre.com> Link: https://lkml.kernel.org/r/20200505140953.409430-1-maz@kernel.orgSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 21 3月, 2020 1 次提交
-
-
由 Andy Shevchenko 提交于
Fix trivia typo in comment exlusive => exclusive. Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lkml.kernel.org/r/20200310135507.87959-1-andriy.shevchenko@linux.intel.comSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 29 2月, 2020 1 次提交
-
-
由 Maxime Ripard 提交于
Commit 27608786 ("clk: Bail out when calculating phase fails during clk registration") introduced a check on error values at the time the clock is registered to bail out when such an error occurs. However, it doesn't check whether the returned value is positive which will happen if the driver returns a non-zero phase. Since a phase is usually a non-zero positive number this ends up returning something that isn't 0 to the caller of __clk_core_init(), making most clks fail to register if they implement a phase clk op and return anything besides 0 for the phase. Fix this by returning the error if phase is less than zero or just return zero if the phase is a positive number. Fixes: 27608786 ("clk: Bail out when calculating phase fails during clk registration") Signed-off-by: NMaxime Ripard <maxime@cerno.tech> Link: https://lkml.kernel.org/r/20200225134248.919889-1-maxime@cerno.techReported-by: N"kernelci.org bot" <bot@kernelci.org> [sboyd@kernel.org: Reword commit text to provide clarity] Signed-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 13 2月, 2020 6 次提交
-
-
由 Geert Uytterhoeven 提交于
The second line of the of_clk_detect_critical() function signature is not indented according to coding style. Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be> Link: https://lkml.kernel.org/r/20191206133414.23925-1-geert+renesas@glider.beAcked-by: NLee Jones <lee.jones@linaro.org> Signed-off-by: NStephen Boyd <sboyd@kernel.org>
-
由 Stephen Boyd 提交于
Bail out of clk registration if we fail to get the phase for a clk that has a clk_ops::get_phase() callback. Print a warning too so that driver authors can easily figure out that some clk is unable to read back phase information at boot. Cc: Douglas Anderson <dianders@chromium.org> Cc: Heiko Stuebner <heiko@sntech.de> Suggested-by: NJerome Brunet <jbrunet@baylibre.com> Signed-off-by: NStephen Boyd <sboyd@kernel.org> Link: https://lkml.kernel.org/r/20200205232802.29184-5-sboyd@kernel.orgAcked-by: NJerome Brunet <jbrunet@baylibre.com>
-
由 Stephen Boyd 提交于
There's some confusion about when recalc is done for the rate and accuracy clk consumer APIs in relation to the prepare lock being taken. Oddly enough, we take the lock again in debugfs APIs so that we can call the internal "clk_core" APIs to get these fields with any necessary recalculations. Instead of having this confusion, let's introduce a recalc variant of these two consumer APIs as internal helpers and call them from the consumer APIs and the debugfs code so that we don't take the lock more than once. Cc: Douglas Anderson <dianders@chromium.org> Cc: Heiko Stuebner <heiko@sntech.de> Cc: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: NStephen Boyd <sboyd@kernel.org> Link: https://lkml.kernel.org/r/20200205232802.29184-4-sboyd@kernel.orgAcked-by: NJerome Brunet <jbrunet@baylibre.com>
-
由 Stephen Boyd 提交于
Some lines are getting long in this function. Let's move 'parent' up to the top of the function and use it in many places whenever there is a parent for a clk. This shortens some lines by avoiding core->parent-> indirections. Cc: Douglas Anderson <dianders@chromium.org> Cc: Heiko Stuebner <heiko@sntech.de> Cc: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: NStephen Boyd <sboyd@kernel.org> Link: https://lkml.kernel.org/r/20200205232802.29184-3-sboyd@kernel.orgAcked-by: NJerome Brunet <jbrunet@baylibre.com>
-
由 Stephen Boyd 提交于
We don't check for errors from clk_ops::get_phase() before storing away the result into the clk_core::phase member. This can lead to some fairly confusing debugfs information if these ops do return an error. Let's skip the store when this op fails to fix this. While we're here, move the locking outside of clk_core_get_phase() to simplify callers from the debugfs side. Cc: Douglas Anderson <dianders@chromium.org> Cc: Heiko Stuebner <heiko@sntech.de> Cc: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: NStephen Boyd <sboyd@kernel.org> Link: https://lkml.kernel.org/r/20200205232802.29184-2-sboyd@kernel.orgAcked-by: NJerome Brunet <jbrunet@baylibre.com>
-
由 Geert Uytterhoeven 提交于
of_clk_get_parent_count() and of_clk_get_parent_name() never modify the device nodes passed, so they can be const. Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be> Link: https://lkml.kernel.org/r/20200212094317.1150-1-geert+renesas@glider.beSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 04 2月, 2020 1 次提交
-
-
由 Masahiro Yamada 提交于
'PTR_ERR(p) == -E*' is a stronger condition than IS_ERR(p). Hence, IS_ERR(p) is unneeded. The semantic patch that generates this commit is as follows: // <smpl> @@ expression ptr; constant error_code; @@ -IS_ERR(ptr) && (PTR_ERR(ptr) == - error_code) +PTR_ERR(ptr) == - error_code // </smpl> Link: http://lkml.kernel.org/r/20200106045833.1725-1-masahiroy@kernel.orgSigned-off-by: NMasahiro Yamada <masahiroy@kernel.org> Cc: Julia Lawall <julia.lawall@lip6.fr> Acked-by: Stephen Boyd <sboyd@kernel.org> [drivers/clk/clk.c] Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> [GPIO] Acked-by: Wolfram Sang <wsa@the-dreams.de> [drivers/i2c] Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> [acpi/scan.c] Acked-by: NRob Herring <robh@kernel.org> Cc: Eric Biggers <ebiggers@kernel.org> Signed-off-by: NAndrew Morton <akpm@linux-foundation.org> Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
-
- 06 1月, 2020 1 次提交
-
-
由 Geert Uytterhoeven 提交于
For testing, it is useful to be able to specify a clock rate manually. As this is a dangerous feature, it is not enabled by default. Users need to modify the source directly and #define CLOCK_ALLOW_WRITE_DEBUGFS. This follows the spirit of commit 09c6ecd3 ("regmap: Add support for writing to regmap registers via debugfs"). Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be> Link: https://lkml.kernel.org/r/20190828132306.19012-1-geert+renesas@glider.beSuggested-by: NStephen Boyd <sboyd@kernel.org> Signed-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 05 1月, 2020 2 次提交
-
-
由 Stephen Boyd 提交于
If we don't warn here users of the CLK_IS_CRITICAL flag may not know that their clk isn't actually enabled because it silently fails to enable. Let's print a warning in that case so developers find these problems faster. Suggested-by: NJerome Brunet <jbrunet@baylibre.com> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: NStephen Boyd <sboyd@kernel.org> Link: https://lkml.kernel.org/r/20200102005503.71923-1-sboyd@kernel.orgReviewed-by: NJerome Brunet <jbrunet@baylibre.com> Reviewed-by: NGuenter Roeck <linux@roeck-us.net>
-
由 Stephen Boyd 提交于
Sometimes clk drivers are attached to devices which are children of a parent device that is connected to a node in DT. This happens when devices are MFD-ish and the parent device driver mostly registers child devices to match against drivers placed in their respective subsystem directories like drivers/clk, drivers/regulator, etc. When the clk driver calls clk_register() with a device pointer, that struct device pointer won't have a device_node associated with it because it was created purely in software as a way to partition logic to a subsystem. This causes problems for the way we find parent clks for the clks registered by these child devices because we look at the registering device's device_node pointer to lookup 'clocks' and 'clock-names' properties. Let's use the parent device's device_node pointer if the registering device doesn't have a device_node but the parent does. This simplifies clk registration code by avoiding the need to assign some device_node to the device registering the clk. Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Reported-by: NNiklas Cassel <niklas.cassel@linaro.org> Signed-off-by: NStephen Boyd <sboyd@kernel.org> Link: https://lkml.kernel.org/r/20191230190455.141339-1-sboyd@kernel.org [sboyd@kernel.org: Fixup kernel-doc notation] Reviewed-by: NNiklas Cassel <nks@flawful.org> Reviewed-by: NBjorn Andersson <bjorn.andersson@linaro.org> Tested-by: NBjorn Andersson <bjorn.andersson@linaro.org>
-
- 27 12月, 2019 1 次提交
-
-
由 Guenter Roeck 提交于
The following traceback is seen if a critical clock fails to prepare. bcm2835-clk 3f101000.cprman: plld: couldn't lock PLL ------------[ cut here ]------------ Enabling unprepared plld_per WARNING: CPU: 1 PID: 1 at drivers/clk/clk.c:1014 clk_core_enable+0xcc/0x2c0 ... Call trace: clk_core_enable+0xcc/0x2c0 __clk_register+0x5c4/0x788 devm_clk_hw_register+0x4c/0xb0 bcm2835_register_pll_divider+0xc0/0x150 bcm2835_clk_probe+0x134/0x1e8 platform_drv_probe+0x50/0xa0 really_probe+0xd4/0x308 driver_probe_device+0x54/0xe8 device_driver_attach+0x6c/0x78 __driver_attach+0x54/0xd8 ... Check return values from clk_core_prepare() and clk_core_enable() and bail out if any of those functions returns an error. Cc: Jerome Brunet <jbrunet@baylibre.com> Fixes: 99652a46 ("clk: migrate the count of orphaned clocks at init") Signed-off-by: NGuenter Roeck <linux@roeck-us.net> Link: https://lkml.kernel.org/r/20191225163429.29694-1-linux@roeck-us.netSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
- 24 12月, 2019 3 次提交
-
-
由 Jerome Brunet 提交于
Add a terminate callback to the clk_ops to release the resources claimed in .init() Signed-off-by: NJerome Brunet <jbrunet@baylibre.com> Link: https://lkml.kernel.org/r/20190924123954.31561-4-jbrunet@baylibre.comSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-
由 Jerome Brunet 提交于
If the init callback is allowed to request resources, it needs a return value to report the outcome of such a request. Signed-off-by: NJerome Brunet <jbrunet@baylibre.com> Link: https://lkml.kernel.org/r/20190924123954.31561-3-jbrunet@baylibre.comReviewed-by: NAndrew Lunn <andrew@lunn.ch> Acked-by: NHeiko Stuebner <heiko@sntech.de> Signed-off-by: NStephen Boyd <sboyd@kernel.org>
-
由 Jerome Brunet 提交于
__clk_init_parent() will call the .get_parent() callback of the clock so .init() must run before. Fixes: 541debae ("clk: call the clock init() callback before any other ops callback") Signed-off-by: NJerome Brunet <jbrunet@baylibre.com> Link: https://lkml.kernel.org/r/20190924123954.31561-2-jbrunet@baylibre.comSigned-off-by: NStephen Boyd <sboyd@kernel.org>
-