xref: /freebsd/sys/compat/linuxkpi/common/include/linux/platform_device.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
175388b9cSBjoern A. Zeeb /*-
275388b9cSBjoern A. Zeeb  * SPDX-License-Identifier: BSD-2-Clause
375388b9cSBjoern A. Zeeb  *
475388b9cSBjoern A. Zeeb  * Copyright (c) 2020-2022 Bjoern A. Zeeb
575388b9cSBjoern A. Zeeb  *
675388b9cSBjoern A. Zeeb  * Redistribution and use in source and binary forms, with or without
775388b9cSBjoern A. Zeeb  * modification, are permitted provided that the following conditions
875388b9cSBjoern A. Zeeb  * are met:
975388b9cSBjoern A. Zeeb  * 1. Redistributions of source code must retain the above copyright
1075388b9cSBjoern A. Zeeb  *    notice, this list of conditions and the following disclaimer.
1175388b9cSBjoern A. Zeeb  * 2. Redistributions in binary form must reproduce the above copyright
1275388b9cSBjoern A. Zeeb  *    notice, this list of conditions and the following disclaimer in the
1375388b9cSBjoern A. Zeeb  *    documentation and/or other materials provided with the distribution.
1475388b9cSBjoern A. Zeeb  *
1575388b9cSBjoern A. Zeeb  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1675388b9cSBjoern A. Zeeb  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1775388b9cSBjoern A. Zeeb  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1875388b9cSBjoern A. Zeeb  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1975388b9cSBjoern A. Zeeb  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2075388b9cSBjoern A. Zeeb  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2175388b9cSBjoern A. Zeeb  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2275388b9cSBjoern A. Zeeb  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2375388b9cSBjoern A. Zeeb  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2475388b9cSBjoern A. Zeeb  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2575388b9cSBjoern A. Zeeb  * SUCH DAMAGE.
2675388b9cSBjoern A. Zeeb  */
2775388b9cSBjoern A. Zeeb 
2875388b9cSBjoern A. Zeeb #ifndef	_LINUXKPI_LINUX_PLATFORM_DEVICE_H
2975388b9cSBjoern A. Zeeb #define	_LINUXKPI_LINUX_PLATFORM_DEVICE_H
3075388b9cSBjoern A. Zeeb 
3175388b9cSBjoern A. Zeeb #include <linux/kernel.h>
3275388b9cSBjoern A. Zeeb #include <linux/device.h>
3375388b9cSBjoern A. Zeeb 
3475388b9cSBjoern A. Zeeb struct platform_device {
35*740d7654SCorvin Köhne 	const char			*name;
36*740d7654SCorvin Köhne 	int				id;
37*740d7654SCorvin Köhne 	bool				id_auto;
3875388b9cSBjoern A. Zeeb 	struct device			dev;
3975388b9cSBjoern A. Zeeb };
4075388b9cSBjoern A. Zeeb 
4175388b9cSBjoern A. Zeeb struct platform_driver {
4275388b9cSBjoern A. Zeeb 	int				(*remove)(struct platform_device *);
4375388b9cSBjoern A. Zeeb 	struct device_driver		driver;
4475388b9cSBjoern A. Zeeb };
4575388b9cSBjoern A. Zeeb 
46b9ef0689SJean-Sébastien Pédron #define	dev_is_platform(dev)	(false)
47b9ef0689SJean-Sébastien Pédron #define	to_platform_device(dev)	(NULL)
4875388b9cSBjoern A. Zeeb 
4975388b9cSBjoern A. Zeeb static __inline int
platform_driver_register(struct platform_driver * pdrv)5075388b9cSBjoern A. Zeeb platform_driver_register(struct platform_driver *pdrv)
5175388b9cSBjoern A. Zeeb {
5275388b9cSBjoern A. Zeeb 
5375388b9cSBjoern A. Zeeb 	pr_debug("%s: TODO\n", __func__);
5475388b9cSBjoern A. Zeeb 	return (-ENXIO);
5575388b9cSBjoern A. Zeeb }
5675388b9cSBjoern A. Zeeb 
5775388b9cSBjoern A. Zeeb static __inline void *
dev_get_platdata(struct device * dev)5875388b9cSBjoern A. Zeeb dev_get_platdata(struct device *dev)
5975388b9cSBjoern A. Zeeb {
6075388b9cSBjoern A. Zeeb 
6175388b9cSBjoern A. Zeeb 	pr_debug("%s: TODO\n", __func__);
6275388b9cSBjoern A. Zeeb 	return (NULL);
6375388b9cSBjoern A. Zeeb }
6475388b9cSBjoern A. Zeeb 
6575388b9cSBjoern A. Zeeb static __inline int
platform_driver_probe(struct platform_driver * pdrv,int (* pd_probe_f)(struct platform_device *))6675388b9cSBjoern A. Zeeb platform_driver_probe(struct platform_driver *pdrv,
6775388b9cSBjoern A. Zeeb     int(*pd_probe_f)(struct platform_device *))
6875388b9cSBjoern A. Zeeb {
6975388b9cSBjoern A. Zeeb 
7075388b9cSBjoern A. Zeeb 	pr_debug("%s: TODO\n", __func__);
7175388b9cSBjoern A. Zeeb 	return (-ENODEV);
7275388b9cSBjoern A. Zeeb }
7375388b9cSBjoern A. Zeeb 
7475388b9cSBjoern A. Zeeb static __inline void
platform_driver_unregister(struct platform_driver * pdrv)7575388b9cSBjoern A. Zeeb platform_driver_unregister(struct platform_driver *pdrv)
7675388b9cSBjoern A. Zeeb {
7775388b9cSBjoern A. Zeeb 
7875388b9cSBjoern A. Zeeb 	pr_debug("%s: TODO\n", __func__);
7975388b9cSBjoern A. Zeeb 	return;
8075388b9cSBjoern A. Zeeb }
8175388b9cSBjoern A. Zeeb 
82*740d7654SCorvin Köhne static __inline int
platform_device_register(struct platform_device * pdev)83*740d7654SCorvin Köhne platform_device_register(struct platform_device *pdev)
84*740d7654SCorvin Köhne {
85*740d7654SCorvin Köhne 	pr_debug("%s: TODO\n", __func__);
86*740d7654SCorvin Köhne 	return (0);
87*740d7654SCorvin Köhne }
88*740d7654SCorvin Köhne 
89b9ef0689SJean-Sébastien Pédron static __inline void
platform_device_unregister(struct platform_device * pdev)90b9ef0689SJean-Sébastien Pédron platform_device_unregister(struct platform_device *pdev)
91b9ef0689SJean-Sébastien Pédron {
92b9ef0689SJean-Sébastien Pédron 
93b9ef0689SJean-Sébastien Pédron 	pr_debug("%s: TODO\n", __func__);
94b9ef0689SJean-Sébastien Pédron 	return;
95b9ef0689SJean-Sébastien Pédron }
96b9ef0689SJean-Sébastien Pédron 
9775388b9cSBjoern A. Zeeb #endif	/* _LINUXKPI_LINUX_PLATFORM_DEVICE_H */
98