File: siox.h

package info (click to toggle)
linux 6.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,488,076 kB
  • sloc: ansic: 23,401,844; asm: 266,744; sh: 108,976; makefile: 49,705; python: 36,927; perl: 36,810; cpp: 6,044; yacc: 4,904; lex: 2,722; awk: 1,440; ruby: 25; sed: 5
file content (49 lines) | stat: -rw-r--r-- 1,310 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2015-2017 Pengutronix, Uwe Kleine-König <kernel@pengutronix.de>
 */
#include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/siox.h>

#define to_siox_master(_dev)	container_of((_dev), struct siox_master, dev)
struct siox_master {
	/* these fields should be initialized by the driver */
	int busno;
	int (*pushpull)(struct siox_master *smaster,
			size_t setbuf_len, const u8 setbuf[],
			size_t getbuf_len, u8 getbuf[]);

	/* might be initialized by the driver, if 0 it is set to HZ / 40 */
	unsigned long poll_interval; /* in jiffies */

	/* framework private stuff */
	struct mutex lock;
	bool active;
	struct module *owner;
	struct device dev;
	unsigned int num_devices;
	struct list_head devices;

	size_t setbuf_len, getbuf_len;
	size_t buf_len;
	u8 *buf;
	u8 status;

	unsigned long last_poll;
	struct task_struct *poll_thread;
};

static inline void *siox_master_get_devdata(struct siox_master *smaster)
{
	return dev_get_drvdata(&smaster->dev);
}

struct siox_master *siox_master_alloc(struct device *dev, size_t size);
static inline void siox_master_put(struct siox_master *smaster)
{
	put_device(&smaster->dev);
}

int siox_master_register(struct siox_master *smaster);
void siox_master_unregister(struct siox_master *smaster);