[PATCH V2 00/63] clocksource/drivers/clksrc-of: Improve error handling

From: Daniel Lezcano
Date: Thu Jun 16 2016 - 17:28:06 EST


First of all, I apologize for the size of this series. The changes are always
going on the same direction and apply for the same init function in the
different drivers.

The macro CLOCKSOURCE_OF_DECLARE is widely used in the timer drivers.

Basically, this macro is defined to insert in a table a tuple name,function.
This function is an init function called when the name matches the DT node and
its signature is:

typedef void (*of_init_fn_1)(struct device_node *);

It does not return an error code.

That results in the clocksource-probe not being able to figure out if the driver
was correctly initialized or not, the different drivers to act as they were the
only ones on the system (panic, instead of failing gracefully), and duplicated
code for error reporting.

This series initiates the logic change and centralize the error handling in the
clocksource probe code.

In order to do the changes little by little, a new macro was introduced:

CLOCKSOURCE_OF_DECLARE_RET()

It expects an init function signature:

typedef int (*of_init_ret_fn_1)(struct device_node *);

When all drivers have their init functions signature changed to return a value,
CLOCKSOURCE_OF_DECLARE_RET changes its name back to CLOCKSOURCE_OF_DECLARE, so
the entire patchset is git-bisect safe.

Changelog:

V2:
- Added Reviewed-by tags
- Added all the clocksource drivers changes, so the series
contains the entire conversion of the init function returning
an error code
- Some fixes reported by the automated compilation bots
V1:
- initial post

Daniel Lezcano (63):
of: Add a new macro to declare_of for one parameter function returning
a value
clocksource/drivers/clksrc-probe: Introduce init functions with return
code
clocksource/drivers/rockchip_timer: Convert init function to return
error
clocksource/drivers/mkt_timer: Convert init function to return error
clocksource/drivers/exynos_mct: Convert init function to return error
clocksource/drivers/asm9260: Convert init function to return error
clocksource/drivers/cadence_ttc: Convert init function to return error
clocksource/drivers/st_lpc: Convert init function to return error
clocksource/drivers/dw_apb_timer: Convert init function to return
error
clocksource/drivers/clps711x: Convert init function to return error
clocksource/drivers/digitcolor: Convert init function to return error
clocksource/drivers/armv7m_systick: Convert init function to return
error
clocksource/drivers/bcm2835_timer: Convert init function to return
error
clocksource/drivers/bcm_kona: Convert init function to return error
clocksource/drivers/clksrc-dbx500: Convert init function to return
error
clocksource/drivers/fsl_ftm_timer: Convert init function to return
error
clocksource/drivers/arm_arch_timer: Convert init function to return
error
clocksource/drivers/arm_global_timer: Convert init function to return
error
clocksource/drivers/h8300_timer16: Convert init function to return
error
clocksource/drivers/h8300_tpu: Convert init function to return error
clocksource/drivers/h8300_tpu: Convert init function to return error
clocksource/drivers/mips-gic-timer: Convert init function to return
error
clocksource/drivers/moxart_timer: Convert init function to return
error
clocksource/drivers/mps2-timer: Convert init function to return error
clocksource/drivers/mxs_timer: Convert init function to return error
clocksource/drivers/nomadik-mtu: Convert init function to return error
clocksource/drivers/pxa_timer: Convert init function to return error
clocksource/drivers/qcom-timer: Convert init function to return error
clocksource/drivers/samsung_pwm_timer: Convert init function to return
error
clocksource/drivers/sun4i_time: Convert init function to return error
clocksource/drivers/tango_xtal: Convert init function to return error
clocksource/drivers/tegra20_timer: Convert init function to return
error
clocksource/drivers/time-armada-370-xp: Convert init function to
return error
clocksource/drivers/time-efm32: Convert init function to return error
clocksource/drivers/time-lpc32xx: Convert init function to return
error
clocksource/drivers/time-orion: Convert init function to return error
clocksource/drivers/time-pistachio: Convert init function to return
error
clocksource/drivers/time-pistachio: Convert init function to return
error
clocksource/drivers/timer-atlas7: Convert init function to return
error
clocksource/drivers/timer-atmel-pit: Convert init function to return
error
clocksource/drivers/timer-atmel-st: Convert init function to return
error
clocksource/drivers/prima2: Convert init function to return error
clocksource/drivers/timer-imx-gpt: Convert init function to return
error
clocksource/drivers/timer-integrator-ap: Convert init function to
return error
clocksource/drivers/timer-keystone: Convert init function to return
error
clocksource/drivers/timer-sp804: Convert init function to return error
clocksource/drivers/timer-stm32: Convert init function to return error
clocksource/drivers/timer-sun5i: Convert init function to return error
clocksource/drivers/timer-ti-32k: Convert init function to return
error
clocksource/drivers/timer-u300: Convert init function to return error
clocksource/drivers/versatile: Convert init function to return error
clocksource/drivers/vf_pit_timer: Convert init function to return
error
clocksource/drivers/vt8500_timer: Convert init function to return
error
clocksource/drivers/zevio-timer: Convert init function to return error
clocksource/drivers/timer-sp804: Convert init function to return error
clocksource/drivers/microblaze: Convert init function to return error
clocksource/drivers/ralink: Convert init function to return error
clocksource/drivers/nios2: Convert init function to return error
clocksource/drivers/smp_twd: Convert init function to return error
clocksource/drivers/nps: Convert init function to return error
clocksource/drivers/arc: Convert init function to return error
clocksource/drivers/oxnas-rps: Convert init function to return error
clocksources: Switch back to the clksrc table

