Commit Graph

36 Commits

Author SHA1 Message Date
Thomas Petazzoni
2824232792 tty/module.c: fix ec_tty_send_xchar() prototype for Linux >= 6.8
In upstream Linux kernel commit:
  3a00da027946cd08db1c1be2de4620950bbdf074 ("tty: make tty_operations::send_xchar accept u8 char")

The prototype of tty_operations->send_xchar() was changed from:

  void (*send_xchar)(struct tty_struct *tty, char ch);

to:

  void (*send_xchar)(struct tty_struct *tty, u8 ch);

This commit was merged in Linux 6.8, and therefore the
ec_tty_send_xchar() implementation needs to be changed to avoid the
following build failure:

/home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:751:19: error: initialization of "void (*)(struct tty_struct *, u8)" {aka "void (*)(struct tty_struct *, unsigned char)"} from incompatible pointer type "void (*)(struct tty_struct *, char)" [-Werror=incompatible-pointer-types]
  751 |     .send_xchar = ec_tty_send_xchar,
      |                   ^~~~~~~~~~~~~~~~~

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-12-31 10:42:49 +01:00
Thomas Petazzoni
27175946c4 tty/module.c: fix ec_tty_write() prototype for Linux >= 6.6
In upstream Linux kernel commits:
 95713967ba52389f7cea75704d0cf048080ec218 ("tty: make tty_operations::write()'s count size_t")
 69851e4ab8feeb369119a44ddca430c0ee15f0d8 ("tty: propagate u8 data to tty_operations::write()")

The prototype of tty_operations->write() was changed from:

       int  (*write)(struct tty_struct * tty,
                     const unsigned char *buf, int count);

to:

       ssize_t (*write)(struct tty_struct *tty, const u8 *buf, size_t count);

Both of those commits were merged in Linux 6.6, and this needs an
update in tty/module.c to avoid the following build failure:

/home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:740:14: error: initialization of "ssize_t (*)(struct tty_struct *, const u8 *, size_t)" {aka "long int (*)(struct tty_struct *, const unsigned char *, long unsigned int)"} from incompatible pointer type "int (*)(struct tty_struct *, const unsigned char *, int)" [-Werror=incompatible-pointer-types]
  740 |     .write = ec_tty_write,
      |              ^~~~~~~~~~~~

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-12-31 10:42:49 +01:00
Thomas Petazzoni
aed3ba0acb tty/module.c: mark internal functions as static
Fixes:

/home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:128:12: warning: no previous prototype for ‘ec_tty_init_module’ [-Wmissing-prototypes]
  128 | int __init ec_tty_init_module(void)
      |            ^~~~~~~~~~~~~~~~~~
/home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:189:13: warning: no previous prototype for ‘ec_tty_cleanup_module’ [-Wmissing-prototypes]
  189 | void __exit ec_tty_cleanup_module(void)
      |             ^~~~~~~~~~~~~~~~~~~~~
