From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1165192AbdD1Ltk (ORCPT ); Fri, 28 Apr 2017 07:49:40 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:62150 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S939622AbdD1Lta (ORCPT ); Fri, 28 Apr 2017 07:49:30 -0400 From: Stefan Wahren To: Rob Herring Cc: Greg Kroah-Hartman , Jiri Slaby , Sebastian Reichel , Guenter Roeck , Andy Shevchenko , Andrey Smirnov , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Wahren Subject: [PATCH] serdev: Restore serdev_device_write_buf for atomic context Date: Fri, 28 Apr 2017 13:47:21 +0200 Message-Id: <1493380041-14710-1-git-send-email-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.1.4 X-Provags-ID: V03:K0:V7JSRWT0WndAKCl4K07WZQfFi1w/Sx0Y66mE8Vq/49K2fc+WvQC TMe+3uG7wLqqwMtpJGBO8YYyq05iOXib2F/tCWVbm6YP5Uo5eXCtBbLbXgPEKmFJPEESlfi ASItKyCpM/yr2nxGTuCsHveiBTb2yyo/C7WH5LHrzrVQBjlaW+8JfB6VOils9SmHLi4sWfN qmQhurdGLKa3r4p5iKytg== X-UI-Out-Filterresults: notjunk:1;V01:K0:nEM8IaDTG7c=:q958dbaaLjaJ2qTYkqSP86 hF6RwyPge66gSqZQKyI5r9zLwEUzUqhlivDaEbThonTWzK2UBtbGSVlERp5nZ0alNGvlaHyDu nVlhaPX27g1YB608CrK/fw9u2qNnvHXHfYneGZFEWoA7uos1J81x+AQg5+4DAwABuJYDrisuy afXZ0vzBO4Fd6MdA7PMLIbgnt9aMt4i5PE8uzTux07lmhsLKNUWbKzp9v4vQGsdkrZzOGN+fJ ecnnL4LWfHu9dXG0InEIKiYk0H8MdHUgCgfkKcT6GfWlxNvruGTZxBIu39HRX3nJAfX6mV6EX XE/bytNYyWr/MK4SlmL83kdD5DEGVEYxKzS+eTLaeQlI0MIU63l66/9UBiP2wSKW+U/NA0NMZ r/BLsOjVSuf5/WgwNFowUsnLBRIOIljd0QbCLTxw8CZ1zsxB0CiMNnWdaV2WB7CTux3Xj7Cp4 ne0ND82pxL9ZUZYyRWVdBLpB7+YhvZsoXj+WK5/xahjfT+SEWwkbHw60a/N6sutx0n1DbAp1M 58sHeegy+TwlyBEjjf66oC9sQwQy2NPnDk0JoKP/KD5leAv1bMaH1ZArj4owe9Q9U/ZRuclgQ 2M73iSrhoPNcXCdevL+gy1re5sDdzcC2OWegn8Ua0WOG/Yo4E1Mz6SLdWUGV1sIx4WNRQximp U9Se2H9+H7a/xJxE9q7bKQYrsjq8kTDSFqgjK2/YtoGnKKoS1S1BqK7bnj5mJ048+it4= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Stefan Wahren Fixes: 6fe729c4bdae ("serdev: Add serdev_device_write subroutine") --- drivers/tty/serdev/core.c | 12 ++++++++++++ include/linux/serdev.h | 14 +++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index 433de5e..f71b473 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c @@ -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) diff --git a/include/linux/serdev.h b/include/linux/serdev.h index cda76c6..e2a225b 100644 --- a/include/linux/serdev.h +++ b/include/linux/serdev.h @@ -195,6 +195,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); @@ -236,6 +237,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) { @@ -312,11 +319,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 */ -- 2.1.4