diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-11-30 08:46:50 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-12-01 03:57:49 -0500 |
| commit | 1eb388b67a380b387030e54684f297d9f6046449 (patch) | |
| tree | b926cabbc11cfb2cc133120274e8dcaa300b4418 | |
| parent | f1706cb74e2ef85d7550aeafb5bb4a7534e06286 (diff) | |
staging: dgnc: remove sysfs files
The dgnc driver has no business creating "custom" sysfs files just for a
single tty driver. Combined with the odd way they are created, it's
just a mess, so remove them entirely as I am tired of tripping over them
when doing driver core changes.
Cc: Lidza Louina <lidza.louina@gmail.com>
Cc: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/staging/dgnc/Makefile | 3 | ||||
| -rw-r--r-- | drivers/staging/dgnc/dgnc_driver.c | 14 | ||||
| -rw-r--r-- | drivers/staging/dgnc/dgnc_driver.h | 1 | ||||
| -rw-r--r-- | drivers/staging/dgnc/dgnc_sysfs.c | 703 | ||||
| -rw-r--r-- | drivers/staging/dgnc/dgnc_sysfs.h | 40 | ||||
| -rw-r--r-- | drivers/staging/dgnc/dgnc_tty.c | 17 |
6 files changed, 8 insertions, 770 deletions
diff --git a/drivers/staging/dgnc/Makefile b/drivers/staging/dgnc/Makefile index 995c874f40eb..40ff0d007695 100644 --- a/drivers/staging/dgnc/Makefile +++ b/drivers/staging/dgnc/Makefile | |||
| @@ -2,5 +2,4 @@ obj-$(CONFIG_DGNC) += dgnc.o | |||
| 2 | 2 | ||
| 3 | dgnc-objs := dgnc_cls.o dgnc_driver.o\ | 3 | dgnc-objs := dgnc_cls.o dgnc_driver.o\ |
| 4 | dgnc_mgmt.o dgnc_neo.o\ | 4 | dgnc_mgmt.o dgnc_neo.o\ |
| 5 | dgnc_tty.o dgnc_sysfs.o\ | 5 | dgnc_tty.o dgnc_utils.o |
| 6 | dgnc_utils.o | ||
diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index 91c9047de122..5381dbddd8bb 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #include "dgnc_tty.h" | 24 | #include "dgnc_tty.h" |
| 25 | #include "dgnc_cls.h" | 25 | #include "dgnc_cls.h" |
| 26 | #include "dgnc_neo.h" | 26 | #include "dgnc_neo.h" |
| 27 | #include "dgnc_sysfs.h" | ||
| 28 | 27 | ||
| 29 | MODULE_LICENSE("GPL"); | 28 | MODULE_LICENSE("GPL"); |
| 30 | MODULE_AUTHOR("Digi International, http://www.digi.com"); | 29 | MODULE_AUTHOR("Digi International, http://www.digi.com"); |
| @@ -419,8 +418,6 @@ static int dgnc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 419 | brd->state = BOARD_READY; | 418 | brd->state = BOARD_READY; |
| 420 | brd->dpastatus = BD_RUNNING; | 419 | brd->dpastatus = BD_RUNNING; |
| 421 | 420 | ||
| 422 | dgnc_create_ports_sysfiles(brd); | ||
| 423 | |||
| 424 | dgnc_board[dgnc_num_boards++] = brd; | 421 | dgnc_board[dgnc_num_boards++] = brd; |
| 425 | 422 | ||
| 426 | return 0; | 423 | return 0; |
| @@ -555,7 +552,7 @@ static void dgnc_cleanup_board(struct dgnc_board *brd) | |||
| 555 | 552 | ||
| 556 | /* Driver load/unload functions */ | 553 | /* Driver load/unload functions */ |
| 557 | 554 | ||
| 558 | static void cleanup(bool sysfiles) | 555 | static void cleanup(void) |
| 559 | { | 556 | { |
| 560 | int i; | 557 | int i; |
| 561 | unsigned long flags; | 558 | unsigned long flags; |
| @@ -567,15 +564,11 @@ static void cleanup(bool sysfiles) | |||
| 567 | /* Turn off poller right away. */ | 564 | /* Turn off poller right away. */ |
| 568 | del_timer_sync(&dgnc_poll_timer); | 565 | del_timer_sync(&dgnc_poll_timer); |
| 569 | 566 | ||
| 570 | if (sysfiles) | ||
| 571 | dgnc_remove_driver_sysfiles(&dgnc_driver); | ||
| 572 | |||
| 573 | device_destroy(dgnc_class, MKDEV(dgnc_major, 0)); | 567 | device_destroy(dgnc_class, MKDEV(dgnc_major, 0)); |
| 574 | class_destroy(dgnc_class); | 568 | class_destroy(dgnc_class); |
| 575 | unregister_chrdev(dgnc_major, "dgnc"); | 569 | unregister_chrdev(dgnc_major, "dgnc"); |
| 576 | 570 | ||
| 577 | for (i = 0; i < dgnc_num_boards; ++i) { | 571 | for (i = 0; i < dgnc_num_boards; ++i) { |
| 578 | dgnc_remove_ports_sysfiles(dgnc_board[i]); | ||
| 579 | dgnc_cleanup_tty(dgnc_board[i]); | 572 | dgnc_cleanup_tty(dgnc_board[i]); |
| 580 | dgnc_cleanup_board(dgnc_board[i]); | 573 | dgnc_cleanup_board(dgnc_board[i]); |
| 581 | } | 574 | } |
| @@ -588,7 +581,7 @@ static void cleanup(bool sysfiles) | |||
| 588 | */ | 581 | */ |
| 589 | static void __exit dgnc_cleanup_module(void) | 582 | static void __exit dgnc_cleanup_module(void) |
| 590 | { | 583 | { |
| 591 | cleanup(true); | 584 | cleanup(); |
| 592 | pci_unregister_driver(&dgnc_driver); | 585 | pci_unregister_driver(&dgnc_driver); |
| 593 | } | 586 | } |
| 594 | 587 | ||
| @@ -613,10 +606,9 @@ static int __init dgnc_init_module(void) | |||
| 613 | rc = pci_register_driver(&dgnc_driver); | 606 | rc = pci_register_driver(&dgnc_driver); |
| 614 | if (rc) { | 607 | if (rc) { |
| 615 | pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n"); | 608 | pr_warn("WARNING: dgnc driver load failed. No Digi Neo or Classic boards found.\n"); |
| 616 | cleanup(false); | 609 | cleanup(); |
| 617 | return rc; | 610 | return rc; |
| 618 | } | 611 | } |
| 619 | dgnc_create_driver_sysfiles(&dgnc_driver); | ||
| 620 | 612 | ||
| 621 | return 0; | 613 | return 0; |
| 622 | } | 614 | } |
diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index 63b50bfe9ab3..c8119f2fe881 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h | |||
| @@ -23,7 +23,6 @@ | |||
| 23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
| 24 | 24 | ||
| 25 | #include "digi.h" /* Digi specific ioctl header */ | 25 | #include "digi.h" /* Digi specific ioctl header */ |
| 26 | #include "dgnc_sysfs.h" /* Support for SYSFS */ | ||
| 27 | 26 | ||
| 28 | /* Driver defines */ | 27 | /* Driver defines */ |
| 29 | 28 | ||
diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c deleted file mode 100644 index d41517c41bb3..000000000000 --- a/drivers/staging/dgnc/dgnc_sysfs.c +++ /dev/null | |||
| @@ -1,703 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2004 Digi International (www.digi.com) | ||
| 3 | * Scott H Kilau <Scott_Kilau at digi dot com> | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the | ||
| 12 | * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
| 13 | * PURPOSE. See the GNU General Public License for more details. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <linux/kernel.h> | ||
| 17 | #include <linux/module.h> | ||
| 18 | #include <linux/ctype.h> | ||
| 19 | #include <linux/string.h> | ||
| 20 | #include <linux/serial_reg.h> | ||
| 21 | #include <linux/device.h> | ||
| 22 | #include <linux/pci.h> | ||
| 23 | #include <linux/kdev_t.h> | ||
| 24 | |||
| 25 | #include "dgnc_driver.h" | ||
| 26 | #include "dgnc_mgmt.h" | ||
| 27 | |||
| 28 | static ssize_t version_show(struct device_driver *ddp, char *buf) | ||
| 29 | { | ||
| 30 | return snprintf(buf, PAGE_SIZE, "%s\n", DG_PART); | ||
| 31 | } | ||
| 32 | static DRIVER_ATTR_RO(version); | ||
| 33 | |||
| 34 | static ssize_t boards_show(struct device_driver *ddp, char *buf) | ||
| 35 | { | ||
| 36 | return snprintf(buf, PAGE_SIZE, "%d\n", dgnc_num_boards); | ||
| 37 | } | ||
| 38 | static DRIVER_ATTR_RO(boards); | ||
| 39 | |||
| 40 | static ssize_t maxboards_show(struct device_driver *ddp, char *buf) | ||
| 41 | { | ||
| 42 | return snprintf(buf, PAGE_SIZE, "%d\n", MAXBOARDS); | ||
| 43 | } | ||
| 44 | static DRIVER_ATTR_RO(maxboards); | ||
| 45 | |||
| 46 | static ssize_t pollrate_show(struct device_driver *ddp, char *buf) | ||
| 47 | { | ||
| 48 | return snprintf(buf, PAGE_SIZE, "%dms\n", dgnc_poll_tick); | ||
| 49 | } | ||
| 50 | |||
| 51 | static ssize_t pollrate_store(struct device_driver *ddp, | ||
| 52 | const char *buf, size_t count) | ||
| 53 | { | ||
| 54 | unsigned long flags; | ||
| 55 | int tick; | ||
| 56 | int ret; | ||
| 57 | |||
| 58 | ret = sscanf(buf, "%d\n", &tick); | ||
| 59 | if (ret != 1) | ||
| 60 | return -EINVAL; | ||
| 61 | |||
| 62 | spin_lock_irqsave(&dgnc_poll_lock, flags); | ||
| 63 | dgnc_poll_tick = tick; | ||
| 64 | spin_unlock_irqrestore(&dgnc_poll_lock, flags); | ||
| 65 | |||
| 66 | return count; | ||
| 67 | } | ||
| 68 | static DRIVER_ATTR_RW(pollrate); | ||
| 69 | |||
| 70 | void dgnc_create_driver_sysfiles(struct pci_driver *dgnc_driver) | ||
| 71 | { | ||
| 72 | int rc = 0; | ||
| 73 | struct device_driver *driverfs = &dgnc_driver->driver; | ||
| 74 | |||
| 75 | rc |= driver_create_file(driverfs, &driver_attr_version); | ||
| 76 | rc |= driver_create_file(driverfs, &driver_attr_boards); | ||
| 77 | rc |= driver_create_file(driverfs, &driver_attr_maxboards); | ||
| 78 | rc |= driver_create_file(driverfs, &driver_attr_pollrate); | ||
| 79 | if (rc) | ||
| 80 | pr_err("DGNC: sysfs driver_create_file failed!\n"); | ||
| 81 | } | ||
| 82 | |||
| 83 | void dgnc_remove_driver_sysfiles(struct pci_driver *dgnc_driver) | ||
| 84 | { | ||
| 85 | struct device_driver *driverfs = &dgnc_driver->driver; | ||
| 86 | |||
| 87 | driver_remove_file(driverfs, &driver_attr_version); | ||
| 88 | driver_remove_file(driverfs, &driver_attr_boards); | ||
| 89 | driver_remove_file(driverfs, &driver_attr_maxboards); | ||
| 90 | driver_remove_file(driverfs, &driver_attr_pollrate); | ||
| 91 | } | ||
| 92 | |||
| 93 | #define DGNC_VERIFY_BOARD(p, bd) \ | ||
| 94 | do { \ | ||
| 95 | if (!p) \ | ||
| 96 | return 0; \ | ||
| 97 | \ | ||
| 98 | bd = dev_get_drvdata(p); \ | ||
| 99 | if (!bd || bd->magic != DGNC_BOARD_MAGIC) \ | ||
| 100 | return 0; \ | ||
| 101 | if (bd->state != BOARD_READY) \ | ||
| 102 | return 0; \ | ||
| 103 | } while (0) | ||
| 104 | |||
| 105 | static ssize_t vpd_show(struct device *p, struct device_attribute *attr, | ||
| 106 | char *buf) | ||
| 107 | { | ||
| 108 | struct dgnc_board *bd; | ||
| 109 | int count = 0; | ||
| 110 | int i = 0; | ||
| 111 | |||
| 112 | DGNC_VERIFY_BOARD(p, bd); | ||
| 113 | |||
| 114 | count += sprintf(buf + count, | ||
| 115 | "\n 0 1 2 3 4 5 6 7 8 9 A B C D E F"); | ||
| 116 | for (i = 0; i < 0x40 * 2; i++) { | ||
| 117 | if (!(i % 16)) | ||
| 118 | count += sprintf(buf + count, "\n%04X ", i * 2); | ||
| 119 | count += sprintf(buf + count, "%02X ", bd->vpd[i]); | ||
| 120 | } | ||
| 121 | count += sprintf(buf + count, "\n"); | ||
| 122 | |||
| 123 | return count; | ||
| 124 | } | ||
| 125 | static DEVICE_ATTR_RO(vpd); | ||
| 126 | |||
| 127 | static ssize_t serial_number_show(struct device *p, | ||
| 128 | struct device_attribute *attr, char *buf) | ||
| 129 | { | ||
| 130 | struct dgnc_board *bd; | ||
| 131 | int count = 0; | ||
| 132 | |||
| 133 | DGNC_VERIFY_BOARD(p, bd); | ||
| 134 | |||
| 135 | if (bd->serial_num[0] == '\0') | ||
| 136 | count += sprintf(buf + count, "<UNKNOWN>\n"); | ||
| 137 | else | ||
| 138 | count += sprintf(buf + count, "%s\n", bd->serial_num); | ||
| 139 | |||
| 140 | return count; | ||
| 141 | } | ||
| 142 | static DEVICE_ATTR_RO(serial_number); | ||
| 143 | |||
| 144 | static ssize_t ports_state_show(struct device *p, | ||
| 145 | struct device_attribute *attr, char *buf) | ||
| 146 | { | ||
| 147 | struct dgnc_board *bd; | ||
| 148 | int count = 0; | ||
| 149 | int i = 0; | ||
| 150 | |||
| 151 | DGNC_VERIFY_BOARD(p, bd); | ||
| 152 | |||
| 153 | for (i = 0; i < bd->nasync; i++) { | ||
| 154 | count += snprintf(buf + count, PAGE_SIZE - count, | ||
| 155 | "%d %s\n", bd->channels[i]->ch_portnum, | ||
| 156 | bd->channels[i]->ch_open_count ? "Open" : "Closed"); | ||
| 157 | } | ||
| 158 | return count; | ||
| 159 | } | ||
| 160 | static DEVICE_ATTR_RO(ports_state); | ||
| 161 | |||
| 162 | static ssize_t ports_baud_show(struct device *p, | ||
| 163 | struct device_attribute *attr, char *buf) | ||
| 164 | { | ||
| 165 | struct dgnc_board *bd; | ||
| 166 | int count = 0; | ||
| 167 | int i = 0; | ||
| 168 | |||
| 169 | DGNC_VERIFY_BOARD(p, bd); | ||
| 170 | |||
| 171 | for (i = 0; i < bd->nasync; i++) { | ||
| 172 | count += snprintf(buf + count, PAGE_SIZE - count, | ||
| 173 | "%d %d\n", bd->channels[i]->ch_portnum, | ||
| 174 | bd->channels[i]->ch_old_baud); | ||
| 175 | } | ||
| 176 | return count; | ||
| 177 | } | ||
| 178 | static DEVICE_ATTR_RO(ports_baud); | ||
| 179 | |||
| 180 | static ssize_t ports_msignals_show(struct device *p, | ||
| 181 | struct device_attribute *attr, char *buf) | ||
| 182 | { | ||
| 183 | struct dgnc_board *bd; | ||
| 184 | int count = 0; | ||
| 185 | int i = 0; | ||
| 186 | |||
| 187 | DGNC_VERIFY_BOARD(p, bd); | ||
| 188 | |||
| 189 | for (i = 0; i < bd->nasync; i++) { | ||
| 190 | struct channel_t *ch = bd->channels[i]; | ||
| 191 | |||
| 192 | if (ch->ch_open_count) { | ||
| 193 | count += snprintf(buf + count, PAGE_SIZE - count, | ||
| 194 | "%d %s %s %s %s %s %s\n", | ||
| 195 | ch->ch_portnum, | ||
| 196 | (ch->ch_mostat & UART_MCR_RTS) ? "RTS" : "", | ||
| 197 | (ch->ch_mistat & UART_MSR_CTS) ? "CTS" : "", | ||
| 198 | (ch->ch_mostat & UART_MCR_DTR) ? "DTR" : "", | ||
| 199 | (ch->ch_mistat & UART_MSR_DSR) ? "DSR" : "", | ||
| 200 | (ch->ch_mistat & UART_MSR_DCD) ? "DCD" : "", | ||
| 201 | (ch->ch_mistat & UART_MSR_RI) ? "RI" : ""); | ||
| 202 | } else { | ||
| 203 | count += snprintf(buf + count, PAGE_SIZE - count, | ||
| 204 | "%d\n", ch->ch_portnum); | ||
| 205 | } | ||
| 206 | } | ||
| 207 | return count; | ||
| 208 | } | ||
| 209 | static DEVICE_ATTR_RO(ports_msignals); | ||
| 210 | |||
| 211 | static ssize_t ports_iflag_show(struct device *p, | ||
| 212 | struct device_attribute *attr, char *buf) | ||
| 213 | { | ||
| 214 | struct dgnc_board *bd; | ||
| 215 | int count = 0; | ||
| 216 | int i = 0; | ||
| 217 | |||
| 218 | DGNC_VERIFY_BOARD(p, bd); | ||
| 219 | |||
| 220 | for (i = 0; i < bd->nasync; i++) { | ||
| 221 | count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n", | ||
| 222 | bd->channels[i]->ch_portnum, | ||
| 223 | bd->channels[i]->ch_c_iflag); | ||
| 224 | } | ||
| 225 | return count; | ||
| 226 | } | ||
| 227 | static DEVICE_ATTR_RO(ports_iflag); | ||
| 228 | |||
| 229 | static ssize_t ports_cflag_show(struct device *p, | ||
| 230 | struct device_attribute *attr, char *buf) | ||
| 231 | { | ||
| 232 | struct dgnc_board *bd; | ||
| 233 | int count = 0; | ||
| 234 | int i = 0; | ||
| 235 | |||
| 236 | DGNC_VERIFY_BOARD(p, bd); | ||
| 237 | |||
| 238 | for (i = 0; i < bd->nasync; i++) { | ||
| 239 | count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n", | ||
| 240 | bd->channels[i]->ch_portnum, | ||
| 241 | bd->channels[i]->ch_c_cflag); | ||
| 242 | } | ||
| 243 | return count; | ||
| 244 | } | ||
| 245 | static DEVICE_ATTR_RO(ports_cflag); | ||
| 246 | |||
| 247 | static ssize_t ports_oflag_show(struct device *p, | ||
| 248 | struct device_attribute *attr, char *buf) | ||
| 249 | { | ||
| 250 | struct dgnc_board *bd; | ||
| 251 | int count = 0; | ||
| 252 | int i = 0; | ||
| 253 | |||
| 254 | DGNC_VERIFY_BOARD(p, bd); | ||
| 255 | |||
| 256 | for (i = 0; i < bd->nasync; i++) { | ||
| 257 | count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n", | ||
| 258 | bd->channels[i]->ch_portnum, | ||
| 259 | bd->channels[i]->ch_c_oflag); | ||
| 260 | } | ||
| 261 | return count; | ||
| 262 | } | ||
| 263 | static DEVICE_ATTR_RO(ports_oflag); | ||
| 264 | |||
| 265 | static ssize_t ports_lflag_show(struct device *p, | ||
| 266 | struct device_attribute *attr, char *buf) | ||
| 267 | { | ||
| 268 | struct dgnc_board *bd; | ||
| 269 | int count = 0; | ||
| 270 | int i = 0; | ||
| 271 | |||
| 272 | DGNC_VERIFY_BOARD(p, bd); | ||
| 273 | |||
| 274 | for (i = 0; i < bd->nasync; i++) { | ||
| 275 | count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n", | ||
| 276 | bd->channels[i]->ch_portnum, | ||
| 277 | bd->channels[i]->ch_c_lflag); | ||
| 278 | } | ||
| 279 | return count; | ||
| 280 | } | ||
| 281 | static DEVICE_ATTR_RO(ports_lflag); | ||
| 282 | |||
| 283 | static ssize_t ports_digi_flag_show(struct device *p, | ||
| 284 | struct device_attribute *attr, char *buf) | ||
| 285 | { | ||
| 286 | struct dgnc_board *bd; | ||
| 287 | int count = 0; | ||
| 288 | int i = 0; | ||
| 289 | |||
| 290 | DGNC_VERIFY_BOARD(p, bd); | ||
| 291 | |||
| 292 | for (i = 0; i < bd->nasync; i++) { | ||
| 293 | count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n", | ||
| 294 | bd->channels[i]->ch_portnum, | ||
| 295 | bd->channels[i]->ch_digi.digi_flags); | ||
| 296 | } | ||
| 297 | return count; | ||
| 298 | } | ||
| 299 | static DEVICE_ATTR_RO(ports_digi_flag); | ||
| 300 | |||
| 301 | static ssize_t ports_rxcount_show(struct device *p, | ||
| 302 | struct device_attribute *attr, char *buf) | ||
| 303 | { | ||
| 304 | struct dgnc_board *bd; | ||
| 305 | int count = 0; | ||
| 306 | int i = 0; | ||
| 307 | |||
| 308 | DGNC_VERIFY_BOARD(p, bd); | ||
| 309 | |||
| 310 | for (i = 0; i < bd->nasync; i++) { | ||
| 311 | count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n", | ||
| 312 | bd->channels[i]->ch_portnum, | ||
| 313 | bd->channels[i]->ch_rxcount); | ||
| 314 | } | ||
| 315 | return count; | ||
| 316 | } | ||
| 317 | static DEVICE_ATTR_RO(ports_rxcount); | ||
| 318 | |||
| 319 | static ssize_t ports_txcount_show(struct device *p, | ||
| 320 | struct device_attribute *attr, char *buf) | ||
| 321 | { | ||
| 322 | struct dgnc_board *bd; | ||
| 323 | int count = 0; | ||
| 324 | int i = 0; | ||
| 325 | |||
| 326 | DGNC_VERIFY_BOARD(p, bd); | ||
| 327 | |||
| 328 | for (i = 0; i < bd->nasync; i++) { | ||
| 329 | count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n", | ||
| 330 | bd->channels[i]->ch_portnum, | ||
| 331 | bd->channels[i]->ch_txcount); | ||
| 332 | } | ||
| 333 | return count; | ||
| 334 | } | ||
| 335 | static DEVICE_ATTR_RO(ports_txcount); | ||
| 336 | |||
| 337 | /* | ||
| 338 | * this function creates the sys files that will export each signal status | ||
| 339 | * to sysfs each value will be put in a separate filename | ||
| 340 | */ | ||
| 341 | void dgnc_create_ports_sysfiles(struct dgnc_board *bd) | ||
| 342 | { | ||
| 343 | int rc = 0; | ||
| 344 | |||
| 345 | dev_set_drvdata(&bd->pdev->dev, bd); | ||
| 346 | rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_state); | ||
| 347 | rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_baud); | ||
| 348 | rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_msignals); | ||
| 349 | rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_iflag); | ||
| 350 | rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_cflag); | ||
| 351 | rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_oflag); | ||
| 352 | rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_lflag); | ||
| 353 | rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_digi_flag); | ||
| 354 | rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_rxcount); | ||
| 355 | rc |= device_create_file(&bd->pdev->dev, &dev_attr_ports_txcount); | ||
| 356 | rc |= device_create_file(&bd->pdev->dev, &dev_attr_vpd); | ||
| 357 | rc |= device_create_file(&bd->pdev->dev, &dev_attr_serial_number); | ||
| 358 | if (rc) | ||
| 359 | dev_err(&bd->pdev->dev, "dgnc: sysfs device_create_file failed!\n"); | ||
| 360 | } | ||
| 361 | |||
| 362 | /* removes all the sys files created for that port */ | ||
| 363 | void dgnc_remove_ports_sysfiles(struct dgnc_board *bd) | ||
| 364 | { | ||
| 365 | device_remove_file(&bd->pdev->dev, &dev_attr_ports_state); | ||
| 366 | device_remove_file(&bd->pdev->dev, &dev_attr_ports_baud); | ||
| 367 | device_remove_file(&bd->pdev->dev, &dev_attr_ports_msignals); | ||
| 368 | device_remove_file(&bd->pdev->dev, &dev_attr_ports_iflag); | ||
| 369 | device_remove_file(&bd->pdev->dev, &dev_attr_ports_cflag); | ||
| 370 | device_remove_file(&bd->pdev->dev, &dev_attr_ports_oflag); | ||
| 371 | device_remove_file(&bd->pdev->dev, &dev_attr_ports_lflag); | ||
| 372 | device_remove_file(&bd->pdev->dev, &dev_attr_ports_digi_flag); | ||
| 373 | device_remove_file(&bd->pdev->dev, &dev_attr_ports_rxcount); | ||
| 374 | device_remove_file(&bd->pdev->dev, &dev_attr_ports_txcount); | ||
| 375 | device_remove_file(&bd->pdev->dev, &dev_attr_vpd); | ||
| 376 | device_remove_file(&bd->pdev->dev, &dev_attr_serial_number); | ||
| 377 | } | ||
| 378 | |||
| 379 | static ssize_t tty_state_show(struct device *d, | ||
| 380 | struct device_attribute *attr, char *buf) | ||
| 381 | { | ||
| 382 | struct dgnc_board *bd; | ||
| 383 | struct channel_t *ch; | ||
| 384 | struct un_t *un; | ||
| 385 | |||
| 386 | if (!d) | ||
| 387 | return 0; | ||
| 388 | un = dev_get_drvdata(d); | ||
| 389 | if (!un || un->magic != DGNC_UNIT_MAGIC) | ||
| 390 | return 0; | ||
| 391 | ch = un->un_ch; | ||
| 392 | if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) | ||
| 393 | return 0; | ||
| 394 | bd = ch->ch_bd; | ||
| 395 | if (!bd || bd->magic != DGNC_BOARD_MAGIC) | ||
| 396 | return 0; | ||
| 397 | if (bd->state != BOARD_READY) | ||
| 398 | return 0; | ||
| 399 | |||
| 400 | return snprintf(buf, PAGE_SIZE, "%s", | ||
| 401 | un->un_open_count ? "Open" : "Closed"); | ||
| 402 | } | ||
| 403 | static DEVICE_ATTR_RO(tty_state); | ||
| 404 | |||
| 405 | static ssize_t tty_baud_show(struct device *d, | ||
| 406 | struct device_attribute *attr, char *buf) | ||
| 407 | { | ||
| 408 | struct dgnc_board *bd; | ||
| 409 | struct channel_t *ch; | ||
| 410 | struct un_t *un; | ||
| 411 | |||
| 412 | if (!d) | ||
| 413 | return 0; | ||
| 414 | un = dev_get_drvdata(d); | ||
| 415 | if (!un || un->magic != DGNC_UNIT_MAGIC) | ||
| 416 | return 0; | ||
| 417 | ch = un->un_ch; | ||
| 418 | if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) | ||
| 419 | return 0; | ||
| 420 | bd = ch->ch_bd; | ||
| 421 | if (!bd || bd->magic != DGNC_BOARD_MAGIC) | ||
| 422 | return 0; | ||
| 423 | if (bd->state != BOARD_READY) | ||
| 424 | return 0; | ||
| 425 | |||
| 426 | return snprintf(buf, PAGE_SIZE, "%d\n", ch->ch_old_baud); | ||
| 427 | } | ||
| 428 | static DEVICE_ATTR_RO(tty_baud); | ||
| 429 | |||
| 430 | static ssize_t tty_msignals_show(struct device *d, | ||
| 431 | struct device_attribute *attr, char *buf) | ||
| 432 | { | ||
| 433 | struct dgnc_board *bd; | ||
| 434 | struct channel_t *ch; | ||
| 435 | struct un_t *un; | ||
| 436 | |||
| 437 | if (!d) | ||
| 438 | return 0; | ||
| 439 | un = dev_get_drvdata(d); | ||
| 440 | if (!un || un->magic != DGNC_UNIT_MAGIC) | ||
| 441 | return 0; | ||
| 442 | ch = un->un_ch; | ||
| 443 | if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) | ||
| 444 | return 0; | ||
| 445 | bd = ch->ch_bd; | ||
| 446 | if (!bd || bd->magic != DGNC_BOARD_MAGIC) | ||
| 447 | return 0; | ||
| 448 | if (bd->state != BOARD_READY) | ||
| 449 | return 0; | ||
| 450 | |||
| 451 | if (ch->ch_open_count) { | ||
| 452 | return snprintf(buf, PAGE_SIZE, "%s %s %s %s %s %s\n", | ||
| 453 | (ch->ch_mostat & UART_MCR_RTS) ? "RTS" : "", | ||
| 454 | (ch->ch_mistat & UART_MSR_CTS) ? "CTS" : "", | ||
| 455 | (ch->ch_mostat & UART_MCR_DTR) ? "DTR" : "", | ||
| 456 | (ch->ch_mistat & UART_MSR_DSR) ? "DSR" : "", | ||
| 457 | (ch->ch_mistat & UART_MSR_DCD) ? "DCD" : "", | ||
| 458 | (ch->ch_mistat & UART_MSR_RI) ? "RI" : ""); | ||
| 459 | } | ||
| 460 | return 0; | ||
| 461 | } | ||
| 462 | static DEVICE_ATTR_RO(tty_msignals); | ||
| 463 | |||
| 464 | static ssize_t tty_iflag_show(struct device *d, | ||
| 465 | struct device_attribute *attr, char *buf) | ||
| 466 | { | ||
| 467 | struct dgnc_board *bd; | ||
| 468 | struct channel_t *ch; | ||
| 469 | struct un_t *un; | ||
| 470 | |||
| 471 | if (!d) | ||
| 472 | return 0; | ||
| 473 | un = dev_get_drvdata(d); | ||
| 474 | if (!un || un->magic != DGNC_UNIT_MAGIC) | ||
| 475 | return 0; | ||
| 476 | ch = un->un_ch; | ||
| 477 | if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) | ||
| 478 | return 0; | ||
| 479 | bd = ch->ch_bd; | ||
| 480 | if (!bd || bd->magic != DGNC_BOARD_MAGIC) | ||
| 481 | return 0; | ||
| 482 | if (bd->state != BOARD_READY) | ||
| 483 | return 0; | ||
| 484 | |||
| 485 | return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_iflag); | ||
| 486 | } | ||
| 487 | static DEVICE_ATTR_RO(tty_iflag); | ||
| 488 | |||
| 489 | static ssize_t tty_cflag_show(struct device *d, | ||
| 490 | struct device_attribute *attr, char *buf) | ||
| 491 | { | ||
| 492 | struct dgnc_board *bd; | ||
| 493 | struct channel_t *ch; | ||
| 494 | struct un_t *un; | ||
| 495 | |||
| 496 | if (!d) | ||
| 497 | return 0; | ||
| 498 | un = dev_get_drvdata(d); | ||
| 499 | if (!un || un->magic != DGNC_UNIT_MAGIC) | ||
| 500 | return 0; | ||
| 501 | ch = un->un_ch; | ||
| 502 | if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) | ||
| 503 | return 0; | ||
| 504 | bd = ch->ch_bd; | ||
| 505 | if (!bd || bd->magic != DGNC_BOARD_MAGIC) | ||
| 506 | return 0; | ||
| 507 | if (bd->state != BOARD_READY) | ||
| 508 | return 0; | ||
| 509 | |||
| 510 | return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_cflag); | ||
| 511 | } | ||
| 512 | static DEVICE_ATTR_RO(tty_cflag); | ||
| 513 | |||
| 514 | static ssize_t tty_oflag_show(struct device *d, | ||
| 515 | struct device_attribute *attr, char *buf) | ||
| 516 | { | ||
| 517 | struct dgnc_board *bd; | ||
| 518 | struct channel_t *ch; | ||
| 519 | struct un_t *un; | ||
| 520 | |||
| 521 | if (!d) | ||
| 522 | return 0; | ||
| 523 | un = dev_get_drvdata(d); | ||
| 524 | if (!un || un->magic != DGNC_UNIT_MAGIC) | ||
| 525 | return 0; | ||
| 526 | ch = un->un_ch; | ||
| 527 | if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) | ||
| 528 | return 0; | ||
| 529 | bd = ch->ch_bd; | ||
| 530 | if (!bd || bd->magic != DGNC_BOARD_MAGIC) | ||
| 531 | return 0; | ||
| 532 | if (bd->state != BOARD_READY) | ||
| 533 | return 0; | ||
| 534 | |||
| 535 | return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_oflag); | ||
| 536 | } | ||
| 537 | static DEVICE_ATTR_RO(tty_oflag); | ||
| 538 | |||
| 539 | static ssize_t tty_lflag_show(struct device *d, | ||
| 540 | struct device_attribute *attr, char *buf) | ||
| 541 | { | ||
| 542 | struct dgnc_board *bd; | ||
| 543 | struct channel_t *ch; | ||
| 544 | struct un_t *un; | ||
| 545 | |||
| 546 | if (!d) | ||
| 547 | return 0; | ||
| 548 | un = dev_get_drvdata(d); | ||
| 549 | if (!un || un->magic != DGNC_UNIT_MAGIC) | ||
| 550 | return 0; | ||
| 551 | ch = un->un_ch; | ||
| 552 | if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) | ||
| 553 | return 0; | ||
| 554 | bd = ch->ch_bd; | ||
| 555 | if (!bd || bd->magic != DGNC_BOARD_MAGIC) | ||
| 556 | return 0; | ||
| 557 | if (bd->state != BOARD_READY) | ||
| 558 | return 0; | ||
| 559 | |||
| 560 | return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_lflag); | ||
| 561 | } | ||
| 562 | static DEVICE_ATTR_RO(tty_lflag); | ||
| 563 | |||
| 564 | static ssize_t tty_digi_flag_show(struct device *d, | ||
| 565 | struct device_attribute *attr, char *buf) | ||
| 566 | { | ||
| 567 | struct dgnc_board *bd; | ||
| 568 | struct channel_t *ch; | ||
| 569 | struct un_t *un; | ||
| 570 | |||
| 571 | if (!d) | ||
| 572 | return 0; | ||
| 573 | un = dev_get_drvdata(d); | ||
| 574 | if (!un || un->magic != DGNC_UNIT_MAGIC) | ||
| 575 | return 0; | ||
| 576 | ch = un->un_ch; | ||
| 577 | if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) | ||
| 578 | return 0; | ||
| 579 | bd = ch->ch_bd; | ||
| 580 | if (!bd || bd->magic != DGNC_BOARD_MAGIC) | ||
| 581 | return 0; | ||
| 582 | if (bd->state != BOARD_READY) | ||
| 583 | return 0; | ||
| 584 | |||
| 585 | return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_digi.digi_flags); | ||
| 586 | } | ||
| 587 | static DEVICE_ATTR_RO(tty_digi_flag); | ||
| 588 | |||
| 589 | static ssize_t tty_rxcount_show(struct device *d, | ||
| 590 | struct device_attribute *attr, char *buf) | ||
| 591 | { | ||
| 592 | struct dgnc_board *bd; | ||
| 593 | struct channel_t *ch; | ||
| 594 | struct un_t *un; | ||
| 595 | |||
| 596 | if (!d) | ||
| 597 | return 0; | ||
| 598 | un = dev_get_drvdata(d); | ||
| 599 | if (!un || un->magic != DGNC_UNIT_MAGIC) | ||
| 600 | return 0; | ||
| 601 | ch = un->un_ch; | ||
| 602 | if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) | ||
| 603 | return 0; | ||
| 604 | bd = ch->ch_bd; | ||
| 605 | if (!bd || bd->magic != DGNC_BOARD_MAGIC) | ||
| 606 | return 0; | ||
| 607 | if (bd->state != BOARD_READY) | ||
| 608 | return 0; | ||
| 609 | |||
| 610 | return snprintf(buf, PAGE_SIZE, "%ld\n", ch->ch_rxcount); | ||
| 611 | } | ||
| 612 | static DEVICE_ATTR_RO(tty_rxcount); | ||
| 613 | |||
| 614 | static ssize_t tty_txcount_show(struct device *d, | ||
| 615 | struct device_attribute *attr, char *buf) | ||
| 616 | { | ||
| 617 | struct dgnc_board *bd; | ||
| 618 | struct channel_t *ch; | ||
| 619 | struct un_t *un; | ||
| 620 | |||
| 621 | if (!d) | ||
| 622 | return 0; | ||
| 623 | un = dev_get_drvdata(d); | ||
| 624 | if (!un || un->magic != DGNC_UNIT_MAGIC) | ||
| 625 | return 0; | ||
| 626 | ch = un->un_ch; | ||
| 627 | if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) | ||
| 628 | return 0; | ||
| 629 | bd = ch->ch_bd; | ||
| 630 | if (!bd || bd->magic != DGNC_BOARD_MAGIC) | ||
| 631 | return 0; | ||
| 632 | if (bd->state != BOARD_READY) | ||
| 633 | return 0; | ||
| 634 | |||
| 635 | return snprintf(buf, PAGE_SIZE, "%ld\n", ch->ch_txcount); | ||
| 636 | } | ||
| 637 | static DEVICE_ATTR_RO(tty_txcount); | ||
| 638 | |||
| 639 | static ssize_t tty_custom_name_show(struct device *d, | ||
| 640 | struct device_attribute *attr, char *buf) | ||
| 641 | { | ||
| 642 | struct dgnc_board *bd; | ||
| 643 | struct channel_t *ch; | ||
| 644 | struct un_t *un; | ||
| 645 | |||
| 646 | if (!d) | ||
| 647 | return 0; | ||
| 648 | un = dev_get_drvdata(d); | ||
| 649 | if (!un || un->magic != DGNC_UNIT_MAGIC) | ||
| 650 | return 0; | ||
| 651 | ch = un->un_ch; | ||
| 652 | if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) | ||
| 653 | return 0; | ||
| 654 | bd = ch->ch_bd; | ||
| 655 | if (!bd || bd->magic != DGNC_BOARD_MAGIC) | ||
| 656 | return 0; | ||
| 657 | if (bd->state != BOARD_READY) | ||
| 658 | return 0; | ||
| 659 | |||
| 660 | return snprintf(buf, PAGE_SIZE, "%sn%d%c\n", | ||
| 661 | (un->un_type == DGNC_PRINT) ? "pr" : "tty", | ||
| 662 | bd->boardnum + 1, 'a' + ch->ch_portnum); | ||
| 663 | } | ||
| 664 | static DEVICE_ATTR_RO(tty_custom_name); | ||
| 665 | |||
| 666 | static struct attribute *dgnc_sysfs_tty_entries[] = { | ||
| 667 | &dev_attr_tty_state.attr, | ||
| 668 | &dev_attr_tty_baud.attr, | ||
| 669 | &dev_attr_tty_msignals.attr, | ||
| 670 | &dev_attr_tty_iflag.attr, | ||
| 671 | &dev_attr_tty_cflag.attr, | ||
| 672 | &dev_attr_tty_oflag.attr, | ||
| 673 | &dev_attr_tty_lflag.attr, | ||
| 674 | &dev_attr_tty_digi_flag.attr, | ||
| 675 | &dev_attr_tty_rxcount.attr, | ||
| 676 | &dev_attr_tty_txcount.attr, | ||
| 677 | &dev_attr_tty_custom_name.attr, | ||
| 678 | NULL | ||
| 679 | }; | ||
| 680 | |||
| 681 | static const struct attribute_group dgnc_tty_attribute_group = { | ||
| 682 | .name = NULL, | ||
| 683 | .attrs = dgnc_sysfs_tty_entries, | ||
| 684 | }; | ||
| 685 | |||
| 686 | void dgnc_create_tty_sysfs(struct un_t *un, struct device *c) | ||
| 687 | { | ||
| 688 | int ret; | ||
| 689 | |||
| 690 | ret = sysfs_create_group(&c->kobj, &dgnc_tty_attribute_group); | ||
| 691 | if (ret) { | ||
| 692 | dev_err(c, "dgnc: failed to create sysfs tty device attributes.\n"); | ||
| 693 | sysfs_remove_group(&c->kobj, &dgnc_tty_attribute_group); | ||
| 694 | return; | ||
| 695 | } | ||
| 696 | |||
| 697 | dev_set_drvdata(c, un); | ||
| 698 | } | ||
| 699 | |||
| 700 | void dgnc_remove_tty_sysfs(struct device *c) | ||
| 701 | { | ||
| 702 | sysfs_remove_group(&c->kobj, &dgnc_tty_attribute_group); | ||
| 703 | } | ||
diff --git a/drivers/staging/dgnc/dgnc_sysfs.h b/drivers/staging/dgnc/dgnc_sysfs.h deleted file mode 100644 index 7be7d55bc49e..000000000000 --- a/drivers/staging/dgnc/dgnc_sysfs.h +++ /dev/null | |||
| @@ -1,40 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2003 Digi International (www.digi.com) | ||
| 3 | * Scott H Kilau <Scott_Kilau at digi dot com> | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 8 | * any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the | ||
| 12 | * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
| 13 | * PURPOSE. See the GNU General Public License for more details. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef __DGNC_SYSFS_H | ||
| 17 | #define __DGNC_SYSFS_H | ||
| 18 | |||
| 19 | #include <linux/device.h> | ||
| 20 | #include "dgnc_driver.h" | ||
| 21 | |||
| 22 | struct dgnc_board; | ||
| 23 | struct channel_t; | ||
| 24 | struct un_t; | ||
| 25 | struct pci_driver; | ||
| 26 | struct class_device; | ||
| 27 | |||
| 28 | void dgnc_create_ports_sysfiles(struct dgnc_board *bd); | ||
| 29 | void dgnc_remove_ports_sysfiles(struct dgnc_board *bd); | ||
| 30 | |||
| 31 | void dgnc_create_driver_sysfiles(struct pci_driver *); | ||
| 32 | void dgnc_remove_driver_sysfiles(struct pci_driver *); | ||
| 33 | |||
| 34 | int dgnc_tty_class_init(void); | ||
| 35 | int dgnc_tty_class_destroy(void); | ||
| 36 | |||
| 37 | void dgnc_create_tty_sysfs(struct un_t *un, struct device *c); | ||
| 38 | void dgnc_remove_tty_sysfs(struct device *c); | ||
| 39 | |||
| 40 | #endif | ||
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index c181c26f0c1b..af4bc86e7e25 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c | |||
| @@ -35,7 +35,6 @@ | |||
| 35 | #include "dgnc_tty.h" | 35 | #include "dgnc_tty.h" |
| 36 | #include "dgnc_neo.h" | 36 | #include "dgnc_neo.h" |
| 37 | #include "dgnc_cls.h" | 37 | #include "dgnc_cls.h" |
| 38 | #include "dgnc_sysfs.h" | ||
| 39 | #include "dgnc_utils.h" | 38 | #include "dgnc_utils.h" |
| 40 | 39 | ||
| 41 | /* Default transparent print information. */ | 40 | /* Default transparent print information. */ |
| @@ -304,12 +303,10 @@ int dgnc_tty_init(struct dgnc_board *brd) | |||
| 304 | classp = tty_register_device(brd->serial_driver, i, | 303 | classp = tty_register_device(brd->serial_driver, i, |
| 305 | &ch->ch_bd->pdev->dev); | 304 | &ch->ch_bd->pdev->dev); |
| 306 | ch->ch_tun.un_sysfs = classp; | 305 | ch->ch_tun.un_sysfs = classp; |
| 307 | dgnc_create_tty_sysfs(&ch->ch_tun, classp); | ||
| 308 | 306 | ||
| 309 | classp = tty_register_device(brd->print_driver, i, | 307 | classp = tty_register_device(brd->print_driver, i, |
| 310 | &ch->ch_bd->pdev->dev); | 308 | &ch->ch_bd->pdev->dev); |
| 311 | ch->ch_pun.un_sysfs = classp; | 309 | ch->ch_pun.un_sysfs = classp; |
| 312 | dgnc_create_tty_sysfs(&ch->ch_pun, classp); | ||
| 313 | } | 310 | } |
| 314 | } | 311 | } |
| 315 | 312 | ||
| @@ -333,20 +330,14 @@ void dgnc_cleanup_tty(struct dgnc_board *brd) | |||
| 333 | { | 330 | { |
| 334 | int i = 0; | 331 | int i = 0; |
| 335 | 332 | ||
| 336 | for (i = 0; i < brd->nasync; i++) { | 333 | for (i = 0; i < brd->nasync; i++) |
| 337 | if (brd->channels[i]) | ||
| 338 | dgnc_remove_tty_sysfs(brd->channels[i]-> | ||
| 339 | ch_tun.un_sysfs); | ||
| 340 | tty_unregister_device(brd->serial_driver, i); | 334 | tty_unregister_device(brd->serial_driver, i); |
| 341 | } | 335 | |
| 342 | tty_unregister_driver(brd->serial_driver); | 336 | tty_unregister_driver(brd->serial_driver); |
| 343 | 337 | ||
| 344 | for (i = 0; i < brd->nasync; i++) { | 338 | for (i = 0; i < brd->nasync; i++) |
| 345 | if (brd->channels[i]) | ||
| 346 | dgnc_remove_tty_sysfs(brd->channels[i]-> | ||
| 347 | ch_pun.un_sysfs); | ||
| 348 | tty_unregister_device(brd->print_driver, i); | 339 | tty_unregister_device(brd->print_driver, i); |
| 349 | } | 340 | |
| 350 | tty_unregister_driver(brd->print_driver); | 341 | tty_unregister_driver(brd->print_driver); |
| 351 | 342 | ||
| 352 | put_tty_driver(brd->serial_driver); | 343 | put_tty_driver(brd->serial_driver); |
