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.
32 * $Id: dgap_sysfs.c,v 1.1 2009/10/23 14:01:57 markh Exp $
36 #include <linux/kernel.h>
37 #include <linux/version.h>
38 #include <linux/module.h>
39 #include <linux/ctype.h>
40 #include <linux/string.h>
41 #include <linux/serial_reg.h>
42 #include <linux/device.h>
43 #include <linux/pci.h>
44 #include <linux/kdev_t.h>
46 #include "dgap_driver.h"
47 #include "dgap_proc.h"
48 #include "dgap_mgmt.h"
49 #include "dgap_conf.h"
50 #include "dgap_parse.h"
53 static ssize_t dgap_driver_version_show(struct device_driver *ddp, char *buf)
55 return snprintf(buf, PAGE_SIZE, "%s\n", DG_PART);
57 static DRIVER_ATTR(version, S_IRUSR, dgap_driver_version_show, NULL);
60 static ssize_t dgap_driver_boards_show(struct device_driver *ddp, char *buf)
62 return snprintf(buf, PAGE_SIZE, "%d\n", dgap_NumBoards);
64 static DRIVER_ATTR(boards, S_IRUSR, dgap_driver_boards_show, NULL);
67 static ssize_t dgap_driver_maxboards_show(struct device_driver *ddp, char *buf)
69 return snprintf(buf, PAGE_SIZE, "%d\n", MAXBOARDS);
71 static DRIVER_ATTR(maxboards, S_IRUSR, dgap_driver_maxboards_show, NULL);
74 static ssize_t dgap_driver_pollcounter_show(struct device_driver *ddp, char *buf)
76 return snprintf(buf, PAGE_SIZE, "%ld\n", dgap_poll_counter);
78 static DRIVER_ATTR(pollcounter, S_IRUSR, dgap_driver_pollcounter_show, NULL);
81 static ssize_t dgap_driver_state_show(struct device_driver *ddp, char *buf)
83 return snprintf(buf, PAGE_SIZE, "%s\n", dgap_driver_state_text[dgap_driver_state]);
85 static DRIVER_ATTR(state, S_IRUSR, dgap_driver_state_show, NULL);
88 static ssize_t dgap_driver_debug_show(struct device_driver *ddp, char *buf)
90 return snprintf(buf, PAGE_SIZE, "0x%x\n", dgap_debug);
93 static ssize_t dgap_driver_debug_store(struct device_driver *ddp, const char *buf, size_t count)
95 sscanf(buf, "0x%x\n", &dgap_debug);
98 static DRIVER_ATTR(debug, (S_IRUSR | S_IWUSR), dgap_driver_debug_show, dgap_driver_debug_store);
101 static ssize_t dgap_driver_rawreadok_show(struct device_driver *ddp, char *buf)
103 return snprintf(buf, PAGE_SIZE, "0x%x\n", dgap_rawreadok);
106 static ssize_t dgap_driver_rawreadok_store(struct device_driver *ddp, const char *buf, size_t count)
108 sscanf(buf, "0x%x\n", &dgap_rawreadok);
111 static DRIVER_ATTR(rawreadok, (S_IRUSR | S_IWUSR), dgap_driver_rawreadok_show, dgap_driver_rawreadok_store);
114 static ssize_t dgap_driver_pollrate_show(struct device_driver *ddp, char *buf)
116 return snprintf(buf, PAGE_SIZE, "%dms\n", dgap_poll_tick);
119 static ssize_t dgap_driver_pollrate_store(struct device_driver *ddp, const char *buf, size_t count)
121 sscanf(buf, "%d\n", &dgap_poll_tick);
124 static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgap_driver_pollrate_show, dgap_driver_pollrate_store);
127 void dgap_create_driver_sysfiles(struct pci_driver *dgap_driver)
130 struct device_driver *driverfs = &dgap_driver->driver;
132 rc |= driver_create_file(driverfs, &driver_attr_version);
133 rc |= driver_create_file(driverfs, &driver_attr_boards);
134 rc |= driver_create_file(driverfs, &driver_attr_maxboards);
135 rc |= driver_create_file(driverfs, &driver_attr_debug);
136 rc |= driver_create_file(driverfs, &driver_attr_rawreadok);
137 rc |= driver_create_file(driverfs, &driver_attr_pollrate);
138 rc |= driver_create_file(driverfs, &driver_attr_pollcounter);
139 rc |= driver_create_file(driverfs, &driver_attr_state);
141 printk(KERN_ERR "DGAP: sysfs driver_create_file failed!\n");
146 void dgap_remove_driver_sysfiles(struct pci_driver *dgap_driver)
148 struct device_driver *driverfs = &dgap_driver->driver;
149 driver_remove_file(driverfs, &driver_attr_version);
150 driver_remove_file(driverfs, &driver_attr_boards);
151 driver_remove_file(driverfs, &driver_attr_maxboards);
152 driver_remove_file(driverfs, &driver_attr_debug);
153 driver_remove_file(driverfs, &driver_attr_rawreadok);
154 driver_remove_file(driverfs, &driver_attr_pollrate);
155 driver_remove_file(driverfs, &driver_attr_pollcounter);
156 driver_remove_file(driverfs, &driver_attr_state);
160 #define DGAP_VERIFY_BOARD(p, bd) \
164 bd = dev_get_drvdata(p); \
165 if (!bd || bd->magic != DGAP_BOARD_MAGIC) \
167 if (bd->state != BOARD_READY) \
171 static ssize_t dgap_ports_state_show(struct device *p, struct device_attribute *attr, char *buf)
177 DGAP_VERIFY_BOARD(p, bd);
179 for (i = 0; i < bd->nasync; i++) {
180 count += snprintf(buf + count, PAGE_SIZE - count,
181 "%d %s\n", bd->channels[i]->ch_portnum,
182 bd->channels[i]->ch_open_count ? "Open" : "Closed");
186 static DEVICE_ATTR(ports_state, S_IRUSR, dgap_ports_state_show, NULL);
189 static ssize_t dgap_ports_baud_show(struct device *p, struct device_attribute *attr, char *buf)
195 DGAP_VERIFY_BOARD(p, bd);
197 for (i = 0; i < bd->nasync; i++) {
198 count += snprintf(buf + count, PAGE_SIZE - count,
199 "%d %d\n", bd->channels[i]->ch_portnum, bd->channels[i]->ch_baud_info);
203 static DEVICE_ATTR(ports_baud, S_IRUSR, dgap_ports_baud_show, NULL);
206 static ssize_t dgap_ports_msignals_show(struct device *p, struct device_attribute *attr, char *buf)
212 DGAP_VERIFY_BOARD(p, bd);
214 for (i = 0; i < bd->nasync; i++) {
215 if (bd->channels[i]->ch_open_count) {
216 count += snprintf(buf + count, PAGE_SIZE - count,
217 "%d %s %s %s %s %s %s\n", bd->channels[i]->ch_portnum,
218 (bd->channels[i]->ch_mostat & UART_MCR_RTS) ? "RTS" : "",
219 (bd->channels[i]->ch_mistat & UART_MSR_CTS) ? "CTS" : "",
220 (bd->channels[i]->ch_mostat & UART_MCR_DTR) ? "DTR" : "",
221 (bd->channels[i]->ch_mistat & UART_MSR_DSR) ? "DSR" : "",
222 (bd->channels[i]->ch_mistat & UART_MSR_DCD) ? "DCD" : "",
223 (bd->channels[i]->ch_mistat & UART_MSR_RI) ? "RI" : "");
225 count += snprintf(buf + count, PAGE_SIZE - count,
226 "%d\n", bd->channels[i]->ch_portnum);
231 static DEVICE_ATTR(ports_msignals, S_IRUSR, dgap_ports_msignals_show, NULL);
234 static ssize_t dgap_ports_iflag_show(struct device *p, struct device_attribute *attr, char *buf)
240 DGAP_VERIFY_BOARD(p, bd);
242 for (i = 0; i < bd->nasync; i++) {
243 count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
244 bd->channels[i]->ch_portnum, bd->channels[i]->ch_c_iflag);
248 static DEVICE_ATTR(ports_iflag, S_IRUSR, dgap_ports_iflag_show, NULL);
251 static ssize_t dgap_ports_cflag_show(struct device *p, struct device_attribute *attr, char *buf)
257 DGAP_VERIFY_BOARD(p, bd);
259 for (i = 0; i < bd->nasync; i++) {
260 count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
261 bd->channels[i]->ch_portnum, bd->channels[i]->ch_c_cflag);
265 static DEVICE_ATTR(ports_cflag, S_IRUSR, dgap_ports_cflag_show, NULL);
268 static ssize_t dgap_ports_oflag_show(struct device *p, struct device_attribute *attr, char *buf)
274 DGAP_VERIFY_BOARD(p, bd);
276 for (i = 0; i < bd->nasync; i++) {
277 count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
278 bd->channels[i]->ch_portnum, bd->channels[i]->ch_c_oflag);
282 static DEVICE_ATTR(ports_oflag, S_IRUSR, dgap_ports_oflag_show, NULL);
285 static ssize_t dgap_ports_lflag_show(struct device *p, struct device_attribute *attr, char *buf)
291 DGAP_VERIFY_BOARD(p, bd);
293 for (i = 0; i < bd->nasync; i++) {
294 count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
295 bd->channels[i]->ch_portnum, bd->channels[i]->ch_c_lflag);
299 static DEVICE_ATTR(ports_lflag, S_IRUSR, dgap_ports_lflag_show, NULL);
302 static ssize_t dgap_ports_digi_flag_show(struct device *p, struct device_attribute *attr, char *buf)
308 DGAP_VERIFY_BOARD(p, bd);
310 for (i = 0; i < bd->nasync; i++) {
311 count += snprintf(buf + count, PAGE_SIZE - count, "%d %x\n",
312 bd->channels[i]->ch_portnum, bd->channels[i]->ch_digi.digi_flags);
316 static DEVICE_ATTR(ports_digi_flag, S_IRUSR, dgap_ports_digi_flag_show, NULL);
319 static ssize_t dgap_ports_rxcount_show(struct device *p, struct device_attribute *attr, char *buf)
325 DGAP_VERIFY_BOARD(p, bd);
327 for (i = 0; i < bd->nasync; i++) {
328 count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n",
329 bd->channels[i]->ch_portnum, bd->channels[i]->ch_rxcount);
333 static DEVICE_ATTR(ports_rxcount, S_IRUSR, dgap_ports_rxcount_show, NULL);
336 static ssize_t dgap_ports_txcount_show(struct device *p, struct device_attribute *attr, char *buf)
342 DGAP_VERIFY_BOARD(p, bd);
344 for (i = 0; i < bd->nasync; i++) {
345 count += snprintf(buf + count, PAGE_SIZE - count, "%d %ld\n",
346 bd->channels[i]->ch_portnum, bd->channels[i]->ch_txcount);
350 static DEVICE_ATTR(ports_txcount, S_IRUSR, dgap_ports_txcount_show, NULL);
353 /* this function creates the sys files that will export each signal status
354 * to sysfs each value will be put in a separate filename
356 void dgap_create_ports_sysfiles(struct board_t *bd)
360 dev_set_drvdata(&bd->pdev->dev, bd);
361 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_state);
362 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_baud);
363 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_msignals);
364 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_iflag);
365 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_cflag);
366 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_oflag);
367 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_lflag);
368 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_digi_flag);
369 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_rxcount);
370 rc |= device_create_file(&(bd->pdev->dev), &dev_attr_ports_txcount);
372 printk(KERN_ERR "DGAP: sysfs device_create_file failed!\n");
377 /* removes all the sys files created for that port */
378 void dgap_remove_ports_sysfiles(struct board_t *bd)
380 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_state);
381 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_baud);
382 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_msignals);
383 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_iflag);
384 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_cflag);
385 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_oflag);
386 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_lflag);
387 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_digi_flag);
388 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_rxcount);
389 device_remove_file(&(bd->pdev->dev), &dev_attr_ports_txcount);
393 static ssize_t dgap_tty_state_show(struct device *d, struct device_attribute *attr, char *buf)
396 struct channel_t *ch;
401 un = (struct un_t *) dev_get_drvdata(d);
402 if (!un || un->magic != DGAP_UNIT_MAGIC)
405 if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
408 if (!bd || bd->magic != DGAP_BOARD_MAGIC)
410 if (bd->state != BOARD_READY)
413 return snprintf(buf, PAGE_SIZE, "%s", un->un_open_count ? "Open" : "Closed");
415 static DEVICE_ATTR(state, S_IRUSR, dgap_tty_state_show, NULL);
418 static ssize_t dgap_tty_baud_show(struct device *d, struct device_attribute *attr, char *buf)
421 struct channel_t *ch;
426 un = (struct un_t *) dev_get_drvdata(d);
427 if (!un || un->magic != DGAP_UNIT_MAGIC)
430 if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
433 if (!bd || bd->magic != DGAP_BOARD_MAGIC)
435 if (bd->state != BOARD_READY)
438 return snprintf(buf, PAGE_SIZE, "%d\n", ch->ch_baud_info);
440 static DEVICE_ATTR(baud, S_IRUSR, dgap_tty_baud_show, NULL);
443 static ssize_t dgap_tty_msignals_show(struct device *d, struct device_attribute *attr, char *buf)
446 struct channel_t *ch;
451 un = (struct un_t *) dev_get_drvdata(d);
452 if (!un || un->magic != DGAP_UNIT_MAGIC)
455 if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
458 if (!bd || bd->magic != DGAP_BOARD_MAGIC)
460 if (bd->state != BOARD_READY)
463 if (ch->ch_open_count) {
464 return snprintf(buf, PAGE_SIZE, "%s %s %s %s %s %s\n",
465 (ch->ch_mostat & UART_MCR_RTS) ? "RTS" : "",
466 (ch->ch_mistat & UART_MSR_CTS) ? "CTS" : "",
467 (ch->ch_mostat & UART_MCR_DTR) ? "DTR" : "",
468 (ch->ch_mistat & UART_MSR_DSR) ? "DSR" : "",
469 (ch->ch_mistat & UART_MSR_DCD) ? "DCD" : "",
470 (ch->ch_mistat & UART_MSR_RI) ? "RI" : "");
474 static DEVICE_ATTR(msignals, S_IRUSR, dgap_tty_msignals_show, NULL);
477 static ssize_t dgap_tty_iflag_show(struct device *d, struct device_attribute *attr, char *buf)
480 struct channel_t *ch;
485 un = (struct un_t *) dev_get_drvdata(d);
486 if (!un || un->magic != DGAP_UNIT_MAGIC)
489 if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
492 if (!bd || bd->magic != DGAP_BOARD_MAGIC)
494 if (bd->state != BOARD_READY)
497 return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_iflag);
499 static DEVICE_ATTR(iflag, S_IRUSR, dgap_tty_iflag_show, NULL);
502 static ssize_t dgap_tty_cflag_show(struct device *d, struct device_attribute *attr, char *buf)
505 struct channel_t *ch;
510 un = (struct un_t *) dev_get_drvdata(d);
511 if (!un || un->magic != DGAP_UNIT_MAGIC)
514 if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
517 if (!bd || bd->magic != DGAP_BOARD_MAGIC)
519 if (bd->state != BOARD_READY)
522 return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_cflag);
524 static DEVICE_ATTR(cflag, S_IRUSR, dgap_tty_cflag_show, NULL);
527 static ssize_t dgap_tty_oflag_show(struct device *d, struct device_attribute *attr, char *buf)
530 struct channel_t *ch;
535 un = (struct un_t *) dev_get_drvdata(d);
536 if (!un || un->magic != DGAP_UNIT_MAGIC)
539 if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
542 if (!bd || bd->magic != DGAP_BOARD_MAGIC)
544 if (bd->state != BOARD_READY)
547 return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_oflag);
549 static DEVICE_ATTR(oflag, S_IRUSR, dgap_tty_oflag_show, NULL);
552 static ssize_t dgap_tty_lflag_show(struct device *d, struct device_attribute *attr, char *buf)
555 struct channel_t *ch;
560 un = (struct un_t *) dev_get_drvdata(d);
561 if (!un || un->magic != DGAP_UNIT_MAGIC)
564 if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
567 if (!bd || bd->magic != DGAP_BOARD_MAGIC)
569 if (bd->state != BOARD_READY)
572 return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_lflag);
574 static DEVICE_ATTR(lflag, S_IRUSR, dgap_tty_lflag_show, NULL);
577 static ssize_t dgap_tty_digi_flag_show(struct device *d, struct device_attribute *attr, char *buf)
580 struct channel_t *ch;
585 un = (struct un_t *) dev_get_drvdata(d);
586 if (!un || un->magic != DGAP_UNIT_MAGIC)
589 if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
592 if (!bd || bd->magic != DGAP_BOARD_MAGIC)
594 if (bd->state != BOARD_READY)
597 return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_digi.digi_flags);
599 static DEVICE_ATTR(digi_flag, S_IRUSR, dgap_tty_digi_flag_show, NULL);
602 static ssize_t dgap_tty_rxcount_show(struct device *d, struct device_attribute *attr, char *buf)
605 struct channel_t *ch;
610 un = (struct un_t *) dev_get_drvdata(d);
611 if (!un || un->magic != DGAP_UNIT_MAGIC)
614 if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
617 if (!bd || bd->magic != DGAP_BOARD_MAGIC)
619 if (bd->state != BOARD_READY)
622 return snprintf(buf, PAGE_SIZE, "%ld\n", ch->ch_rxcount);
624 static DEVICE_ATTR(rxcount, S_IRUSR, dgap_tty_rxcount_show, NULL);
627 static ssize_t dgap_tty_txcount_show(struct device *d, struct device_attribute *attr, char *buf)
630 struct channel_t *ch;
635 un = (struct un_t *) dev_get_drvdata(d);
636 if (!un || un->magic != DGAP_UNIT_MAGIC)
639 if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
642 if (!bd || bd->magic != DGAP_BOARD_MAGIC)
644 if (bd->state != BOARD_READY)
647 return snprintf(buf, PAGE_SIZE, "%ld\n", ch->ch_txcount);
649 static DEVICE_ATTR(txcount, S_IRUSR, dgap_tty_txcount_show, NULL);
652 static ssize_t dgap_tty_name_show(struct device *d, struct device_attribute *attr, char *buf)
655 struct channel_t *ch;
659 struct cnode *cptr = NULL;
667 un = (struct un_t *) dev_get_drvdata(d);
668 if (!un || un->magic != DGAP_UNIT_MAGIC)
671 if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
674 if (!bd || bd->magic != DGAP_BOARD_MAGIC)
676 if (bd->state != BOARD_READY)
682 for (cptr = bd->bd_config; cptr; cptr = cptr->next) {
684 if ((cptr->type == BNODE) &&
685 ((cptr->u.board.type == APORT2_920P) || (cptr->u.board.type == APORT4_920P) ||
686 (cptr->u.board.type == APORT8_920P) || (cptr->u.board.type == PAPORT4) ||
687 (cptr->u.board.type == PAPORT8))) {
690 if (cptr->u.board.v_start)
691 starto = cptr->u.board.start;
696 if (cptr->type == TNODE && found == TRUE) {
698 if (strstr(cptr->u.ttyname, "tty")) {
699 ptr1 = cptr->u.ttyname;
703 ptr1 = cptr->u.ttyname;
706 for (i = 0; i < dgap_config_get_number_of_ports(bd); i++) {
708 return snprintf(buf, PAGE_SIZE, "%s%s%02d\n",
709 (un->un_type == DGAP_PRINT) ? "pr" : "tty",
715 if (cptr->type == CNODE) {
717 for (i = 0; i < cptr->u.conc.nport; i++) {
718 if (cn == (i + ncount)) {
720 return snprintf(buf, PAGE_SIZE, "%s%s%02d\n",
721 (un->un_type == DGAP_PRINT) ? "pr" : "tty",
723 i + (cptr->u.conc.v_start ? cptr->u.conc.start : 1));
727 ncount += cptr->u.conc.nport;
730 if (cptr->type == MNODE) {
732 for (i = 0; i < cptr->u.module.nport; i++) {
733 if (cn == (i + ncount)) {
734 return snprintf(buf, PAGE_SIZE, "%s%s%02d\n",
735 (un->un_type == DGAP_PRINT) ? "pr" : "tty",
737 i + (cptr->u.module.v_start ? cptr->u.module.start : 1));
741 ncount += cptr->u.module.nport;
746 return snprintf(buf, PAGE_SIZE, "%s_dgap_%d_%d\n",
747 (un->un_type == DGAP_PRINT) ? "pr" : "tty", bn, cn);
750 static DEVICE_ATTR(custom_name, S_IRUSR, dgap_tty_name_show, NULL);
753 static struct attribute *dgap_sysfs_tty_entries[] = {
754 &dev_attr_state.attr,
756 &dev_attr_msignals.attr,
757 &dev_attr_iflag.attr,
758 &dev_attr_cflag.attr,
759 &dev_attr_oflag.attr,
760 &dev_attr_lflag.attr,
761 &dev_attr_digi_flag.attr,
762 &dev_attr_rxcount.attr,
763 &dev_attr_txcount.attr,
764 &dev_attr_custom_name.attr,
769 static struct attribute_group dgap_tty_attribute_group = {
771 .attrs = dgap_sysfs_tty_entries,
777 void dgap_create_tty_sysfs(struct un_t *un, struct device *c)
781 ret = sysfs_create_group(&c->kobj, &dgap_tty_attribute_group);
783 printk(KERN_ERR "dgap: failed to create sysfs tty device attributes.\n");
784 sysfs_remove_group(&c->kobj, &dgap_tty_attribute_group);
788 dev_set_drvdata(c, un);
793 void dgap_remove_tty_sysfs(struct device *c)
795 sysfs_remove_group(&c->kobj, &dgap_tty_attribute_group);