summaryrefslogtreecommitdiff
path: root/include/linux/serdev.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/serdev.h')
-rw-r--r--include/linux/serdev.h33
1 files changed, 17 insertions, 16 deletions
diff --git a/include/linux/serdev.h b/include/linux/serdev.h
index 5654c58eb73c..b6c3d957ec15 100644
--- a/include/linux/serdev.h
+++ b/include/linux/serdev.h
@@ -37,8 +37,8 @@ struct serdev_device_ops {
* @nr: Device number on serdev bus.
* @ctrl: serdev controller managing this device.
* @ops: Device operations.
- * @write_comp Completion used by serdev_device_write() internally
- * @write_lock Lock to serialize access when writing data
+ * @write_comp: Completion used by serdev_device_write() internally
+ * @write_lock: Lock to serialize access when writing data
*/
struct serdev_device {
struct device dev;
@@ -49,10 +49,7 @@ struct serdev_device {
struct mutex write_lock;
};
-static inline struct serdev_device *to_serdev_device(struct device *d)
-{
- return container_of(d, struct serdev_device, dev);
-}
+#define to_serdev_device(d) container_of_const(d, struct serdev_device, dev)
/**
* struct serdev_device_driver - serdev slave device driver
@@ -60,6 +57,7 @@ static inline struct serdev_device *to_serdev_device(struct device *d)
* structure.
* @probe: binds this driver to a serdev device.
* @remove: unbinds this driver from the serdev device.
+ * @shutdown: shut down this serdev device.
*/
struct serdev_device_driver {
struct device_driver driver;
@@ -68,10 +66,7 @@ struct serdev_device_driver {
void (*shutdown)(struct serdev_device *);
};
-static inline struct serdev_device_driver *to_serdev_device_driver(struct device_driver *d)
-{
- return container_of(d, struct serdev_device_driver, driver);
-}
+#define to_serdev_device_driver(d) container_of_const(d, struct serdev_device_driver, driver)
enum serdev_parity {
SERDEV_PARITY_NONE,
@@ -112,10 +107,7 @@ struct serdev_controller {
const struct serdev_controller_ops *ops;
};
-static inline struct serdev_controller *to_serdev_controller(struct device *d)
-{
- return container_of(d, struct serdev_controller, dev);
-}
+#define to_serdev_controller(d) container_of_const(d, struct serdev_controller, dev)
static inline void *serdev_device_get_drvdata(const struct serdev_device *serdev)
{
@@ -129,7 +121,7 @@ static inline void serdev_device_set_drvdata(struct serdev_device *serdev, void
/**
* serdev_device_put() - decrement serdev device refcount
- * @serdev serdev device.
+ * @serdev: serdev device.
*/
static inline void serdev_device_put(struct serdev_device *serdev)
{
@@ -157,7 +149,7 @@ static inline void serdev_controller_set_drvdata(struct serdev_controller *ctrl,
/**
* serdev_controller_put() - decrement controller refcount
- * @ctrl serdev controller.
+ * @ctrl: serdev controller.
*/
static inline void serdev_controller_put(struct serdev_controller *ctrl)
{
@@ -343,4 +335,13 @@ static inline bool serdev_acpi_get_uart_resource(struct acpi_resource *ares,
}
#endif /* CONFIG_ACPI */
+#ifdef CONFIG_OF
+struct serdev_controller *of_find_serdev_controller_by_node(struct device_node *node);
+#else
+static inline struct serdev_controller *of_find_serdev_controller_by_node(struct device_node *node)
+{
+ return NULL;
+}
+#endif /* CONFIG_OF */
+
#endif /*_LINUX_SERDEV_H */