arch/arc/kernel/time.c | 63 ++++++++++++--------
arch/arm/kernel/smp_twd.c | 3 +-
arch/microblaze/kernel/timer.c | 49 ++++++++++++----
arch/mips/ralink/cevt-rt3352.c | 17 ++++--
arch/nios2/kernel/time.c | 67 ++++++++++++++-------
drivers/clocksource/arm_arch_timer.c | 46 +++++++++------
drivers/clocksource/arm_global_timer.c | 26 ++++++---
drivers/clocksource/armv7m_systick.c | 16 ++++--
drivers/clocksource/asm9260_timer.c | 22 ++++---
drivers/clocksource/bcm2835_timer.c | 38 ++++++++----
drivers/clocksource/bcm_kona_timer.c | 8 ++-
drivers/clocksource/cadence_ttc_timer.c | 74 +++++++++++++++---------
drivers/clocksource/clksrc-dbx500-prcmu.c | 4 +-
drivers/clocksource/clksrc-probe.c | 14 ++++-
drivers/clocksource/clksrc_st_lpc.c | 20 ++++---
drivers/clocksource/clps711x-timer.c | 10 ++--
drivers/clocksource/dw_apb_timer_of.c | 4 +-
drivers/clocksource/exynos_mct.c | 32 +++++++----
drivers/clocksource/fsl_ftm_timer.c | 20 ++++---
drivers/clocksource/h8300_timer16.c | 12 ++--
drivers/clocksource/h8300_timer8.c | 11 ++--
drivers/clocksource/h8300_tpu.c | 10 ++--
drivers/clocksource/meson6_timer.c | 19 ++++--
drivers/clocksource/mips-gic-timer.c | 24 +++++---
drivers/clocksource/moxart_timer.c | 39 ++++++++-----
drivers/clocksource/mps2-timer.c | 8 ++-
drivers/clocksource/mtk_timer.c | 8 ++-
drivers/clocksource/mxs_timer.c | 24 +++++---
drivers/clocksource/nomadik-mtu.c | 43 +++++++++-----
drivers/clocksource/pxa_timer.c | 44 ++++++++++----
drivers/clocksource/qcom-timer.c | 23 ++++----
drivers/clocksource/rockchip_timer.c | 18 +++---
drivers/clocksource/samsung_pwm_timer.c | 54 +++++++++--------
drivers/clocksource/sun4i_timer.c | 43 ++++++++++----
drivers/clocksource/tango_xtal.c | 10 ++--
drivers/clocksource/tegra20_timer.c | 24 ++++----
drivers/clocksource/time-armada-370-xp.c | 96 +++++++++++++++++++++++--------
drivers/clocksource/time-efm32.c | 16 ++++--
drivers/clocksource/time-lpc32xx.c | 10 ++--
drivers/clocksource/time-orion.c | 50 +++++++++++-----
drivers/clocksource/time-pistachio.c | 18 +++---
drivers/clocksource/timer-atlas7.c | 30 ++++++----
drivers/clocksource/timer-atmel-pit.c | 41 ++++++++-----
drivers/clocksource/timer-atmel-st.c | 42 +++++++++-----
drivers/clocksource/timer-digicolor.c | 14 +++--
drivers/clocksource/timer-imx-gpt.c | 51 ++++++++++------
drivers/clocksource/timer-integrator-ap.c | 57 +++++++++++-------
drivers/clocksource/timer-keystone.c | 13 +++--
drivers/clocksource/timer-nps.c | 14 +++--
drivers/clocksource/timer-oxnas-rps.c | 29 ++++++----
drivers/clocksource/timer-prima2.c | 41 +++++++++----
drivers/clocksource/timer-sp804.c | 87 ++++++++++++++++++----------
drivers/clocksource/timer-stm32.c | 8 ++-
drivers/clocksource/timer-sun5i.c | 33 +++++++----
drivers/clocksource/timer-ti-32k.c | 8 ++-
drivers/clocksource/timer-u300.c | 36 ++++++++----
drivers/clocksource/versatile.c | 6 +-
drivers/clocksource/vf_pit_timer.c | 25 +++++---
drivers/clocksource/vt8500_timer.c | 24 +++++---
drivers/clocksource/zevio-timer.c | 4 +-
include/clocksource/timer-sp804.h | 8 +--
include/linux/clocksource.h | 2 +-
include/linux/of.h | 3 +
63 files changed, 1133 insertions(+), 580 deletions(-)

--
1.9.1