Skip to content
/ linux Public

Commit ae56e2c

Browse files
geertuSasha Levin
authored andcommitted
clk: Move clk_{save,restore}_context() to COMMON_CLK section
[ Upstream commit f47c1b7 ] The clk_save_context() and clk_restore_context() helpers are only implemented by the Common Clock Framework. They are not available when using legacy clock frameworks. Dummy implementations are provided, but only if no clock support is available at all. Hence when CONFIG_HAVE_CLK=y, but CONFIG_COMMON_CLK is not enabled: m68k-linux-gnu-ld: drivers/net/phy/air_en8811h.o: in function `en8811h_resume': air_en8811h.c:(.text+0x83e): undefined reference to `clk_restore_context' m68k-linux-gnu-ld: drivers/net/phy/air_en8811h.o: in function `en8811h_suspend': air_en8811h.c:(.text+0x856): undefined reference to `clk_save_context' Fix this by moving forward declarations and dummy implementions from the HAVE_CLK to the COMMON_CLK section. Fixes: 8b95d1c ("clk: Add functions to save/restore clock context en-masse") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202511301553.eaEz1nEW-lkp@intel.com/ Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d81b51c commit ae56e2c

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

include/linux/clk.h

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,23 @@ int clk_rate_exclusive_get(struct clk *clk);
216216
*/
217217
void clk_rate_exclusive_put(struct clk *clk);
218218

219+
/**
220+
* clk_save_context - save clock context for poweroff
221+
*
222+
* Saves the context of the clock register for powerstates in which the
223+
* contents of the registers will be lost. Occurs deep within the suspend
224+
* code so locking is not necessary.
225+
*/
226+
int clk_save_context(void);
227+
228+
/**
229+
* clk_restore_context - restore clock context after poweroff
230+
*
231+
* This occurs with all clocks enabled. Occurs deep within the resume code
232+
* so locking is not necessary.
233+
*/
234+
void clk_restore_context(void);
235+
219236
#else
220237

221238
static inline int clk_notifier_register(struct clk *clk,
@@ -276,6 +293,13 @@ static inline int clk_rate_exclusive_get(struct clk *clk)
276293

277294
static inline void clk_rate_exclusive_put(struct clk *clk) {}
278295

296+
static inline int clk_save_context(void)
297+
{
298+
return 0;
299+
}
300+
301+
static inline void clk_restore_context(void) {}
302+
279303
#endif
280304

281305
#ifdef CONFIG_HAVE_CLK_PREPARE
@@ -872,23 +896,6 @@ struct clk *clk_get_parent(struct clk *clk);
872896
*/
873897
struct clk *clk_get_sys(const char *dev_id, const char *con_id);
874898

875-
/**
876-
* clk_save_context - save clock context for poweroff
877-
*
878-
* Saves the context of the clock register for powerstates in which the
879-
* contents of the registers will be lost. Occurs deep within the suspend
880-
* code so locking is not necessary.
881-
*/
882-
int clk_save_context(void);
883-
884-
/**
885-
* clk_restore_context - restore clock context after poweroff
886-
*
887-
* This occurs with all clocks enabled. Occurs deep within the resume code
888-
* so locking is not necessary.
889-
*/
890-
void clk_restore_context(void);
891-
892899
#else /* !CONFIG_HAVE_CLK */
893900

894901
static inline struct clk *clk_get(struct device *dev, const char *id)
@@ -1055,13 +1062,6 @@ static inline struct clk *clk_get_sys(const char *dev_id, const char *con_id)
10551062
return NULL;
10561063
}
10571064

1058-
static inline int clk_save_context(void)
1059-
{
1060-
return 0;
1061-
}
1062-
1063-
static inline void clk_restore_context(void) {}
1064-
10651065
#endif
10661066

10671067
/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */

0 commit comments

Comments
 (0)