treewide, serdev: change receive_buf() return type to size_t
Subsystems (26)
PATCH v2 1/1 treewide, serdev: change receive_buf() return type to size_t
From: Francesco Dolcini <[email protected]>
receive_buf() is called from ttyport_receive_buf() that expects values ">= 0" from serdev_controller_receive_buf(), change its return type from ssize_t to size_t.
The need for this clean-up was noticed while fixing a warning, see commit 94d053942544 ("Bluetooth: btnxpuart: fix recv_buf() return value"). Changing the callback prototype to return an unsigned seems the best way to document the API and ensure that is properly used.
GNSS drivers implementation of serdev receive_buf() callback return directly the return value of gnss_insert_raw(). gnss_insert_raw() returns a signed int, however this is not an issue since the value returned is always positive, because of the kfifo_in() implementation. gnss_insert_raw() could be changed to return also an unsigned, however this is not implemented here as request by the GNSS maintainer Johan Hovold.
---
v1:
- https://lore.kernel.org/all/[email protected]/
v2:
- rebased on 6.8-rc1
- add acked-by Jonathan
- do not change gnss_insert_raw()
- do not change the code style of the gnss code
- commit message improvements, explain the reasons for doing only minimal changes on the GNSS part
--- drivers/bluetooth/btmtkuart.c | 4 ++-- drivers/bluetooth/btnxpuart.c | 4 ++-- drivers/bluetooth/hci_serdev.c | 4 ++-- drivers/gnss/serial.c | 2 +- drivers/gnss/sirf.c | 2 +- drivers/greybus/gb-beagleplay.c | 6 +++--- drivers/iio/chemical/pms7003.c | 4 ++-- drivers/iio/chemical/scd30_serial.c | 4 ++-- drivers/iio/chemical/sps30_serial.c | 4 ++-- drivers/iio/imu/bno055/bno055_ser_core.c | 4 ++-- drivers/mfd/rave-sp.c | 4 ++-- drivers/net/ethernet/qualcomm/qca_uart.c | 2 +- drivers/nfc/pn533/uart.c | 4 ++-- drivers/nfc/s3fwrn5/uart.c | 4 ++-- drivers/platform/chrome/cros_ec_uart.c | 4 ++-- drivers/platform/surface/aggregator/core.c | 4 ++-- drivers/tty/serdev/serdev-ttyport.c | 10 ++++------ include/linux/serdev.h | 8 ++++---- sound/drivers/serial-generic.c | 4 ++-- 19 files changed, 40 insertions(+), 42 deletions(-)
drivers/bluetooth/btmtkuart.c +2 -2
@@ -383,8 +383,8 @@ static void btmtkuart_recv(struct hci_dev *hdev, const u8 *data, size_t count) } } -static ssize_t btmtkuart_receive_buf (struct serdev_device *serdev, -const u8 *data,size_t count) +static size_t btmtkuart_receive_buf (struct serdev_device *serdev, +const u8 *data,size_t count) {struct btmtkuart_dev *bdev =serdev_device_get_drvdata (serdev);
drivers/bluetooth/btnxpuart.c +2 -2
@@ -1264,8 +1264,8 @@ static const struct h4_recv_pkt nxp_recv_pkts[] = { { NXP_RECV_FW_REQ_V3, .recv = nxp_recv_fw_req_v3 }, }; -static ssize_t btnxpuart_receive_buf (struct serdev_device *serdev, -const u8 *data,size_t count) +static size_t btnxpuart_receive_buf (struct serdev_device *serdev, +const u8 *data,size_t count) {struct btnxpuart_dev *nxpdev =serdev_device_get_drvdata (serdev);
drivers/bluetooth/hci_serdev.c +2 -2
@@ -271,8 +271,8 @@ static void hci_uart_write_wakeup(struct serdev_device *serdev)* * Return: number of processed bytes */ -static ssize_t hci_uart_receive_buf (struct serdev_device *serdev, -const u8 *data,size_t count) +static size_t hci_uart_receive_buf (struct serdev_device *serdev, +const u8 *data,size_t count) {struct hci_uart *hu =serdev_device_get_drvdata (serdev);
drivers/gnss/serial.c +1 -1
@@ -80,7 +80,7 @@ static const struct gnss_operations gnss_serial_gnss_ops = { .write_raw = gnss_serial_write_raw, }; -static ssize_t gnss_serial_receive_buf (struct serdev_device *serdev, +static size_t gnss_serial_receive_buf (struct serdev_device *serdev,const u8 *buf,size_t count) {struct gnss_serial *gserial =serdev_device_get_drvdata (serdev);
drivers/gnss/sirf.c +1 -1
@@ -160,7 +160,7 @@ static const struct gnss_operations sirf_gnss_ops = { .write_raw = sirf_write_raw, }; -static ssize_t sirf_receive_buf (struct serdev_device *serdev, +static size_t sirf_receive_buf (struct serdev_device *serdev,const u8 *buf,size_t count) {struct sirf_data *data =serdev_device_get_drvdata (serdev);
drivers/greybus/gb-beagleplay.c +3 -3
@@ -271,7 +271,7 @@ static void hdlc_rx_frame(struct gb_beagleplay *bg) } } -static ssize_t hdlc_rx (struct gb_beagleplay *bg,const u8 *data,size_t count) +static size_t hdlc_rx (struct gb_beagleplay *bg,const u8 *data,size_t count) {size_t i;u8 c;
@@ -331,8 +331,8 @@ static void hdlc_deinit(struct gb_beagleplay *bg)flush_work (&bg->tx_work); } -static ssize_t gb_tty_receive (struct serdev_device *sd,const u8 *data, -size_t count) +static size_t gb_tty_receive (struct serdev_device *sd,const u8 *data, +size_t count) {struct gb_beagleplay *bg =serdev_device_get_drvdata (sd);
drivers/iio/chemical/pms7003.c +2 -2
@@ -211,8 +211,8 @@ static bool pms7003_frame_is_okay(struct pms7003_frame *frame)return checksum ==pms7003_calc_checksum (frame); } -static ssize_t pms7003_receive_buf (struct serdev_device *serdev,const u8 *buf, -size_t size) +static size_t pms7003_receive_buf (struct serdev_device *serdev,const u8 *buf, +size_t size) {struct iio_dev *indio_dev =serdev_device_get_drvdata (serdev);struct pms7003_state *state =iio_priv (indio_dev);
drivers/iio/chemical/scd30_serial.c +2 -2
@@ -174,8 +174,8 @@ static int scd30_serdev_command(struct scd30_state *state, enum scd30_cmd cmd, ureturn 0 ; } -static ssize_t scd30_serdev_receive_buf (struct serdev_device *serdev, -const u8 *buf,size_t size) +static size_t scd30_serdev_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t size) {struct iio_dev *indio_dev =serdev_device_get_drvdata (serdev);struct scd30_serdev_priv *priv;
drivers/iio/chemical/sps30_serial.c +2 -2
@@ -210,8 +210,8 @@ static int sps30_serial_command(struct sps30_state *state, unsigned char cmd,return rsp_size; } -static ssize_t sps30_serial_receive_buf (struct serdev_device *serdev, -const u8 *buf,size_t size) +static size_t sps30_serial_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t size) {struct iio_dev *indio_dev =dev_get_drvdata (&serdev->dev);struct sps30_serial_priv *priv;
drivers/iio/imu/bno055/bno055_ser_core.c +2 -2
@@ -378,8 +378,8 @@ static void bno055_ser_handle_rx(struct bno055_ser_priv *priv, int status)* Also, we assume to RX one pkt per time (i.e. the HW doesn't send anything * unless we require to AND we don't queue more than one request per time). */ -static ssize_t bno055_ser_receive_buf (struct serdev_device *serdev, -const u8 *buf,size_t size) +static size_t bno055_ser_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t size) {int status;struct bno055_ser_priv *priv =serdev_device_get_drvdata (serdev);
drivers/mfd/rave-sp.c +2 -2
@@ -471,8 +471,8 @@ static void rave_sp_receive_frame(struct rave_sp *sp,rave_sp_receive_reply (sp, data, length); } -static ssize_t rave_sp_receive_buf (struct serdev_device *serdev, -const u8 *buf,size_t size) +static size_t rave_sp_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t size) {struct device *dev = &serdev->dev;struct rave_sp *sp =dev_get_drvdata (dev);
drivers/net/ethernet/qualcomm/qca_uart.c +1 -1
@@ -58,7 +58,7 @@ struct qcauart {unsigned char *tx_buffer; }; -static ssize_t +static size_t qca_tty_receive (struct serdev_device *serdev,const u8 *data,size_t count) {struct qcauart *qca =serdev_device_get_drvdata (serdev);
drivers/nfc/pn533/uart.c +2 -2
@@ -203,8 +203,8 @@ static int pn532_uart_rx_is_frame(struct sk_buff *skb)return 0 ; } -static ssize_t pn532_receive_buf (struct serdev_device *serdev, -const u8 *data,size_t count) +static size_t pn532_receive_buf (struct serdev_device *serdev, +const u8 *data,size_t count) {struct pn532_uart_phy *dev =serdev_device_get_drvdata (serdev);size_t i;
drivers/nfc/s3fwrn5/uart.c +2 -2
@@ -51,8 +51,8 @@ static const struct s3fwrn5_phy_ops uart_phy_ops = { .write = s3fwrn82_uart_write, }; -static ssize_t s3fwrn82_uart_read (struct serdev_device *serdev, -const u8 *data,size_t count) +static size_t s3fwrn82_uart_read (struct serdev_device *serdev, +const u8 *data,size_t count) {struct s3fwrn82_uart_phy *phy =serdev_device_get_drvdata (serdev);size_t i;
drivers/platform/chrome/cros_ec_uart.c +2 -2
@@ -81,8 +81,8 @@ struct cros_ec_uart {struct response_info response; }; -static ssize_t cros_ec_uart_rx_bytes (struct serdev_device *serdev, -const u8 *data,size_t count) +static size_t cros_ec_uart_rx_bytes (struct serdev_device *serdev, +const u8 *data,size_t count) {struct ec_host_response *host_response;struct cros_ec_device *ec_dev =serdev_device_get_drvdata (serdev);
drivers/platform/surface/aggregator/core.c +2 -2
@@ -227,8 +227,8 @@ EXPORT_SYMBOL_GPL(ssam_client_bind);/* -- Glue layer (serdev_device -> ssam_controller). ------------------------ */ -static ssize_t ssam_receive_buf (struct serdev_device *dev,const u8 *buf, -size_t n) +static size_t ssam_receive_buf (struct serdev_device *dev,const u8 *buf, +size_t n) {struct ssam_controller *ctrl;int ret;
drivers/tty/serdev/serdev-ttyport.c +4 -6
@@ -27,19 +27,17 @@ static size_t ttyport_receive_buf(struct tty_port *port, const u8 *cp, {struct serdev_controller *ctrl = port->client_data;struct serport *serport =serdev_controller_get_drvdata (ctrl); -int ret; +size_t ret;if (!test_bit (SERPORT_ACTIVE , &serport->flags))return 0 ; ret =serdev_controller_receive_buf (ctrl, cp, count); -dev_WARN_ONCE (&ctrl->dev, ret <0 || ret > count, -"receive_buf returns %d (count = %zu)\n" , +dev_WARN_ONCE (&ctrl->dev, ret > count, +"receive_buf returns %zu (count = %zu)\n" , ret, count); -if (ret <0 ) -return 0 ; -else if (ret > count) +if (ret > count)return count;return ret;
include/linux/serdev.h +4 -4
@@ -27,7 +27,7 @@ struct serdev_device;* not sleep. */ struct serdev_device_ops { -ssize_t (*receive_buf)(struct serdev_device *,const u8 *,size_t ); +size_t (*receive_buf)(struct serdev_device *,const u8 *,size_t );void (*write_wakeup)(struct serdev_device *); };
@@ -185,9 +185,9 @@ static inline void serdev_controller_write_wakeup(struct serdev_controller *ctrl serdev->ops->write_wakeup (serdev); } -static inline ssize_t serdev_controller_receive_buf (struct serdev_controller *ctrl, -const u8 *data, -size_t count) +static inline size_t serdev_controller_receive_buf (struct serdev_controller *ctrl, +const u8 *data, +size_t count) {struct serdev_device *serdev = ctrl->serdev;
sound/drivers/serial-generic.c +2 -2
@@ -100,8 +100,8 @@ static void snd_serial_generic_write_wakeup(struct serdev_device *serdev)snd_serial_generic_tx_wakeup (drvdata); } -static ssize_t snd_serial_generic_receive_buf (struct serdev_device *serdev, -const u8 *buf,size_t count) +static size_t snd_serial_generic_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t count) {int ret;struct snd_serial_generic *drvdata =serdev_device_get_drvdata (serdev);
Signature · 1 line
2.39.2
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: drivers/bluetooth/btmtkuart.c:383
error: drivers/bluetooth/btmtkuart.c: patch does not apply
error: patch failed: drivers/bluetooth/btnxpuart.c:1264
error: drivers/bluetooth/btnxpuart.c: patch does not apply
error: patch failed: drivers/bluetooth/hci_serdev.c:271
error: drivers/bluetooth/hci_serdev.c: patch does not apply
error: patch failed: drivers/gnss/serial.c:80
error: drivers/gnss/serial.c: patch does not apply
error: patch failed: drivers/gnss/sirf.c:160
error: drivers/gnss/sirf.c: patch does not apply
error: patch failed: drivers/greybus/gb-beagleplay.c:271
error: drivers/greybus/gb-beagleplay.c: patch does not apply
error: patch failed: drivers/iio/chemical/pms7003.c:211
error: drivers/iio/chemical/pms7003.c: patch does not apply
error: patch failed: drivers/iio/chemical/scd30_serial.c:174
error: drivers/iio/chemical/scd30_serial.c: patch does not apply
error: patch failed: drivers/iio/chemical/sps30_serial.c:210
error: drivers/iio/chemical/sps30_serial.c: patch does not apply
error: patch failed: drivers/iio/imu/bno055/bno055_ser_core.c:378
error: drivers/iio/imu/bno055/bno055_ser_core.c: patch does not apply
error: patch failed: drivers/mfd/rave-sp.c:471
error: drivers/mfd/rave-sp.c: patch does not apply
error: patch failed: drivers/net/ethernet/qualcomm/qca_uart.c:58
error: drivers/net/ethernet/qualcomm/qca_uart.c: patch does not apply
error: patch failed: drivers/nfc/pn533/uart.c:203
error: drivers/nfc/pn533/uart.c: patch does not apply
error: patch failed: drivers/nfc/s3fwrn5/uart.c:51
error: drivers/nfc/s3fwrn5/uart.c: patch does not apply
error: patch failed: drivers/platform/chrome/cros_ec_uart.c:81
error: drivers/platform/chrome/cros_ec_uart.c: patch does not apply
error: patch failed: drivers/platform/surface/aggregator/core.c:227
error: drivers/platform/surface/aggregator/core.c: patch does not apply
error: patch failed: include/linux/serdev.h:27
error: include/linux/serdev.h: patch does not apply
error: patch failed: sound/drivers/serial-generic.c:100
error: sound/drivers/serial-generic.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
Quoted 19 lines · Francesco Dolcini
From: Francesco Dolcini <[email protected]>
receive_buf()is called fromttyport_receive_buf()that expects values ">= 0" fromserdev_controller_receive_buf(), change its return type fromssize_ttosize_t.The need for this clean-up was noticed while fixing a warning, see commit
94d053942544("Bluetooth: btnxpuart: fixrecv_buf()return value"). Changing the callback prototype to return an unsigned seems the best way to document the API and ensure that is properly used.GNSS drivers implementation of serdev
receive_buf()callback return directly the return value ofgnss_insert_raw().gnss_insert_raw()returns a signed int, however this is not an issue since the value returned is always positive, because of thekfifo_in()implementation.gnss_insert_raw()could be changed to return also an unsigned, however this is not implemented here as request by the GNSS maintainer Johan Hovold.
Quoted 4 lines
Suggested-by Jiri Slaby <[email protected]>Signed-off-by Francesco Dolcini <[email protected]>
Signature · 1 line
i.
Quoted 47 lines · Francesco Dolcini
From: Francesco Dolcini <[email protected]>
receive_buf()is called fromttyport_receive_buf()that expects values ">= 0" fromserdev_controller_receive_buf(), change its return type fromssize_ttosize_t.The need for this clean-up was noticed while fixing a warning, see commit
94d053942544("Bluetooth: btnxpuart: fixrecv_buf()return value"). Changing the callback prototype to return an unsigned seems the best way to document the API and ensure that is properly used.GNSS drivers implementation of serdev
receive_buf()callback return directly the return value ofgnss_insert_raw().gnss_insert_raw()returns a signed int, however this is not an issue since the value returned is always positive, because of thekfifo_in()implementation.gnss_insert_raw()could be changed to return also an unsigned, however this is not implemented here as request by the GNSS maintainer Johan Hovold.Suggested-by Jiri Slaby <[email protected]>Signed-off-by Francesco Dolcini <[email protected]>---
v1:
- https://lore.kernel.org/all/[email protected]/
v2:
- rebased on 6.8-rc1
- add acked-by Jonathan
- do not changegnss_insert_raw()
- do not change the code style of the gnss code
- commit message improvements, explain the reasons for doing only minimal changes on the GNSS part--- drivers/bluetooth/btmtkuart.c | 4 ++-- drivers/bluetooth/btnxpuart.c | 4 ++-- drivers/bluetooth/hci_serdev.c | 4 ++-- drivers/gnss/serial.c | 2 +- drivers/gnss/sirf.c | 2 +- drivers/greybus/gb-beagleplay.c | 6 +++--- drivers/iio/chemical/pms7003.c | 4 ++-- drivers/iio/chemical/scd30_serial.c | 4 ++-- drivers/iio/chemical/sps30_serial.c | 4 ++-- drivers/iio/imu/bno055/bno055_ser_core.c | 4 ++-- drivers/mfd/rave-sp.c | 4 ++-- drivers/net/ethernet/qualcomm/qca_uart.c | 2 +-
Quoted 8 lines
drivers/nfc/pn533/uart.c | 4 ++-- drivers/nfc/s3fwrn5/uart.c | 4 ++-- drivers/platform/chrome/cros_ec_uart.c | 4 ++-- drivers/platform/surface/aggregator/core.c | 4 ++-- drivers/tty/serdev/serdev-ttyport.c | 10 ++++------ include/linux/serdev.h | 8 ++++---- sound/drivers/serial-generic.c | 4 ++-- 19 files changed, 40 insertions(+), 42 deletions(-)
Quoted 19 lines · Francesco Dolcini
From: Francesco Dolcini <[email protected]>
receive_buf()is called fromttyport_receive_buf()that expects values ">= 0" fromserdev_controller_receive_buf(), change its return type fromssize_ttosize_t.The need for this clean-up was noticed while fixing a warning, see commit
94d053942544("Bluetooth: btnxpuart: fixrecv_buf()return value"). Changing the callback prototype to return an unsigned seems the best way to document the API and ensure that is properly used.GNSS drivers implementation of serdev
receive_buf()callback return directly the return value ofgnss_insert_raw().gnss_insert_raw()returns a signed int, however this is not an issue since the value returned is always positive, because of thekfifo_in()implementation.gnss_insert_raw()could be changed to return also an unsigned, however this is not implemented here as request by the GNSS maintainer Johan Hovold.
Quoted 4 lines
Suggested-by Jiri Slaby <[email protected]>Signed-off-by Francesco Dolcini <[email protected]>
Quoted 344 lines
---
v1:
- https://lore.kernel.org/all/[email protected]/
v2:
- rebased on 6.8-rc1
- add acked-by Jonathan
- do not changegnss_insert_raw()
- do not change the code style of the gnss code
- commit message improvements, explain the reasons for doing only minimal changes on the GNSS part--- drivers/bluetooth/btmtkuart.c | 4 ++-- drivers/bluetooth/btnxpuart.c | 4 ++-- drivers/bluetooth/hci_serdev.c | 4 ++-- drivers/gnss/serial.c | 2 +- drivers/gnss/sirf.c | 2 +- drivers/greybus/gb-beagleplay.c | 6 +++--- drivers/iio/chemical/pms7003.c | 4 ++-- drivers/iio/chemical/scd30_serial.c | 4 ++-- drivers/iio/chemical/sps30_serial.c | 4 ++-- drivers/iio/imu/bno055/bno055_ser_core.c | 4 ++-- drivers/mfd/rave-sp.c | 4 ++-- drivers/net/ethernet/qualcomm/qca_uart.c | 2 +- drivers/nfc/pn533/uart.c | 4 ++-- drivers/nfc/s3fwrn5/uart.c | 4 ++-- drivers/platform/chrome/cros_ec_uart.c | 4 ++-- drivers/platform/surface/aggregator/core.c | 4 ++-- drivers/tty/serdev/serdev-ttyport.c | 10 ++++------ include/linux/serdev.h | 8 ++++---- sound/drivers/serial-generic.c | 4 ++-- 19 files changed, 40 insertions(+), 42 deletions(-)drivers/bluetooth/btmtkuart.c +2
-2@@ -383,8 +383,8 @@ static void btmtkuart_recv(struct hci_dev *hdev, const u8 *data, size_t count) } } -static ssize_t btmtkuart_receive_buf (struct serdev_device *serdev, -const u8 *data,size_t count) +static size_t btmtkuart_receive_buf (struct serdev_device *serdev, +const u8 *data,size_t count) {struct btmtkuart_dev *bdev =serdev_device_get_drvdata (serdev);drivers/bluetooth/btnxpuart.c +2
-2@@ -1264,8 +1264,8 @@ static const struct h4_recv_pkt nxp_recv_pkts[] = { { NXP_RECV_FW_REQ_V3, .recv = nxp_recv_fw_req_v3 }, }; -static ssize_t btnxpuart_receive_buf (struct serdev_device *serdev, -const u8 *data,size_t count) +static size_t btnxpuart_receive_buf (struct serdev_device *serdev, +const u8 *data,size_t count) {struct btnxpuart_dev *nxpdev =serdev_device_get_drvdata (serdev);drivers/bluetooth/hci_serdev.c +2
-2@@ -271,8 +271,8 @@ static void hci_uart_write_wakeup(struct serdev_device *serdev)* * Return: number of processed bytes */ -static ssize_t hci_uart_receive_buf (struct serdev_device *serdev, -const u8 *data,size_t count) +static size_t hci_uart_receive_buf (struct serdev_device *serdev, +const u8 *data,size_t count) {struct hci_uart *hu =serdev_device_get_drvdata (serdev);drivers/gnss/serial.c +1
-1@@ -80,7 +80,7 @@ static const struct gnss_operations gnss_serial_gnss_ops = { .write_raw = gnss_serial_write_raw, }; -static ssize_t gnss_serial_receive_buf (struct serdev_device *serdev, +static size_t gnss_serial_receive_buf (struct serdev_device *serdev,const u8 *buf,size_t count) {struct gnss_serial *gserial =serdev_device_get_drvdata (serdev);drivers/gnss/sirf.c +1
-1@@ -160,7 +160,7 @@ static const struct gnss_operations sirf_gnss_ops = { .write_raw = sirf_write_raw, }; -static ssize_t sirf_receive_buf (struct serdev_device *serdev, +static size_t sirf_receive_buf (struct serdev_device *serdev,const u8 *buf,size_t count) {struct sirf_data *data =serdev_device_get_drvdata (serdev);drivers/greybus/gb-beagleplay.c +3
-3@@ -271,7 +271,7 @@ static void hdlc_rx_frame(struct gb_beagleplay *bg) } } -static ssize_t hdlc_rx (struct gb_beagleplay *bg,const u8 *data,size_t count) +static size_t hdlc_rx (struct gb_beagleplay *bg,const u8 *data,size_t count) {size_t i;u8 c;@@ -331,8 +331,8 @@ static void hdlc_deinit(struct gb_beagleplay *bg)flush_work (&bg->tx_work); } -static ssize_t gb_tty_receive (struct serdev_device *sd,const u8 *data, -size_t count) +static size_t gb_tty_receive (struct serdev_device *sd,const u8 *data, +size_t count) {struct gb_beagleplay *bg =serdev_device_get_drvdata (sd);drivers/iio/chemical/pms7003.c +2
-2@@ -211,8 +211,8 @@ static bool pms7003_frame_is_okay(struct pms7003_frame *frame)return checksum ==pms7003_calc_checksum (frame); } -static ssize_t pms7003_receive_buf (struct serdev_device *serdev,const u8 *buf, -size_t size) +static size_t pms7003_receive_buf (struct serdev_device *serdev,const u8 *buf, +size_t size) {struct iio_dev *indio_dev =serdev_device_get_drvdata (serdev);struct pms7003_state *state =iio_priv (indio_dev);drivers/iio/chemical/scd30_serial.c +2
-2@@ -174,8 +174,8 @@ static int scd30_serdev_command(struct scd30_state *state, enum scd30_cmd cmd, ureturn 0 ; } -static ssize_t scd30_serdev_receive_buf (struct serdev_device *serdev, -const u8 *buf,size_t size) +static size_t scd30_serdev_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t size) {struct iio_dev *indio_dev =serdev_device_get_drvdata (serdev);struct scd30_serdev_priv *priv;drivers/iio/chemical/sps30_serial.c +2
-2@@ -210,8 +210,8 @@ static int sps30_serial_command(struct sps30_state *state, unsigned char cmd,return rsp_size; } -static ssize_t sps30_serial_receive_buf (struct serdev_device *serdev, -const u8 *buf,size_t size) +static size_t sps30_serial_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t size) {struct iio_dev *indio_dev =dev_get_drvdata (&serdev->dev);struct sps30_serial_priv *priv;drivers/iio/imu/bno055/bno055_ser_core.c +2
-2@@ -378,8 +378,8 @@ static void bno055_ser_handle_rx(struct bno055_ser_priv *priv, int status)* Also, we assume to RX one pkt per time (i.e. the HW doesn't send anything * unless we require to AND we don't queue more than one request per time). */ -static ssize_t bno055_ser_receive_buf (struct serdev_device *serdev, -const u8 *buf,size_t size) +static size_t bno055_ser_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t size) {int status;struct bno055_ser_priv *priv =serdev_device_get_drvdata (serdev);drivers/mfd/rave-sp.c +2
-2@@ -471,8 +471,8 @@ static void rave_sp_receive_frame(struct rave_sp *sp,rave_sp_receive_reply (sp, data, length); } -static ssize_t rave_sp_receive_buf (struct serdev_device *serdev, -const u8 *buf,size_t size) +static size_t rave_sp_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t size) {struct device *dev = &serdev->dev;struct rave_sp *sp =dev_get_drvdata (dev);drivers/net/ethernet/qualcomm/qca_uart.c +1
-1@@ -58,7 +58,7 @@ struct qcauart {unsigned char *tx_buffer; }; -static ssize_t +static size_t qca_tty_receive (struct serdev_device *serdev,const u8 *data,size_t count) {struct qcauart *qca =serdev_device_get_drvdata (serdev);drivers/nfc/pn533/uart.c +2
-2@@ -203,8 +203,8 @@ static int pn532_uart_rx_is_frame(struct sk_buff *skb)return 0 ; } -static ssize_t pn532_receive_buf (struct serdev_device *serdev, -const u8 *data,size_t count) +static size_t pn532_receive_buf (struct serdev_device *serdev, +const u8 *data,size_t count) {struct pn532_uart_phy *dev =serdev_device_get_drvdata (serdev);size_t i;drivers/nfc/s3fwrn5/uart.c +2
-2@@ -51,8 +51,8 @@ static const struct s3fwrn5_phy_ops uart_phy_ops = { .write = s3fwrn82_uart_write, }; -static ssize_t s3fwrn82_uart_read (struct serdev_device *serdev, -const u8 *data,size_t count) +static size_t s3fwrn82_uart_read (struct serdev_device *serdev, +const u8 *data,size_t count) {struct s3fwrn82_uart_phy *phy =serdev_device_get_drvdata (serdev);size_t i;drivers/platform/chrome/cros_ec_uart.c +2
-2@@ -81,8 +81,8 @@ struct cros_ec_uart {struct response_info response; }; -static ssize_t cros_ec_uart_rx_bytes (struct serdev_device *serdev, -const u8 *data,size_t count) +static size_t cros_ec_uart_rx_bytes (struct serdev_device *serdev, +const u8 *data,size_t count) {struct ec_host_response *host_response;struct cros_ec_device *ec_dev =serdev_device_get_drvdata (serdev);drivers/platform/surface/aggregator/core.c +2
-2@@ -227,8 +227,8 @@ EXPORT_SYMBOL_GPL(ssam_client_bind);/* -- Glue layer (serdev_device -> ssam_controller). ------------------------ */ -static ssize_t ssam_receive_buf (struct serdev_device *dev,const u8 *buf, -size_t n) +static size_t ssam_receive_buf (struct serdev_device *dev,const u8 *buf, +size_t n) {struct ssam_controller *ctrl;int ret;drivers/tty/serdev/serdev-ttyport.c +4
-6@@ -27,19 +27,17 @@ static size_t ttyport_receive_buf(struct tty_port *port, const u8 *cp, {struct serdev_controller *ctrl = port->client_data;struct serport *serport =serdev_controller_get_drvdata (ctrl); -int ret; +size_t ret;if (!test_bit (SERPORT_ACTIVE , &serport->flags))return 0 ; ret =serdev_controller_receive_buf (ctrl, cp, count); -dev_WARN_ONCE (&ctrl->dev, ret <0 || ret > count, -"receive_buf returns %d (count = %zu)\n" , +dev_WARN_ONCE (&ctrl->dev, ret > count, +"receive_buf returns %zu (count = %zu)\n" , ret, count); -if (ret <0 ) -return 0 ; -else if (ret > count) +if (ret > count)return count;return ret;include/linux/serdev.h +4
-4@@ -27,7 +27,7 @@ struct serdev_device;* not sleep. */ struct serdev_device_ops { -ssize_t (*receive_buf)(struct serdev_device *,const u8 *,size_t ); +size_t (*receive_buf)(struct serdev_device *,const u8 *,size_t );void (*write_wakeup)(struct serdev_device *); };@@ -185,9 +185,9 @@ static inline void serdev_controller_write_wakeup(struct serdev_controller *ctrl serdev->ops->write_wakeup (serdev); } -static inline ssize_t serdev_controller_receive_buf (struct serdev_controller *ctrl, -const u8 *data, -size_t count) +static inline size_t serdev_controller_receive_buf (struct serdev_controller *ctrl, +const u8 *data, +size_t count) {struct serdev_device *serdev = ctrl->serdev;sound/drivers/serial-generic.c +2
-2@@ -100,8 +100,8 @@ static void snd_serial_generic_write_wakeup(struct serdev_device *serdev)snd_serial_generic_tx_wakeup (drvdata); } -static ssize_t snd_serial_generic_receive_buf (struct serdev_device *serdev, -const u8 *buf,size_t count) +static size_t snd_serial_generic_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t count) {int ret;struct snd_serial_generic *drvdata =serdev_device_get_drvdata (serdev);
Quoted 11 lines · Francesco Dolcini
From: Francesco Dolcini <[email protected]>
receive_buf()is called fromttyport_receive_buf()that expects values ">= 0" fromserdev_controller_receive_buf(), change its return type fromssize_ttosize_t.The need for this clean-up was noticed while fixing a warning, see commit
94d053942544("Bluetooth: btnxpuart: fixrecv_buf()return value"). Changing the callback prototype to return an unsigned seems the best way to document the API and ensure that is properly used.
Quoted 4 lines
GNSS drivers implementation of serdev
receive_buf()callback return directly the return value ofgnss_insert_raw().gnss_insert_raw()returns a signed int, however this is not an issue since the value returned is always positive, because of thekfifo_in()implementation.
Agreed.
Quoted 3 lines
gnss_insert_raw()could be changed to return also an unsigned, however this is not implemented here as request by the GNSS maintainer Johan Hovold.
I was going to suggest this, and suggest changing the "ret" in gnss_insert_raw() to return size_t. But to really do that right it would include some other changes as well. Leaving it as an int as Johan suggests preserves correct behavior.
One minor point below, plus a couple comments affirming that an int return value is OK because it's always non-negative.
Quoted 27 lines
Suggested-by Jiri Slaby <[email protected]>Signed-off-by Francesco Dolcini <[email protected]>---
v1:
- https://lore.kernel.org/all/[email protected]/
v2:
- rebased on 6.8-rc1
- add acked-by Jonathan
- do not changegnss_insert_raw()
- do not change the code style of the gnss code
- commit message improvements, explain the reasons for doing only minimal changes on the GNSS part--- drivers/bluetooth/btmtkuart.c | 4 ++-- drivers/bluetooth/btnxpuart.c | 4 ++-- drivers/bluetooth/hci_serdev.c | 4 ++-- drivers/gnss/serial.c | 2 +- drivers/gnss/sirf.c | 2 +- drivers/greybus/gb-beagleplay.c | 6 +++--- drivers/iio/chemical/pms7003.c | 4 ++-- drivers/iio/chemical/scd30_serial.c | 4 ++-- drivers/iio/chemical/sps30_serial.c | 4 ++-- drivers/iio/imu/bno055/bno055_ser_core.c | 4 ++-- drivers/mfd/rave-sp.c | 4 ++-- drivers/net/ethernet/qualcomm/qca_uart.c | 2 +-
Quoted 9 lines
drivers/nfc/pn533/uart.c | 4 ++-- drivers/nfc/s3fwrn5/uart.c | 4 ++-- drivers/platform/chrome/cros_ec_uart.c | 4 ++-- drivers/platform/surface/aggregator/core.c | 4 ++-- drivers/tty/serdev/serdev-ttyport.c | 10 ++++------ include/linux/serdev.h | 8 ++++---- sound/drivers/serial-generic.c | 4 ++-- 19 files changed, 40 insertions(+), 42 deletions(-)
. . .
Quoted 5 lines
drivers/mfd/rave-sp.c +0
-0
drivers/mfd/rave-sp.c static void rave_sp_receive_frame(struct rave_sp *sp, · line 478
Quoted 10 lines
drivers/mfd/rave-sp.c +2
-2@@ -471,8 +471,8 @@ static void rave_sp_receive_frame(struct rave_sp *sp,rave_sp_receive_reply (sp, data, length); } -static ssize_t rave_sp_receive_buf (struct serdev_device *serdev, -const u8 *buf,size_t size) +static size_t rave_sp_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t size) {struct device *dev = &serdev->dev;struct rave_sp *sp =dev_get_drvdata (dev);
One return path in this function returns (src - buf), which is *almost* guaranteed to be positive. The one case it wouldn't be is if the assignment of end wraps around, and that's not checked.
I think it's fine, but... That seems theoretically possible.
drivers/net/ethernet/qualcomm/qca_uart.c
Quoted 2 lines
drivers/net/ethernet/qualcomm/qca_uart.c +0
-0
. . .
Quoted 5 lines
drivers/platform/surface/aggregator/core.c +0
-0
drivers/platform/surface/aggregator/core.c EXPORT_SYMBOL_GPL(ssam_client_bind); · line 234
Quoted 10 lines
drivers/platform/surface/aggregator/core.c +2
-2@@ -227,8 +227,8 @@ EXPORT_SYMBOL_GPL(ssam_client_bind);/* -- Glue layer (serdev_device -> ssam_controller). ------------------------ */ -static ssize_t ssam_receive_buf (struct serdev_device *dev,const u8 *buf, -size_t n) +static size_t ssam_receive_buf (struct serdev_device *dev,const u8 *buf, +size_t n) {struct ssam_controller *ctrl;int ret;
Here you the return value will be positive despite ret being a signed int. So like the GNSS case, this is OK.
drivers/tty/serdev/serdev-ttyport.c
Quoted 2 lines
drivers/tty/serdev/serdev-ttyport.c +0
-0
. . .
Quoted 5 lines
sound/drivers/serial-generic.c +0
-0
sound/drivers/serial-generic.c static void snd_serial_generic_write_wakeup(struct serdev_device *serdev) · line 107
Quoted 10 lines
sound/drivers/serial-generic.c +2
-2@@ -100,8 +100,8 @@ static void snd_serial_generic_write_wakeup(struct serdev_device *serdev)snd_serial_generic_tx_wakeup (drvdata); } -static ssize_t snd_serial_generic_receive_buf (struct serdev_device *serdev, -const u8 *buf,size_t count) +static size_t snd_serial_generic_receive_buf (struct serdev_device *serdev, +const u8 *buf,size_t count) {int ret;struct snd_serial_generic *drvdata =serdev_device_get_drvdata (serdev);
Same thing here.
Quoted 23 lines · Francesco Dolcini
From: Francesco Dolcini <[email protected]>
receive_buf()is called fromttyport_receive_buf()that expects values ">= 0" fromserdev_controller_receive_buf(), change its return type fromssize_ttosize_t.The need for this clean-up was noticed while fixing a warning, see commit
94d053942544("Bluetooth: btnxpuart: fixrecv_buf()return value"). Changing the callback prototype to return an unsigned seems the best way to document the API and ensure that is properly used.GNSS drivers implementation of serdev
receive_buf()callback return directly the return value ofgnss_insert_raw().gnss_insert_raw()returns a signed int, however this is not an issue since the value returned is always positive, because of thekfifo_in()implementation.gnss_insert_raw()could be changed to return also an unsigned, however this is not implemented here as request by the GNSS maintainer Johan Hovold.Suggested-by Jiri Slaby <[email protected]>Signed-off-by Francesco Dolcini <[email protected]>
Quoted 10 lines
---
v1:
- https://lore.kernel.org/all/[email protected]/
v2:
- rebased on 6.8-rc1
- add acked-by Jonathan
- do not changegnss_insert_raw()
- do not change the code style of the gnss code
- commit message improvements, explain the reasons for doing only minimal changes on the GNSS part
Looks good to me now:
Quoted 45 lines · Francesco Dolcini
From: Francesco Dolcini <[email protected]>
receive_buf()is called fromttyport_receive_buf()that expects values ">= 0" fromserdev_controller_receive_buf(), change its return type fromssize_ttosize_t.The need for this clean-up was noticed while fixing a warning, see commit
94d053942544("Bluetooth: btnxpuart: fixrecv_buf()return value"). Changing the callback prototype to return an unsigned seems the best way to document the API and ensure that is properly used.GNSS drivers implementation of serdev
receive_buf()callback return directly the return value ofgnss_insert_raw().gnss_insert_raw()returns a signed int, however this is not an issue since the value returned is always positive, because of thekfifo_in()implementation.gnss_insert_raw()could be changed to return also an unsigned, however this is not implemented here as request by the GNSS maintainer Johan Hovold.Suggested-by Jiri Slaby <[email protected]>Signed-off-by Francesco Dolcini <[email protected]>---
v1:
- https://lore.kernel.org/all/[email protected]/
v2:
- rebased on 6.8-rc1
- add acked-by Jonathan
- do not changegnss_insert_raw()
- do not change the code style of the gnss code
- commit message improvements, explain the reasons for doing only minimal changes on the GNSS part--- drivers/bluetooth/btmtkuart.c | 4 ++-- drivers/bluetooth/btnxpuart.c | 4 ++-- drivers/bluetooth/hci_serdev.c | 4 ++-- drivers/gnss/serial.c | 2 +- drivers/gnss/sirf.c | 2 +- drivers/greybus/gb-beagleplay.c | 6 +++--- drivers/iio/chemical/pms7003.c | 4 ++-- drivers/iio/chemical/scd30_serial.c | 4 ++-- drivers/iio/chemical/sps30_serial.c | 4 ++-- drivers/iio/imu/bno055/bno055_ser_core.c | 4 ++--
Quoted 1 line
drivers/mfd/rave-sp.c | 4 ++--
Quoted 9 lines
drivers/net/ethernet/qualcomm/qca_uart.c | 2 +- drivers/nfc/pn533/uart.c | 4 ++-- drivers/nfc/s3fwrn5/uart.c | 4 ++-- drivers/platform/chrome/cros_ec_uart.c | 4 ++-- drivers/platform/surface/aggregator/core.c | 4 ++-- drivers/tty/serdev/serdev-ttyport.c | 10 ++++------ include/linux/serdev.h | 8 ++++---- sound/drivers/serial-generic.c | 4 ++-- 19 files changed, 40 insertions(+), 42 deletions(-)
Signature · 1 line
Lee Jones [李琼斯]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=818742
---Test result---
Test Summary:
CheckPatch FAIL 4.12 seconds GitLint FAIL 0.46 seconds SubjectPrefix FAIL 0.37 seconds BuildKernel PASS 27.70 seconds CheckAllWarning PASS 30.49 seconds CheckSparse PASS 35.96 seconds CheckSmatch PASS 99.61 seconds BuildKernel32 PASS 28.31 seconds TestRunnerSetup PASS 507.40 seconds TestRunner_l2cap-tester PASS 17.25 seconds TestRunner_iso-tester PASS 32.68 seconds TestRunner_bnep-tester PASS 4.78 seconds TestRunner_mgmt-tester FAIL 110.18 seconds TestRunner_rfcomm-tester PASS 7.36 seconds TestRunner_sco-tester PASS 11.18 seconds TestRunner_ioctl-tester PASS 7.89 seconds TestRunner_mesh-tester PASS 5.93 seconds TestRunner_smp-tester PASS 6.84 seconds TestRunner_userchan-tester PASS 4.99 seconds IncrementalBuild PASS 26.44 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v2] treewide, serdev: change receive_buf() return type to size_t
WARNING: function definition argument 'struct serdev_device *' should also have an identifier name #425: FILE: include/linux/serdev.h:30:
+ size_t (*receive_buf)(struct serdev_device *, const u8 *, size_t);
WARNING: function definition argument 'const u8 *' should also have an identifier name #425: FILE: include/linux/serdev.h:30:
+ size_t (*receive_buf)(struct serdev_device *, const u8 *, size_t);
WARNING: function definition argument 'size_t' should also have an identifier name #425: FILE: include/linux/serdev.h:30:
+ size_t (*receive_buf)(struct serdev_device *, const u8 *, size_t);
total: 0 errors, 3 warnings, 215 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13525933.patch has style problems, please review.
NOTE: Ignored message types: UNKNOWN_COMMIT_ID
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v2] treewide, serdev: change receive_buf() return type to size_t
WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
23: B1 Line exceeds max length (82>80): "Link: https://lore.kernel.org/all/[email protected]/"
##############################
Test: SubjectPrefix - FAIL
Desc: Check subject contains "Bluetooth" prefix
Output:
"Bluetooth: " prefix is not specified in the subject
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 497, Passed: 486 (97.8%), Failed: 5, Not Run: 6
Failed Test Cases
Read Ext Controller Info 1 Failed 0.082 seconds Read Ext Controller Info 2 Failed 0.094 seconds Read Ext Controller Info 3 Failed 0.088 seconds Read Ext Controller Info 4 Failed 0.085 seconds Read Ext Controller Info 5 Failed 0.101 seconds
---
Regards,
Linux Bluetooth
This patch was applied to chrome-platform/linux.git (for-kernelci) by Greg Kroah-Hartman <[email protected]>:
Hello:
This patch was applied to chrome-platform/linux.git (for-kernelci) by Greg Kroah-Hartman <[email protected]>:
Quoted 6 lines · On Mon, 22 Jan 2024 19:05:51 +0100 you wrote:
From: Francesco Dolcini <[email protected]>
receive_buf()is called fromttyport_receive_buf()that expects values ">= 0" fromserdev_controller_receive_buf(), change its return type fromssize_ttosize_t.
Quoted 6 lines
The need for this clean-up was noticed while fixing a warning, see commit
94d053942544("Bluetooth: btnxpuart: fixrecv_buf()return value"). Changing the callback prototype to return an unsigned seems the best way to document the API and ensure that is properly used.[...]
Here is the summary with links:
- [v2] treewide, serdev: change receive_buf() return type to size_t
https://git.kernel.org/chrome-platform/c/fed99212acae
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
This patch was applied to chrome-platform/linux.git (for-next) by Greg Kroah-Hartman <[email protected]>:
Hello:
This patch was applied to chrome-platform/linux.git (for-next) by Greg Kroah-Hartman <[email protected]>:
Quoted 6 lines · On Mon, 22 Jan 2024 19:05:51 +0100 you wrote:
From: Francesco Dolcini <[email protected]>
receive_buf()is called fromttyport_receive_buf()that expects values ">= 0" fromserdev_controller_receive_buf(), change its return type fromssize_ttosize_t.
Quoted 6 lines
The need for this clean-up was noticed while fixing a warning, see commit
94d053942544("Bluetooth: btnxpuart: fixrecv_buf()return value"). Changing the callback prototype to return an unsigned seems the best way to document the API and ensure that is properly used.[...]
Here is the summary with links:
- [v2] treewide, serdev: change receive_buf() return type to size_t
https://git.kernel.org/chrome-platform/c/fed99212acae
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html