aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/nozomi.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@computergmbh.de>2008-02-01 03:13:53 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-02 18:14:48 -0500
commit71e1b4abdc39b61e4cb73ef74df68ab397e25378 (patch)
tree5f8fd72e6fef011a570a6c5bfdb387646a6a5cbc /drivers/char/nozomi.c
parente9ed537a3ab0b066eaa4d042c0547d7034f3181b (diff)
nozomi: constify driver
nozomi: constify structures and annotate vars Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de> Signed-off-by: Frank Seidel <fseidel@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char/nozomi.c')
-rw-r--r--drivers/char/nozomi.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
index 86ded7ed4500..7979eb13d94a 100644
--- a/drivers/char/nozomi.c
+++ b/drivers/char/nozomi.c
@@ -395,7 +395,7 @@ struct buffer {
395} __attribute__ ((packed)); 395} __attribute__ ((packed));
396 396
397/* Global variables */ 397/* Global variables */
398static struct pci_device_id nozomi_pci_tbl[] = { 398static struct pci_device_id nozomi_pci_tbl[] __devinitdata = {
399 {PCI_DEVICE(VENDOR1, DEVICE1)}, 399 {PCI_DEVICE(VENDOR1, DEVICE1)},
400 {}, 400 {},
401}; 401};
@@ -471,12 +471,12 @@ out:
471 * -Optimize 471 * -Optimize
472 * -Rewrite cleaner 472 * -Rewrite cleaner
473 */ 473 */
474static u32 write_mem32(void __iomem *mem_addr_start, u32 *buf, 474static u32 write_mem32(void __iomem *mem_addr_start, const u32 *buf,
475 u32 size_bytes) 475 u32 size_bytes)
476{ 476{
477 u32 i = 0; 477 u32 i = 0;
478 u32 *ptr = (__force u32 *) mem_addr_start; 478 u32 *ptr = (__force u32 *) mem_addr_start;
479 u16 *buf16; 479 const u16 *buf16;
480 480
481 if (unlikely(!ptr || !buf)) 481 if (unlikely(!ptr || !buf))
482 return 0; 482 return 0;
@@ -484,7 +484,7 @@ static u32 write_mem32(void __iomem *mem_addr_start, u32 *buf,
484 /* shortcut for extremely often used cases */ 484 /* shortcut for extremely often used cases */
485 switch (size_bytes) { 485 switch (size_bytes) {
486 case 2: /* 2 bytes */ 486 case 2: /* 2 bytes */
487 buf16 = (u16 *) buf; 487 buf16 = (const u16 *)buf;
488 writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); 488 writew(__cpu_to_le16(*buf16), (void __iomem *)ptr);
489 return 2; 489 return 2;
490 break; 490 break;
@@ -501,7 +501,7 @@ static u32 write_mem32(void __iomem *mem_addr_start, u32 *buf,
501 while (i < size_bytes) { 501 while (i < size_bytes) {
502 if (size_bytes - i == 2) { 502 if (size_bytes - i == 2) {
503 /* 2 bytes */ 503 /* 2 bytes */
504 buf16 = (u16 *) buf; 504 buf16 = (const u16 *)buf;
505 writew(__cpu_to_le16(*buf16), (void __iomem *)ptr); 505 writew(__cpu_to_le16(*buf16), (void __iomem *)ptr);
506 i += 2; 506 i += 2;
507 } else { 507 } else {
@@ -723,8 +723,7 @@ static int nozomi_read_config_table(struct nozomi *dc)
723/* Enable uplink interrupts */ 723/* Enable uplink interrupts */
724static void enable_transmit_ul(enum port_type port, struct nozomi *dc) 724static void enable_transmit_ul(enum port_type port, struct nozomi *dc)
725{ 725{
726 u16 mask[NOZOMI_MAX_PORTS] = \ 726 static const u16 mask[] = {MDM_UL, DIAG_UL, APP1_UL, APP2_UL, CTRL_UL};
727 {MDM_UL, DIAG_UL, APP1_UL, APP2_UL, CTRL_UL};
728 727
729 if (port < NOZOMI_MAX_PORTS) { 728 if (port < NOZOMI_MAX_PORTS) {
730 dc->last_ier |= mask[port]; 729 dc->last_ier |= mask[port];
@@ -737,8 +736,8 @@ static void enable_transmit_ul(enum port_type port, struct nozomi *dc)
737/* Disable uplink interrupts */ 736/* Disable uplink interrupts */
738static void disable_transmit_ul(enum port_type port, struct nozomi *dc) 737static void disable_transmit_ul(enum port_type port, struct nozomi *dc)
739{ 738{
740 u16 mask[NOZOMI_MAX_PORTS] = \ 739 static const u16 mask[] =
741 {~MDM_UL, ~DIAG_UL, ~APP1_UL, ~APP2_UL, ~CTRL_UL}; 740 {~MDM_UL, ~DIAG_UL, ~APP1_UL, ~APP2_UL, ~CTRL_UL};
742 741
743 if (port < NOZOMI_MAX_PORTS) { 742 if (port < NOZOMI_MAX_PORTS) {
744 dc->last_ier &= mask[port]; 743 dc->last_ier &= mask[port];
@@ -751,8 +750,7 @@ static void disable_transmit_ul(enum port_type port, struct nozomi *dc)
751/* Enable downlink interrupts */ 750/* Enable downlink interrupts */
752static void enable_transmit_dl(enum port_type port, struct nozomi *dc) 751static void enable_transmit_dl(enum port_type port, struct nozomi *dc)
753{ 752{
754 u16 mask[NOZOMI_MAX_PORTS] = \ 753 static const u16 mask[] = {MDM_DL, DIAG_DL, APP1_DL, APP2_DL, CTRL_DL};
755 {MDM_DL, DIAG_DL, APP1_DL, APP2_DL, CTRL_DL};
756 754
757 if (port < NOZOMI_MAX_PORTS) { 755 if (port < NOZOMI_MAX_PORTS) {
758 dc->last_ier |= mask[port]; 756 dc->last_ier |= mask[port];
@@ -765,8 +763,8 @@ static void enable_transmit_dl(enum port_type port, struct nozomi *dc)
765/* Disable downlink interrupts */ 763/* Disable downlink interrupts */
766static void disable_transmit_dl(enum port_type port, struct nozomi *dc) 764static void disable_transmit_dl(enum port_type port, struct nozomi *dc)
767{ 765{
768 u16 mask[NOZOMI_MAX_PORTS] = \ 766 static const u16 mask[] =
769 {~MDM_DL, ~DIAG_DL, ~APP1_DL, ~APP2_DL, ~CTRL_DL}; 767 {~MDM_DL, ~DIAG_DL, ~APP1_DL, ~APP2_DL, ~CTRL_DL};
770 768
771 if (port < NOZOMI_MAX_PORTS) { 769 if (port < NOZOMI_MAX_PORTS) {
772 dc->last_ier &= mask[port]; 770 dc->last_ier &= mask[port];
@@ -783,7 +781,7 @@ static void disable_transmit_dl(enum port_type port, struct nozomi *dc)
783static int send_data(enum port_type index, struct nozomi *dc) 781static int send_data(enum port_type index, struct nozomi *dc)
784{ 782{
785 u32 size = 0; 783 u32 size = 0;
786 struct port *port = &dc->port[index]; 784 const struct port *port = &dc->port[index];
787 u8 toggle = port->toggle_ul; 785 u8 toggle = port->toggle_ul;
788 void __iomem *addr = port->ul_addr[toggle]; 786 void __iomem *addr = port->ul_addr[toggle];
789 u32 ul_size = port->ul_size[toggle]; 787 u32 ul_size = port->ul_size[toggle];
@@ -1306,7 +1304,7 @@ static void nozomi_setup_private_data(struct nozomi *dc)
1306static ssize_t card_type_show(struct device *dev, struct device_attribute *attr, 1304static ssize_t card_type_show(struct device *dev, struct device_attribute *attr,
1307 char *buf) 1305 char *buf)
1308{ 1306{
1309 struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev)); 1307 const struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev));
1310 1308
1311 return sprintf(buf, "%d\n", dc->card_type); 1309 return sprintf(buf, "%d\n", dc->card_type);
1312} 1310}
@@ -1315,7 +1313,7 @@ static DEVICE_ATTR(card_type, S_IRUGO, card_type_show, NULL);
1315static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr, 1313static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr,
1316 char *buf) 1314 char *buf)
1317{ 1315{
1318 struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev)); 1316 const struct nozomi *dc = pci_get_drvdata(to_pci_dev(dev));
1319 1317
1320 return sprintf(buf, "%u\n", dc->open_ttys); 1318 return sprintf(buf, "%u\n", dc->open_ttys);
1321} 1319}
@@ -1682,7 +1680,7 @@ static int ntty_write_room(struct tty_struct *tty)
1682{ 1680{
1683 struct port *port = tty->driver_data; 1681 struct port *port = tty->driver_data;
1684 int room = 0; 1682 int room = 0;
1685 struct nozomi *dc = get_dc_by_tty(tty); 1683 const struct nozomi *dc = get_dc_by_tty(tty);
1686 1684
1687 if (!dc || !port) 1685 if (!dc || !port)
1688 return 0; 1686 return 0;
@@ -1702,9 +1700,9 @@ exit:
1702/* Gets io control parameters */ 1700/* Gets io control parameters */
1703static int ntty_tiocmget(struct tty_struct *tty, struct file *file) 1701static int ntty_tiocmget(struct tty_struct *tty, struct file *file)
1704{ 1702{
1705 struct port *port = tty->driver_data; 1703 const struct port *port = tty->driver_data;
1706 struct ctrl_dl *ctrl_dl = &port->ctrl_dl; 1704 const struct ctrl_dl *ctrl_dl = &port->ctrl_dl;
1707 struct ctrl_ul *ctrl_ul = &port->ctrl_ul; 1705 const struct ctrl_ul *ctrl_ul = &port->ctrl_ul;
1708 1706
1709 return (ctrl_ul->RTS ? TIOCM_RTS : 0) | 1707 return (ctrl_ul->RTS ? TIOCM_RTS : 0) |
1710 (ctrl_ul->DTR ? TIOCM_DTR : 0) | 1708 (ctrl_ul->DTR ? TIOCM_DTR : 0) |