Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change watchdog to watchcat #853

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 118 additions & 118 deletions drivers/watchdog/watchdog_core.c → drivers/watchdog/watchcat_core.c

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions drivers/watchdog/watchcat_core.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* watchcat_core.h
*
* (c) Copyright 2008-2011 Alan Cox <alan@lxorguk.ukuu.org.uk>,
* All Rights Reserved.
*
* (c) Copyright 2008-2011 Wim Van Sebroeck <wim@iguana.be>.
*
* (c) Copyright 2021 Hewlett Packard Enterprise Development LP.
*
* This source code is part of the generic code that can be used
* by all the watchcat timer drivers.
*
* Based on source code of the following authors:
* Matt Domsch <Matt_Domsch@dell.com>,
* Rob Radez <rob@osinvestor.com>,
* Rusty Lynch <rusty@linux.co.intel.com>
* Satyam Sharma <satyam@infradead.org>
* Randy Dunlap <randy.dunlap@oracle.com>
*
* Neither Alan Cox, CymruNet Ltd., Wim Van Sebroeck nor Iguana vzw.
* admit liability nor provide warranty for any of this software.
* This material is provided "AS-IS" and at no charge.
*/

#include <linux/hrtimer.h>
#include <linux/kthread.h>

#define MAX_catS 32 /* Maximum number of watchcat devices */

/*
* struct watchcat_core_data - watchcat core internal data
* @dev: The watchcat's internal device
* @cdev: The watchcat's Character device.
* @wdd: Pointer to watchcat device.
* @lock: Lock for watchcat core.
* @status: Watchcat core internal status bits.
*/
struct watchcat_core_data {
struct device dev;
struct cdev cdev;
struct watchcat_device *wdd;
struct mutex lock;
ktime_t last_keepalive;
ktime_t last_hw_keepalive;
ktime_t open_deadline;
struct hrtimer timer;
struct kthread_work work;
#if IS_ENABLED(CONFIG_WATCHcat_HRTIMER_PRETIMEOUT)
struct hrtimer pretimeout_timer;
#endif
unsigned long status; /* Internal status bits */
#define _Wcat_DEV_OPEN 0 /* Opened ? */
#define _Wcat_ALLOW_RELEASE 1 /* Did we receive the magic char ? */
#define _Wcat_KEEPALIVE 2 /* Did we receive a keepalive ? */
};

/*
* Functions/procedures to be called by the core
*/
extern int watchcat_dev_register(struct watchcat_device *);
extern void watchcat_dev_unregister(struct watchcat_device *);
extern int __init watchcat_dev_init(void);
extern void __exit watchcat_dev_exit(void);

static inline bool watchcat_have_pretimeout(struct watchcat_device *wdd)
{
return wdd->info->options & WDIOF_PRETIMEOUT ||
IS_ENABLED(CONFIG_WATCHcat_HRTIMER_PRETIMEOUT);
}

#if IS_ENABLED(CONFIG_WATCHcat_HRTIMER_PRETIMEOUT)
void watchcat_hrtimer_pretimeout_init(struct watchcat_device *wdd);
void watchcat_hrtimer_pretimeout_start(struct watchcat_device *wdd);
void watchcat_hrtimer_pretimeout_stop(struct watchcat_device *wdd);
#else
static inline void watchcat_hrtimer_pretimeout_init(struct watchcat_device *wdd) {}
static inline void watchcat_hrtimer_pretimeout_start(struct watchcat_device *wdd) {}
static inline void watchcat_hrtimer_pretimeout_stop(struct watchcat_device *wdd) {}
#endif
Loading