Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9eed56e8 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

clockevents: Clean up clockchips.h



Do various cleanups on the clockchips.h file:

 - indent preprocessor blocks to make it more clear which block we are in,
   this also makes merge resolution easier

 - comment larger preprocessor blocks consistently, using the:

     #if FOO
     ...
     #else /* !FOO: */
     ...
     #endif /* !FOO */

   notation.

 - unbreak lines

 - etc.

No change in functionality.

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 3ae7a939
Loading
Loading
Loading
Loading
+41 −46
Original line number Original line Diff line number Diff line
@@ -32,7 +32,7 @@ struct module;


/* Clock event mode commands for legacy ->set_mode(): OBSOLETE */
/* Clock event mode commands for legacy ->set_mode(): OBSOLETE */
enum clock_event_mode {
enum clock_event_mode {
	CLOCK_EVT_MODE_UNUSED = 0,
	CLOCK_EVT_MODE_UNUSED,
	CLOCK_EVT_MODE_SHUTDOWN,
	CLOCK_EVT_MODE_SHUTDOWN,
	CLOCK_EVT_MODE_PERIODIC,
	CLOCK_EVT_MODE_PERIODIC,
	CLOCK_EVT_MODE_ONESHOT,
	CLOCK_EVT_MODE_ONESHOT,
@@ -51,7 +51,7 @@ enum clock_event_mode {
 *		from DETACHED or SHUTDOWN.
 *		from DETACHED or SHUTDOWN.
 */
 */
enum clock_event_state {
enum clock_event_state {
	CLOCK_EVT_STATE_DETACHED = 0,
	CLOCK_EVT_STATE_DETACHED,
	CLOCK_EVT_STATE_SHUTDOWN,
	CLOCK_EVT_STATE_SHUTDOWN,
	CLOCK_EVT_STATE_PERIODIC,
	CLOCK_EVT_STATE_PERIODIC,
	CLOCK_EVT_STATE_ONESHOT,
	CLOCK_EVT_STATE_ONESHOT,
@@ -63,8 +63,9 @@ enum clock_event_state {
# define CLOCK_EVT_FEAT_PERIODIC	0x000001
# define CLOCK_EVT_FEAT_PERIODIC	0x000001
# define CLOCK_EVT_FEAT_ONESHOT		0x000002
# define CLOCK_EVT_FEAT_ONESHOT		0x000002
# define CLOCK_EVT_FEAT_KTIME		0x000004
# define CLOCK_EVT_FEAT_KTIME		0x000004

/*
/*
 * x86(64) specific misfeatures:
 * x86(64) specific (mis)features:
 *
 *
 * - Clockevent source stops in C3 State and needs broadcast support.
 * - Clockevent source stops in C3 State and needs broadcast support.
 * - Local APIC timer is used as a dummy device.
 * - Local APIC timer is used as a dummy device.
@@ -116,10 +117,8 @@ enum clock_event_state {
 */
 */
struct clock_event_device {
struct clock_event_device {
	void			(*event_handler)(struct clock_event_device *);
	void			(*event_handler)(struct clock_event_device *);
	int			(*set_next_event)(unsigned long evt,
	int			(*set_next_event)(unsigned long evt, struct clock_event_device *);
						  struct clock_event_device *);
	int			(*set_next_ktime)(ktime_t expires, struct clock_event_device *);
	int			(*set_next_ktime)(ktime_t expires,
						  struct clock_event_device *);
	ktime_t			next_event;
	ktime_t			next_event;
	u64			max_delta_ns;
	u64			max_delta_ns;
	u64			min_delta_ns;
	u64			min_delta_ns;
@@ -136,8 +135,7 @@ struct clock_event_device {
	 * - set_mode(), only for modes <= CLOCK_EVT_MODE_RESUME.
	 * - set_mode(), only for modes <= CLOCK_EVT_MODE_RESUME.
	 * - set_state_{shutdown|periodic|oneshot}(), tick_resume().
	 * - set_state_{shutdown|periodic|oneshot}(), tick_resume().
	 */
	 */
	void			(*set_mode)(enum clock_event_mode mode,
	void			(*set_mode)(enum clock_event_mode mode, struct clock_event_device *);
					    struct clock_event_device *);
	int			(*set_state_periodic)(struct clock_event_device *);
	int			(*set_state_periodic)(struct clock_event_device *);
	int			(*set_state_oneshot)(struct clock_event_device *);
	int			(*set_state_oneshot)(struct clock_event_device *);
	int			(*set_state_shutdown)(struct clock_event_device *);
	int			(*set_state_shutdown)(struct clock_event_device *);
@@ -169,18 +167,18 @@ struct clock_event_device {
 *
 *
 * factor = (clock_ticks << shift) / nanoseconds
 * factor = (clock_ticks << shift) / nanoseconds
 */
 */
static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec,
static inline unsigned long
				   int shift)
div_sc(unsigned long ticks, unsigned long nsec, int shift)
{
{
	uint64_t tmp = ((uint64_t)ticks) << shift;
	u64 tmp = ((u64)ticks) << shift;


	do_div(tmp, nsec);
	do_div(tmp, nsec);

	return (unsigned long) tmp;
	return (unsigned long) tmp;
}
}


/* Clock event layer functions */
/* Clock event layer functions */
extern u64 clockevent_delta2ns(unsigned long latch,
extern u64 clockevent_delta2ns(unsigned long latch, struct clock_event_device *evt);
			       struct clock_event_device *evt);
extern void clockevents_register_device(struct clock_event_device *dev);
extern void clockevents_register_device(struct clock_event_device *dev);
extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu);
extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu);


@@ -194,8 +192,7 @@ extern int clockevents_update_freq(struct clock_event_device *ce, u32 freq);
static inline void
static inline void
clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec)
clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec)
{
{
	return clocks_calc_mult_shift(&ce->mult, &ce->shift, NSEC_PER_SEC,
	return clocks_calc_mult_shift(&ce->mult, &ce->shift, NSEC_PER_SEC, freq, minsec);
				      freq, minsec);
}
}


extern void clockevents_suspend(void);
extern void clockevents_suspend(void);
@@ -215,21 +212,19 @@ extern void tick_setup_hrtimer_broadcast(void);
extern int tick_check_broadcast_expired(void);
extern int tick_check_broadcast_expired(void);
# else
# else
static inline int tick_check_broadcast_expired(void) { return 0; }
static inline int tick_check_broadcast_expired(void) { return 0; }
static inline void tick_setup_hrtimer_broadcast(void) {};
static inline void tick_setup_hrtimer_broadcast(void) { }
# endif
# endif


extern int clockevents_notify(unsigned long reason, void *arg);
extern int clockevents_notify(unsigned long reason, void *arg);


#else /* CONFIG_GENERIC_CLOCKEVENTS */
#else /* !CONFIG_GENERIC_CLOCKEVENTS: */


static inline void clockevents_suspend(void) { }
static inline void clockevents_suspend(void) { }
static inline void clockevents_resume(void) { }
static inline void clockevents_resume(void) { }

static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; }
static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; }
static inline int tick_check_broadcast_expired(void) { return 0; }
static inline int tick_check_broadcast_expired(void) { return 0; }
static inline void tick_setup_hrtimer_broadcast(void) {};
static inline void tick_setup_hrtimer_broadcast(void) { }
static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; }


#endif
#endif /* !CONFIG_GENERIC_CLOCKEVENTS */


#endif
#endif /* _LINUX_CLOCKCHIPS_H */