UPSTREAM: serdev: Restore serdev_device_write_buf for atomic context
Starting with commit 6fe729c4bdae ("serdev: Add serdev_device_write
subroutine") the function serdev_device_write_buf cannot be used in
atomic context anymore (mutex_lock is sleeping). So restore the old
behavior.
Cherry-picked-from: 6bdc00d01e202ae11fa1cae0dacbef895434483d
Change-Id: I0b82dc01521eb79d07bbfb87d8239c58f568d3eb
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Fixes: 6fe729c4bdae ("serdev: Add serdev_device_write subroutine")
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
This commit is contained in:
committed by
John Stultz
parent
6c46c6748f
commit
ffb620ec8f
@@ -122,6 +122,18 @@ void serdev_device_write_wakeup(struct serdev_device *serdev)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(serdev_device_write_wakeup);
|
||||
|
||||
int serdev_device_write_buf(struct serdev_device *serdev,
|
||||
const unsigned char *buf, size_t count)
|
||||
{
|
||||
struct serdev_controller *ctrl = serdev->ctrl;
|
||||
|
||||
if (!ctrl || !ctrl->ops->write_buf)
|
||||
return -EINVAL;
|
||||
|
||||
return ctrl->ops->write_buf(ctrl, buf, count);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(serdev_device_write_buf);
|
||||
|
||||
int serdev_device_write(struct serdev_device *serdev,
|
||||
const unsigned char *buf, size_t count,
|
||||
unsigned long timeout)
|
||||
|
||||
@@ -194,6 +194,7 @@ int serdev_device_open(struct serdev_device *);
|
||||
void serdev_device_close(struct serdev_device *);
|
||||
unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int);
|
||||
void serdev_device_set_flow_control(struct serdev_device *, bool);
|
||||
int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t);
|
||||
void serdev_device_wait_until_sent(struct serdev_device *, long);
|
||||
int serdev_device_get_tiocm(struct serdev_device *);
|
||||
int serdev_device_set_tiocm(struct serdev_device *, int, int);
|
||||
@@ -235,6 +236,12 @@ static inline unsigned int serdev_device_set_baudrate(struct serdev_device *sdev
|
||||
return 0;
|
||||
}
|
||||
static inline void serdev_device_set_flow_control(struct serdev_device *sdev, bool enable) {}
|
||||
static inline int serdev_device_write_buf(struct serdev_device *serdev,
|
||||
const unsigned char *buf,
|
||||
size_t count)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
static inline void serdev_device_wait_until_sent(struct serdev_device *sdev, long timeout) {}
|
||||
static inline int serdev_device_get_tiocm(struct serdev_device *serdev)
|
||||
{
|
||||
@@ -281,11 +288,4 @@ static inline struct device *serdev_tty_port_register(struct tty_port *port,
|
||||
static inline void serdev_tty_port_unregister(struct tty_port *port) {}
|
||||
#endif /* CONFIG_SERIAL_DEV_CTRL_TTYPORT */
|
||||
|
||||
static inline int serdev_device_write_buf(struct serdev_device *serdev,
|
||||
const unsigned char *data,
|
||||
size_t count)
|
||||
{
|
||||
return serdev_device_write(serdev, data, count, 0);
|
||||
}
|
||||
|
||||
#endif /*_LINUX_SERDEV_H */
|
||||
|
||||
Reference in New Issue
Block a user