19 #include <linux/kernel.h>
20 #include <linux/version.h>
21 #include <linux/module.h>
22 #include <linux/ctype.h>
23 #include <linux/string.h>
25 #include <linux/pci.h>
26 #include <linux/kdev_t.h>
29 #define PORTSERVER_DIVIDEND 1843200
30 #define SERIAL_TYPE_NORMAL 1
31 #define SERIAL_TYPE_CALLOUT 2
32 #define SERIAL_TYPE_XPRINT 3
35 static struct class *dgrp_class;
36 static struct device *dgrp_class_nodes_dev;
37 static struct device *dgrp_class_global_settings_dev;
40 static ssize_t dgrp_class_version_show(
struct class *
class,
45 static CLASS_ATTR(driver_version, 0400, dgrp_class_version_show,
NULL);
48 static ssize_t dgrp_class_register_with_sysfs_show(
struct device *
c,
55 dgrp_class_register_with_sysfs_show,
NULL);
71 static DEVICE_ATTR(rawreadok, 0600, dgrp_class_rawreadok_show,
72 dgrp_class_rawreadok_store);
89 static DEVICE_ATTR(pollrate, 0600, dgrp_class_pollrate_show,
90 dgrp_class_pollrate_store);
92 static struct attribute *dgrp_sysfs_global_settings_entries[] = {
93 &dev_attr_pollrate.attr,
94 &dev_attr_rawreadok.attr,
95 &dev_attr_register_with_sysfs.attr,
102 .attrs = dgrp_sysfs_global_settings_entries,
116 MKDEV(0, max_majors + 1),
NULL,
"driver_settings");
119 &dgrp_global_settings_attribute_group);
121 pr_alert(
"%s: failed to create sysfs global settings device attributes.\n",
124 &dgrp_global_settings_attribute_group);
129 MKDEV(0, max_majors + 2),
NULL,
"nodes");
143 &dgrp_global_settings_attribute_group);
184 static DEVICE_ATTR(description_info, 0600, dgrp_node_description_show,
NULL);
205 static DEVICE_ATTR(hw_version_info, 0600, dgrp_node_hw_version_show,
NULL);
245 static DEVICE_ATTR(sw_version_info, 0600, dgrp_node_sw_version_show,
NULL);
248 static struct attribute *dgrp_sysfs_node_entries[] = {
249 &dev_attr_state.attr,
250 &dev_attr_description_info.attr,
251 &dev_attr_hw_version_info.attr,
252 &dev_attr_hw_id_info.attr,
253 &dev_attr_sw_version_info.attr,
260 .attrs = dgrp_sysfs_node_entries,
270 ID_TO_CHAR(nd->
nd_ID, name);
278 &dgrp_node_attribute_group);
281 pr_alert(
"%s: failed to create sysfs node device attributes.\n",
284 &dgrp_node_attribute_group);
297 &dgrp_node_attribute_group);
444 static DEVICE_ATTR(digi_flag_info, 0600, dgrp_tty_digi_flag_show,
NULL);
505 ID_TO_CHAR(nd->
nd_ID, name);
514 static struct attribute *dgrp_sysfs_tty_entries[] = {
515 &dev_attr_state_info.attr,
516 &dev_attr_baud_info.attr,
517 &dev_attr_msignals_info.attr,
518 &dev_attr_iflag_info.attr,
519 &dev_attr_cflag_info.attr,
520 &dev_attr_oflag_info.attr,
521 &dev_attr_digi_flag_info.attr,
522 &dev_attr_rxcount_info.attr,
523 &dev_attr_txcount_info.attr,
524 &dev_attr_custom_name.attr,
531 .attrs = dgrp_sysfs_tty_entries,
541 pr_alert(
"%s: failed to create sysfs tty device attributes.\n",