/home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:216:5: warning: no previous prototype for ‘ec_tty_init’ [-Wmissing-prototypes]
  216 | int ec_tty_init(ec_tty_t *t, int minor,
      |     ^~~~~~~~~~~
/home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:293:6: warning: no previous prototype for ‘ec_tty_clear’ [-Wmissing-prototypes]
  293 | void ec_tty_clear(ec_tty_t *tty)
      |      ^~~~~~~~~~~~
/home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:301:14: warning: no previous prototype for ‘ec_tty_tx_size’ [-Wmissing-prototypes]
  301 | unsigned int ec_tty_tx_size(ec_tty_t *tty)
      |              ^~~~~~~~~~~~~~
/home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:316:14: warning: no previous prototype for ‘ec_tty_tx_space’ [-Wmissing-prototypes]
  316 | unsigned int ec_tty_tx_space(ec_tty_t *tty)
      |              ^~~~~~~~~~~~~~~
/home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:323:14: warning: no previous prototype for ‘ec_tty_rx_size’ [-Wmissing-prototypes]
  323 | unsigned int ec_tty_rx_size(ec_tty_t *tty)
      |              ^~~~~~~~~~~~~~
/home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:338:14: warning: no previous prototype for ‘ec_tty_rx_space’ [-Wmissing-prototypes]
  338 | unsigned int ec_tty_rx_space(ec_tty_t *tty)
      |              ^~~~~~~~~~~~~~~
/home/autobuild/autobuild/instance-7/output-1/build/igh-ethercat-1.6.2/./tty/module.c:345:5: warning: no previous prototype for ‘ec_tty_get_serial_info’ [-Wmissing-prototypes]
  345 | int ec_tty_get_serial_info(ec_tty_t *tty, struct serial_struct *data)
      |     ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-12-31 10:42:49 +01:00
Florian Pose
ee55c20e28 Fixed mail address; limited lines to 78 characters; removed $Id$. 2024-02-01 15:15:41 +01:00
Bjarne von Horn
c3826c7758 Remove EtherCAT copyright notice. 2024-01-15 11:20:25 +01:00
Bjarne von Horn
539d8e4ab2 Remove 2.6 conditionals in tty 2024-01-15 11:20:25 +01:00
Per Noergaard Christensen
3678a69c38 tty: fixups for kernels 5.14 and 5.15
alloc_tty_driver was deprecated by tty_alloc_driver in commit 7f0bc6a68ed9
(TTY: pass flags to alloc_tty_driver) in 2012 but first in kernel
v5.15 it has been dropped (56ec5880a28e). Switch to tty_alloc_driver
when using kernels >= v5.15

As of v5.15, the put_tty_driver alias has been dropped in favor of
directly calling tty_driver_kref_put (9f90a4ddef4e).  Switch to
tty_driver_kref_put when using kernels >= v5.15

As from v5.14 the write_room (03b3b1a2405c) and
chars_in_buffer (fff4ef17a940) methods' return type changed from int
to unsigned int in struct tty_operations. This has impact on
ec_tty_write_room() and ec_tty_chars_in_buffer().
2023-07-17 17:56:25 +02:00
Florian Pose
9ac57fa55d Merge branch 'v6.1-fixups' into 'master'
tty/module.c: fixups for linux >= v6.1

See merge request etherlab.org/ethercat!68

(cherry picked from commit f8c9ec6e48)

bbb16b87 tty/module.c: adapt signature of ->set_termios method to v6.1
d39b4a59 tty/module.c: include proper header for INIT_C_CC definition
2023-05-25 14:26:30 +00:00
Kale Yuzik
abdefcedf2 Implement fix for kernel error when opening TTY device file on kernel 3.7.0 or greater
Error message: "tty_init_dev: ttyEC driver does not set tty->port. This would crash the kernel. Fix the driver!"
2021-06-30 08:48:54 -06:00
Florian Pose
6ad16e7e67 Added kernel-specific handling for init_timer/setup_timer and
access_ok() for ec_tty module and example.
Closes #2.
2021-04-09 12:26:08 +02:00
Florian Pose
b6cace3df1 Support changed tty_prepare_flip_string() interface from kernel 3.9. 2016-10-18 10:20:21 +02:00
Florian Pose
a2da5180b8 TTY: termios structure was included in 'struct tty' with kernel 3.7. 2013-02-12 11:52:03 +01:00
Florian Pose
f601bbf249 TTY ioctl() file parameter was dropped in kernel 2.6.39. 2013-02-12 11:34:54 +01:00
Florian Pose
b0b7e6fde4 Removed trailing spaces. 2012-09-06 20:22:24 +02:00
Florian Pose
bd56747e3e Removed whitespace. 2012-07-13 10:42:31 +02:00
Florian Pose
f739694670 Improved compiling on 2.6.34 (thanks to Malcolm Lewis). 2010-10-25 16:45:33 +02:00
Florian Pose
aba214160a Removed TIOCSSERIAL because it doesn't make sense for virtual tty interfaces. 2010-04-20 11:21:43 +02:00
Florian Pose
94485eeec1 Replaced deprecated init_MUTEX in tty code. 2010-02-16 11:16:05 +01:00
Florian Pose
1b1f62c0af Allow multiple open() calls to tty devices. 2010-02-02 14:10:52 +01:00
Florian Pose
f42953a87a Minor change. 2010-01-26 16:43:08 +01:00
Florian Pose
c6bf2d73fc Pass initial cflag to device-specific implementation in constructor. 2010-01-25 18:32:45 +01:00
Florian Pose
d910657cf8 Callback set via own structure. 2010-01-25 17:42:07 +01:00
Florian Pose
4d00c17e05 Sorted methods. 2010-01-25 16:15:56 +01:00
Florian Pose
018507a22e Implemented setting of baud rate, data frame and RTS/CTS. 2010-01-22 14:10:18 +01:00
Florian Pose
127ad90aa7 Request initial configuration on tty open. 2010-01-22 11:02:04 +01:00
Florian Pose
a98da94149 Passing tty cflag to serial implementation. 2010-01-21 17:53:40 +01:00
Florian Pose
f6c0de7723 Basic configuration for tty. 2010-01-21 16:41:41 +01:00
Florian Pose
386ba8b8ee Implemented tty put_char and break_ctl callbacks for kernels newer than 2.6.26
or 2.6.27, respectively.
2010-01-08 10:34:29 +01:00
Florian Pose
06bad71e6b Implemented reading direction of tty driver. 2009-12-09 12:42:28 +01:00
Florian Pose
6dbc77cd62 Send direction works! 2009-12-02 15:38:10 +01:00
Florian Pose
e2279c8715 Removed semaphore header. 2009-12-01 22:19:13 +01:00
Florian Pose
efb02691c1 TTY open and close. 2009-12-01 22:16:50 +01:00
Florian Pose
e5bcaeefcd Use own PFX for printk. 2009-12-01 22:03:50 +01:00
Florian Pose
866c82a4a8 Interface management. 2009-12-01 21:45:45 +01:00
Florian Pose
fdad28ad05 Register a TTY driver with one device. 2009-12-01 17:35:33 +01:00
Florian Pose
40943a197d Base files for new TTY driver. 2009-11-30 18:02:29 +01:00