treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / siox / siox.h
blobf08b43b713c5cdd2f01904646d7bfc85a81e496c
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (C) 2015-2017 Pengutronix, Uwe Kleine-König <kernel@pengutronix.de>
4 */
5 #include <linux/kernel.h>
6 #include <linux/kthread.h>
7 #include <linux/siox.h>
9 #define to_siox_master(_dev) container_of((_dev), struct siox_master, dev)
10 struct siox_master {
11 /* these fields should be initialized by the driver */
12 int busno;
13 int (*pushpull)(struct siox_master *smaster,
14 size_t setbuf_len, const u8 setbuf[],
15 size_t getbuf_len, u8 getbuf[]);
17 /* might be initialized by the driver, if 0 it is set to HZ / 40 */
18 unsigned long poll_interval; /* in jiffies */
20 /* framework private stuff */
21 struct mutex lock;
22 bool active;
23 struct module *owner;
24 struct device dev;
25 unsigned int num_devices;
26 struct list_head devices;
28 size_t setbuf_len, getbuf_len;
29 size_t buf_len;
30 u8 *buf;
31 u8 status;
33 unsigned long last_poll;
34 struct task_struct *poll_thread;
37 static inline void *siox_master_get_devdata(struct siox_master *smaster)
39 return dev_get_drvdata(&smaster->dev);
42 struct siox_master *siox_master_alloc(struct device *dev, size_t size);
43 static inline void siox_master_put(struct siox_master *smaster)
45 put_device(&smaster->dev);
48 int siox_master_register(struct siox_master *smaster);
49 void siox_master_unregister(struct siox_master *smaster);