2 * Copyright 2004 Digi International (www.digi.com)
3 * Scott H Kilau <Scott_Kilau at digi dot com>
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)
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE!
22 * This is shared code between Digi's CVS archive and the
23 * Linux Kernel sources.
24 * Changing the source just for reformatting needlessly breaks
25 * our CVS diff history.
27 * Send any bug fixes/changes to: Eng.Linux at digi dot com.
33 #include <linux/kernel.h>
34 #include <linux/module.h>
35 #include <linux/ctype.h>
36 #include <linux/string.h>
37 #include <linux/serial_reg.h>
38 #include <linux/device.h>
39 #include <linux/pci.h>
40 #include <linux/kdev_t.h>
42 #include "dgnc_driver.h"
43 #include "dgnc_mgmt.h"
46 static ssize_t dgnc_driver_version_show(struct device_driver *ddp, char *buf)
48 return snprintf(buf, PAGE_SIZE, "%s\n", DG_PART);
50 static DRIVER_ATTR(version, S_IRUSR, dgnc_driver_version_show, NULL);
53 static ssize_t dgnc_driver_boards_show(struct device_driver *ddp, char *buf)
55 return snprintf(buf, PAGE_SIZE, "%d\n", dgnc_NumBoards);
57 static DRIVER_ATTR(boards, S_IRUSR, dgnc_driver_boards_show, NULL);
60 static ssize_t dgnc_driver_maxboards_show(struct device_driver *ddp, char *buf)
62 return snprintf(buf, PAGE_SIZE, "%d\n", MAXBOARDS);
64 static DRIVER_ATTR(maxboards, S_IRUSR, dgnc_driver_maxboards_show, NULL);
67 static ssize_t dgnc_driver_pollcounter_show(struct device_driver *ddp, char *buf)
69 return snprintf(buf, PAGE_SIZE, "%ld\n", dgnc_poll_counter);
71 static DRIVER_ATTR(pollcounter, S_IRUSR, dgnc_driver_pollcounter_show, NULL);
74 static ssize_t dgnc_driver_state_show(struct device_driver *ddp, char *buf)
76 return snprintf(buf, PAGE_SIZE, "%s\n", dgnc_driver_state_text[dgnc_driver_state]);
78 static DRIVER_ATTR(state, S_IRUSR, dgnc_driver_state_show, NULL);
81 static ssize_t dgnc_driver_debug_show(struct device_driver *ddp, char *buf)
83 return snprintf(buf, PAGE_SIZE, "0x%x\n", dgnc_debug);
86 static ssize_t dgnc_driver_debug_store(struct device_driver *ddp, const char *buf, size_t count)
88 sscanf(buf, "0x%x\n", &dgnc_debug);
91 static DRIVER_ATTR(debug, (S_IRUSR | S_IWUSR), dgnc_driver_debug_show, dgnc_driver_debug_store);
94 static ssize_t dgnc_driver_rawreadok_show(struct device_driver *ddp, char *buf)
96 return snprintf(buf, PAGE_SIZE, "0x%x\n", dgnc_rawreadok);
99 static ssize_t dgnc_driver_rawreadok_store(struct device_driver *ddp, const char *buf, size_t count)
101 sscanf(buf, "0x%x\n", &dgnc_rawreadok);
104 static DRIVER_ATTR(rawreadok, (S_IRUSR | S_IWUSR), dgnc_driver_rawreadok_show, dgnc_driver_rawreadok_store);
107 static ssize_t dgnc_driver_pollrate_show(struct device_driver *ddp, char *buf)
109 return snprintf(buf, PAGE_SIZE, "%dms\n", dgnc_poll_tick);
112 static ssize_t dgnc_driver_pollrate_store(struct device_driver *ddp, const char *buf, size_t count)
114 sscanf(buf, "%d\n", &dgnc_poll_tick);
117 static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgnc_driver_pollrate_show, dgnc_driver_pollrate_store);
120 void dgnc_create_driver_sysfiles(struct pci_driver *dgnc_driver)
123 struct device_driver *driverfs = &dgnc_driver->driver;
125 rc |= driver_create_file(driverfs, &driver_attr_version);
126 rc |= driver_create_file(driverfs, &driver_attr_boards);
127 rc |= driver_create_file(driverfs, &driver_attr_maxboards);
128 rc |= driver_create_file(driverfs, &driver_attr_debug);
129 rc |= driver_create_file(driverfs, &driver_attr_rawreadok);
130 rc |= driver_create_file(driverfs, &driver_attr_pollrate);
131 rc |= driver_create_file(driverfs, &driver_attr_pollcounter);
132 rc |= driver_create_file(driverfs, &driver_attr_state);
134 printk(KERN_ERR "DGNC: sysfs driver_create_file failed!\n");
139 void dgnc_remove_driver_sysfiles(struct pci_driver *dgnc_driver)
141 struct device_driver *driverfs = &dgnc_driver->driver;
142 driver_remove_file(driverfs, &driver_attr_version);
143 driver_remove_file(driverfs, &driver_attr_boards);
144 driver_remove_file(driverfs, &driver_attr_maxboards);
145 driver_remove_file(driverfs, &driver_attr_debug);
146 driver_remove_file(driverfs, &driver_attr_rawreadok);
147 driver_remove_file(driverfs, &driver_attr_pollrate);
148 driver_remove_file(driverfs, &driver_attr_pollcounter);
149 driver_remove_file(driverfs, &driver_attr_state);
153 #define DGNC_VERIFY_BOARD(p, bd) \
158 bd = dev_get_drvdata(p); \
159 if (!bd || bd->magic != DGNC_BOARD_MAGIC) \
161 if (bd->state != BOARD_READY) \
167 static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr, char *buf)
169 struct dgnc_board *bd;
173 DGNC_VERIFY_BOARD(p, bd);
175 count += sprintf(buf + count, "\n 0 1 2 3 4 5 6 7 8 9 A B C D E F");
176 for (i = 0; i < 0x40 * 2; i++) {
178 count += sprintf(buf + count, "\n%04X ", i * 2);
179 count += sprintf(buf + count, "%02X ", bd->vpd[i]);
181 count += sprintf(buf + count, "\n");
185 static DEVICE_ATTR(vpd, S_IRUSR, dgnc_vpd_show, NULL);
187 static ssize_t dgnc_serial_number_show(struct device *p, struct device_attribute *attr, char *buf)
189 struct dgnc_board *bd;
192 DGNC_VERIFY_BOARD(p, bd);
194 if (bd->serial_num[0] == '\0')
195 count += sprintf(buf + count, "<UNKNOWN>\n");
197 count += sprintf(buf + count, "%s\n", bd->serial_num);
201 static DEVICE_ATTR(serial_number, S_IRUSR, dgnc_serial_number_show, NULL);
204 static ssize_t dgnc_ports_state_show(struct device *p, struct device_attribute *attr, char *buf)
206 struct dgnc_board *bd;
210 DGNC_VERIFY_BOARD(p, bd);
212 for (i = 0; i < bd->nasync; i++) {
213 count += snprintf(buf + count, PAGE_SIZE - count,
214 "%d %s\n", bd->channels[i]->ch_portnum,
215 bd->channels[i]->ch_open_count ? "Open" : "Closed");
219 static DEVICE_ATTR(ports_state, S_IRUSR, dgnc_ports_state_show, NULL);
222 static ssize_t dgnc_ports_baud_show(struct device *p, struct device_attribute *attr, char *buf)
224 struct dgnc_board *bd;
228 DGNC_VERIFY_BOARD(p, bd);
230 for (i = 0; i < bd->nasync; i++) {
231 count += snprintf(buf + count, PAGE_SIZE - count,
232 "%d %d\n", bd->channels[i]->ch_portnum, bd->channels[i]->ch_old_baud);
236 static DEVICE_ATTR(ports_baud, S_IRUSR, dgnc_ports_baud_show, NULL);
239 static ssize_t dgnc_ports_msignals_show(struct device *p, struct device_attribute *attr, char *buf)
241 struct dgnc_board *bd;
245 DGNC_VERIFY_BOARD(p, bd);
247 for (i = 0; i < bd->nasync; i++) {
248 if (bd->channels[i]->ch_open_count) {
249 count += snprintf(buf + count, PAGE_SIZE - count,
250 "%d %s %s %s %s %s %s\n", bd->channels[i]->ch_portnum,
251 (bd->channels[i]->ch_mostat & UART_MCR_RTS) ? "RTS" : "",
252 (bd->channels[i]->ch_mistat & UART_MSR_CTS) ? "CTS" : "",
253 (bd->channels[i]->ch_mostat & UART_MCR_DTR) ? "DTR" : "",
254 (bd->channels[i]->ch_mistat & UART_MSR_DSR) ? "DSR" : "",
255 (bd->channels[i]->ch_mistat & UART_MSR_DCD) ? "DCD" : "",
256 (bd->channels[i]->ch_mistat & UART_MSR_RI) ? "RI" : "");
258 count += snprintf(buf + count, PAGE_SIZE - count,
259 "%d\n", bd->channels[i]->ch_portnum);
264 static DEVICE_ATTR(ports_msignals, S_IRUSR, dgnc_ports_msignals_show, NULL);
267 static ssize_t dgnc_ports_iflag_show(struct device *p, struct device_attribute *attr, char *buf)
269 struct dgnc_board *bd;
273 DGNC_VERIFY_BOARD(p, bd);
275 for (i = 0; i < bd->nasync; i++) {
276 count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
277 bd->channels[i]->ch_portnum, bd->channels[i]->ch_c_iflag);
281 static DEVICE_ATTR(ports_iflag, S_IRUSR, dgnc_ports_iflag_show, NULL);
284 static ssize_t dgnc_ports_cflag_show(struct device *p, struct device_attribute *attr, char *buf)
286 struct dgnc_board *bd;
290 DGNC_VERIFY_BOARD(p, bd);
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, bd->channels[i]->ch_c_cflag);
298 static DEVICE_ATTR(ports_cflag, S_IRUSR, dgnc_ports_cflag_show, NULL);
301 static ssize_t dgnc_ports_oflag_show(struct device *p, struct device_attribute *attr, char *buf)
303 struct dgnc_board *bd;
307 DGNC_VERIFY_BOARD(p, bd);
309 for (i = 0; i < bd->nasync; i++) {
310 count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
311 bd->channels[i]->ch_portnum, bd->channels[i]->ch_c_oflag);
315 static DEVICE_ATTR(ports_oflag, S_IRUSR, dgnc_ports_oflag_show, NULL);
318 static ssize_t dgnc_ports_lflag_show(struct device *p, struct device_attribute *attr, char *buf)
320 struct dgnc_board *bd;
324 DGNC_VERIFY_BOARD(p, bd);
326 for (i = 0; i < bd->nasync; i++) {
327 count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
328 bd->channels[i]->ch_portnum, bd->channels[i]->ch_c_lflag);
332 static DEVICE_ATTR(ports_lflag, S_IRUSR, dgnc_ports_lflag_show, NULL);
335 static ssize_t dgnc_ports_digi_flag_show(struct device *p, struct device_attribute *attr, char *buf)
337 struct dgnc_board *bd;
341 DGNC_VERIFY_BOARD(p, bd);
343 for (i = 0; i < bd->nasync; i++) {
344 count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
345 bd->channels[i]->ch_portnum, bd->channels[i]->ch_digi.digi_flags);
349 static DEVICE_ATTR(ports_digi_flag, S_IRUSR, dgnc_ports_digi_flag_show, NULL);
352 static ssize_t dgnc_ports_rxcount_show(struct device *p, struct device_attribute *attr, char *buf)
354 struct dgnc_board *bd;
358 DGNC_VERIFY_BOARD(p, bd);
360 for (i = 0; i < bd->nasync; i++) {
361 count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n",
362 bd->channels[i]->ch_portnum, bd->channels[i]->ch_rxcount);
366 static DEVICE_ATTR(ports_rxcount, S_IRUSR, dgnc_ports_rxcount_show, NULL);
369 static ssize_t dgnc_ports_txcount_show(struct device *p, struct device_attribute *attr, char *buf)
371 struct dgnc_board *bd;
375 DGNC_VERIFY_BOARD(p, bd);
377 for (i = 0; i < bd->nasync; i++) {
378 count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n",
379 bd->channels[i]->ch_portnum, bd->channels[i]->ch_txcount);
383 static DEVICE_ATTR(ports_txcount, S_IRUSR, dgnc_ports_txcount_show, NULL);
386 /* this function creates the sys files that will export each signal status
387 * to sysfs each value will be put in a separate filename
389 void dgnc_create_ports_sysfiles(struct dgnc_board *bd)
393 dev_set_drvdata(&bd->pdev->dev, bd);
394 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_state);
395 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_baud);
396 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_msignals);
397 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_iflag);
398 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_cflag);
399 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_oflag);
400 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_lflag);
401 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_digi_flag);
402 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_rxcount);
403 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_txcount);
404 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_vpd);
405 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_serial_number);
407 printk(KERN_ERR "DGNC: sysfs device_create_file failed!\n");
412 /* removes all the sys files created for that port */
413 void dgnc_remove_ports_sysfiles(struct dgnc_board *bd)
415 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_state);
416 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_baud);
417 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_msignals);
418 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_iflag);
419 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_cflag);
420 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_oflag);
421 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_lflag);
422 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_digi_flag);
423 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_rxcount);
424 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_txcount);
425 device_remove_file(&(bd->pdev->dev), &dev_attr_vpd);
426 device_remove_file(&(bd->pdev->dev), &dev_attr_serial_number);
430 static ssize_t dgnc_tty_state_show(struct device *d, struct device_attribute *attr, char *buf)
432 struct dgnc_board *bd;
433 struct channel_t *ch;
438 un = dev_get_drvdata(d);
439 if (!un || un->magic != DGNC_UNIT_MAGIC)
442 if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
445 if (!bd || bd->magic != DGNC_BOARD_MAGIC)
447 if (bd->state != BOARD_READY)
450 return snprintf(buf, PAGE_SIZE, "%s", un->un_open_count ? "Open" : "Closed");
452 static DEVICE_ATTR(state, S_IRUSR, dgnc_tty_state_show, NULL);
455 static ssize_t dgnc_tty_baud_show(struct device *d, struct device_attribute *attr, char *buf)
457 struct dgnc_board *bd;
458 struct channel_t *ch;
463 un = dev_get_drvdata(d);
464 if (!un || un->magic != DGNC_UNIT_MAGIC)
467 if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
470 if (!bd || bd->magic != DGNC_BOARD_MAGIC)
472 if (bd->state != BOARD_READY)
475 return snprintf(buf, PAGE_SIZE, "%d\n", ch->ch_old_baud);
477 static DEVICE_ATTR(baud, S_IRUSR, dgnc_tty_baud_show, NULL);
480 static ssize_t dgnc_tty_msignals_show(struct device *d, struct device_attribute *attr, char *buf)
482 struct dgnc_board *bd;
483 struct channel_t *ch;
488 un = dev_get_drvdata(d);
489 if (!un || un->magic != DGNC_UNIT_MAGIC)
492 if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
495 if (!bd || bd->magic != DGNC_BOARD_MAGIC)
497 if (bd->state != BOARD_READY)
500 if (ch->ch_open_count) {
501 return snprintf(buf, PAGE_SIZE, "%s %s %s %s %s %s\n",
502 (ch->ch_mostat & UART_MCR_RTS) ? "RTS" : "",
503 (ch->ch_mistat & UART_MSR_CTS) ? "CTS" : "",
504 (ch->ch_mostat & UART_MCR_DTR) ? "DTR" : "",
505 (ch->ch_mistat & UART_MSR_DSR) ? "DSR" : "",
506 (ch->ch_mistat & UART_MSR_DCD) ? "DCD" : "",
507 (ch->ch_mistat & UART_MSR_RI) ? "RI" : "");
511 static DEVICE_ATTR(msignals, S_IRUSR, dgnc_tty_msignals_show, NULL);
514 static ssize_t dgnc_tty_iflag_show(struct device *d, struct device_attribute *attr, char *buf)
516 struct dgnc_board *bd;
517 struct channel_t *ch;
522 un = dev_get_drvdata(d);
523 if (!un || un->magic != DGNC_UNIT_MAGIC)
526 if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
529 if (!bd || bd->magic != DGNC_BOARD_MAGIC)
531 if (bd->state != BOARD_READY)
534 return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_iflag);
536 static DEVICE_ATTR(iflag, S_IRUSR, dgnc_tty_iflag_show, NULL);
539 static ssize_t dgnc_tty_cflag_show(struct device *d, struct device_attribute *attr, char *buf)
541 struct dgnc_board *bd;
542 struct channel_t *ch;
547 un = dev_get_drvdata(d);
548 if (!un || un->magic != DGNC_UNIT_MAGIC)
551 if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
554 if (!bd || bd->magic != DGNC_BOARD_MAGIC)
556 if (bd->state != BOARD_READY)
559 return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_cflag);
561 static DEVICE_ATTR(cflag, S_IRUSR, dgnc_tty_cflag_show, NULL);
564 static ssize_t dgnc_tty_oflag_show(struct device *d, struct device_attribute *attr, char *buf)
566 struct dgnc_board *bd;
567 struct channel_t *ch;
572 un = dev_get_drvdata(d);
573 if (!un || un->magic != DGNC_UNIT_MAGIC)
576 if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
579 if (!bd || bd->magic != DGNC_BOARD_MAGIC)
581 if (bd->state != BOARD_READY)
584 return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_oflag);
586 static DEVICE_ATTR(oflag, S_IRUSR, dgnc_tty_oflag_show, NULL);
589 static ssize_t dgnc_tty_lflag_show(struct device *d, struct device_attribute *attr, char *buf)
591 struct dgnc_board *bd;
592 struct channel_t *ch;
597 un = dev_get_drvdata(d);
598 if (!un || un->magic != DGNC_UNIT_MAGIC)
601 if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
604 if (!bd || bd->magic != DGNC_BOARD_MAGIC)
606 if (bd->state != BOARD_READY)
609 return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_lflag);
611 static DEVICE_ATTR(lflag, S_IRUSR, dgnc_tty_lflag_show, NULL);
614 static ssize_t dgnc_tty_digi_flag_show(struct device *d, struct device_attribute *attr, char *buf)
616 struct dgnc_board *bd;
617 struct channel_t *ch;
622 un = dev_get_drvdata(d);
623 if (!un || un->magic != DGNC_UNIT_MAGIC)
626 if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
629 if (!bd || bd->magic != DGNC_BOARD_MAGIC)
631 if (bd->state != BOARD_READY)
634 return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_digi.digi_flags);
636 static DEVICE_ATTR(digi_flag, S_IRUSR, dgnc_tty_digi_flag_show, NULL);
639 static ssize_t dgnc_tty_rxcount_show(struct device *d, struct device_attribute *attr, char *buf)
641 struct dgnc_board *bd;
642 struct channel_t *ch;
647 un = dev_get_drvdata(d);
648 if (!un || un->magic != DGNC_UNIT_MAGIC)
651 if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
654 if (!bd || bd->magic != DGNC_BOARD_MAGIC)
656 if (bd->state != BOARD_READY)
659 return snprintf(buf, PAGE_SIZE, "%ld\n", ch->ch_rxcount);
661 static DEVICE_ATTR(rxcount, S_IRUSR, dgnc_tty_rxcount_show, NULL);
664 static ssize_t dgnc_tty_txcount_show(struct device *d, struct device_attribute *attr, char *buf)
666 struct dgnc_board *bd;
667 struct channel_t *ch;
672 un = dev_get_drvdata(d);
673 if (!un || un->magic != DGNC_UNIT_MAGIC)
676 if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
679 if (!bd || bd->magic != DGNC_BOARD_MAGIC)
681 if (bd->state != BOARD_READY)
684 return snprintf(buf, PAGE_SIZE, "%ld\n", ch->ch_txcount);
686 static DEVICE_ATTR(txcount, S_IRUSR, dgnc_tty_txcount_show, NULL);
689 static ssize_t dgnc_tty_name_show(struct device *d, struct device_attribute *attr, char *buf)
691 struct dgnc_board *bd;
692 struct channel_t *ch;
697 un = dev_get_drvdata(d);
698 if (!un || un->magic != DGNC_UNIT_MAGIC)
701 if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
704 if (!bd || bd->magic != DGNC_BOARD_MAGIC)
706 if (bd->state != BOARD_READY)
709 return snprintf(buf, PAGE_SIZE, "%sn%d%c\n",
710 (un->un_type == DGNC_PRINT) ? "pr" : "tty",
711 bd->boardnum + 1, 'a' + ch->ch_portnum);
713 static DEVICE_ATTR(custom_name, S_IRUSR, dgnc_tty_name_show, NULL);
716 static struct attribute *dgnc_sysfs_tty_entries[] = {
717 &dev_attr_state.attr,
719 &dev_attr_msignals.attr,
720 &dev_attr_iflag.attr,
721 &dev_attr_cflag.attr,
722 &dev_attr_oflag.attr,
723 &dev_attr_lflag.attr,
724 &dev_attr_digi_flag.attr,
725 &dev_attr_rxcount.attr,
726 &dev_attr_txcount.attr,
727 &dev_attr_custom_name.attr,
732 static struct attribute_group dgnc_tty_attribute_group = {
734 .attrs = dgnc_sysfs_tty_entries,
738 void dgnc_create_tty_sysfs(struct un_t *un, struct device *c)
742 ret = sysfs_create_group(&c->kobj, &dgnc_tty_attribute_group);
744 dev_err(c, "dgnc: failed to create sysfs tty device attributes.\n");
745 sysfs_remove_group(&c->kobj, &dgnc_tty_attribute_group);
749 dev_set_drvdata(c, un);
754 void dgnc_remove_tty_sysfs(struct device *c)
756 sysfs_remove_group(&c->kobj, &dgnc_tty_attribute_group);