Commit 875b206b authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

Char: cyclades, make info->card a pointer

Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6d8248e8
...@@ -655,12 +655,12 @@ ...@@ -655,12 +655,12 @@
#define CY_LOCK(info,flags) \ #define CY_LOCK(info,flags) \
do { \ do { \
spin_lock_irqsave(&cy_card[info->card].card_lock, flags); \ spin_lock_irqsave(&info->card->card_lock, flags); \
} while (0) } while (0)
#define CY_UNLOCK(info,flags) \ #define CY_UNLOCK(info,flags) \
do { \ do { \
spin_unlock_irqrestore(&cy_card[info->card].card_lock, flags); \ spin_unlock_irqrestore(&info->card->card_lock, flags); \
} while (0) } while (0)
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -1555,7 +1555,7 @@ static void ...@@ -1555,7 +1555,7 @@ static void
cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
struct BUF_CTRL __iomem *buf_ctrl) struct BUF_CTRL __iomem *buf_ctrl)
{ {
struct cyclades_card *cinfo = &cy_card[info->card]; struct cyclades_card *cinfo = info->card;
struct tty_struct *tty = info->tty; struct tty_struct *tty = info->tty;
int char_count; int char_count;
int len; int len;
...@@ -1651,7 +1651,7 @@ static void ...@@ -1651,7 +1651,7 @@ static void
cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
struct BUF_CTRL __iomem *buf_ctrl) struct BUF_CTRL __iomem *buf_ctrl)
{ {
struct cyclades_card *cinfo = &cy_card[info->card]; struct cyclades_card *cinfo = info->card;
struct tty_struct *tty = info->tty; struct tty_struct *tty = info->tty;
char data; char data;
int char_count; int char_count;
...@@ -1878,13 +1878,13 @@ static irqreturn_t cyz_interrupt(int irq, void *dev_id) ...@@ -1878,13 +1878,13 @@ static irqreturn_t cyz_interrupt(int irq, void *dev_id)
static void cyz_rx_restart(unsigned long arg) static void cyz_rx_restart(unsigned long arg)
{ {
struct cyclades_port *info = (struct cyclades_port *)arg; struct cyclades_port *info = (struct cyclades_port *)arg;
struct cyclades_card *card = info->card;
int retval; int retval;
int card = info->card; __u32 channel = info->line - card->first_line;
__u32 channel = (info->line) - (cy_card[card].first_line);
unsigned long flags; unsigned long flags;
CY_LOCK(info, flags); CY_LOCK(info, flags);
retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_INTBACK2, 0L); retval = cyz_issue_cmd(card, channel, C_CM_INTBACK2, 0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR "cyc:cyz_rx_restart retval on ttyC%d was %x\n", printk(KERN_ERR "cyc:cyz_rx_restart retval on ttyC%d was %x\n",
info->line, retval); info->line, retval);
...@@ -1956,14 +1956,15 @@ static void cyz_poll(unsigned long arg) ...@@ -1956,14 +1956,15 @@ static void cyz_poll(unsigned long arg)
*/ */
static int startup(struct cyclades_port *info) static int startup(struct cyclades_port *info)
{ {
struct cyclades_card *card;
unsigned long flags; unsigned long flags;
int retval = 0; int retval = 0;
void __iomem *base_addr; void __iomem *base_addr;
int card, chip, channel, index; int chip, channel, index;
unsigned long page; unsigned long page;
card = info->card; card = info->card;
channel = (info->line) - (cy_card[card].first_line); channel = info->line - card->first_line;
page = get_zeroed_page(GFP_KERNEL); page = get_zeroed_page(GFP_KERNEL);
if (!page) if (!page)
...@@ -1993,12 +1994,11 @@ static int startup(struct cyclades_port *info) ...@@ -1993,12 +1994,11 @@ static int startup(struct cyclades_port *info)
set_line_char(info); set_line_char(info);
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = card->bus_index;
base_addr = cy_card[card].base_addr + base_addr = card->base_addr + (cy_chip_offset[chip] << index);
(cy_chip_offset[chip] << index);
#ifdef CY_DEBUG_OPEN #ifdef CY_DEBUG_OPEN
printk(KERN_DEBUG "cyc startup card %d, chip %d, channel %d, " printk(KERN_DEBUG "cyc startup card %d, chip %d, channel %d, "
...@@ -2050,14 +2050,14 @@ static int startup(struct cyclades_port *info) ...@@ -2050,14 +2050,14 @@ static int startup(struct cyclades_port *info)
struct CH_CTRL __iomem *ch_ctrl; struct CH_CTRL __iomem *ch_ctrl;
int retval; int retval;
base_addr = cy_card[card].base_addr; base_addr = card->base_addr;
firm_id = base_addr + ID_ADDRESS; firm_id = base_addr + ID_ADDRESS;
if (!ISZLOADED(cy_card[card])) { if (!ISZLOADED(*card)) {
return -ENODEV; return -ENODEV;
} }
zfw_ctrl = cy_card[card].base_addr + zfw_ctrl = card->base_addr +
(readl(&firm_id->zfwctrl_addr) & 0xfffff); (readl(&firm_id->zfwctrl_addr) & 0xfffff);
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = zfw_ctrl->ch_ctrl; ch_ctrl = zfw_ctrl->ch_ctrl;
...@@ -2088,15 +2088,14 @@ static int startup(struct cyclades_port *info) ...@@ -2088,15 +2088,14 @@ static int startup(struct cyclades_port *info)
#endif /* CONFIG_CYZ_INTR */ #endif /* CONFIG_CYZ_INTR */
#endif /* Z_WAKE */ #endif /* Z_WAKE */
retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_IOCTL, 0L); retval = cyz_issue_cmd(card, channel, C_CM_IOCTL, 0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR "cyc:startup(1) retval on ttyC%d was " printk(KERN_ERR "cyc:startup(1) retval on ttyC%d was "
"%x\n", info->line, retval); "%x\n", info->line, retval);
} }
/* Flush RX buffers before raising DTR and RTS */ /* Flush RX buffers before raising DTR and RTS */
retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_FLUSH_RX, retval = cyz_issue_cmd(card, channel, C_CM_FLUSH_RX, 0L);
0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR "cyc:startup(2) retval on ttyC%d was " printk(KERN_ERR "cyc:startup(2) retval on ttyC%d was "
"%x\n", info->line, retval); "%x\n", info->line, retval);
...@@ -2107,7 +2106,7 @@ static int startup(struct cyclades_port *info) ...@@ -2107,7 +2106,7 @@ static int startup(struct cyclades_port *info)
cy_writel(&ch_ctrl[channel].rs_control, cy_writel(&ch_ctrl[channel].rs_control,
readl(&ch_ctrl[channel].rs_control) | C_RS_RTS | readl(&ch_ctrl[channel].rs_control) | C_RS_RTS |
C_RS_DTR); C_RS_DTR);
retval = cyz_issue_cmd(&cy_card[info->card], channel, retval = cyz_issue_cmd(info->card, channel,
C_CM_IOCTLM, 0L); C_CM_IOCTLM, 0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR "cyc:startup(3) retval on ttyC%d was " printk(KERN_ERR "cyc:startup(3) retval on ttyC%d was "
...@@ -2145,18 +2144,18 @@ static int startup(struct cyclades_port *info) ...@@ -2145,18 +2144,18 @@ static int startup(struct cyclades_port *info)
static void start_xmit(struct cyclades_port *info) static void start_xmit(struct cyclades_port *info)
{ {
struct cyclades_card *card;
unsigned long flags; unsigned long flags;
void __iomem *base_addr; void __iomem *base_addr;
int card, chip, channel, index; int chip, channel, index;
card = info->card; card = info->card;
channel = (info->line) - (cy_card[card].first_line); channel = info->line - card->first_line;
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = card->bus_index;
base_addr = cy_card[card].base_addr + base_addr = card->base_addr + (cy_chip_offset[chip] << index);
(cy_chip_offset[chip] << index);
CY_LOCK(info, flags); CY_LOCK(info, flags);
cy_writeb(base_addr + (CyCAR << index), channel); cy_writeb(base_addr + (CyCAR << index), channel);
...@@ -2168,8 +2167,7 @@ static void start_xmit(struct cyclades_port *info) ...@@ -2168,8 +2167,7 @@ static void start_xmit(struct cyclades_port *info)
int retval; int retval;
CY_LOCK(info, flags); CY_LOCK(info, flags);
retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_INTBACK, retval = cyz_issue_cmd(card, channel, C_CM_INTBACK, 0L);
0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR "cyc:start_xmit retval on ttyC%d was " printk(KERN_ERR "cyc:start_xmit retval on ttyC%d was "
"%x\n", info->line, retval); "%x\n", info->line, retval);
...@@ -2187,22 +2185,22 @@ static void start_xmit(struct cyclades_port *info) ...@@ -2187,22 +2185,22 @@ static void start_xmit(struct cyclades_port *info)
*/ */
static void shutdown(struct cyclades_port *info) static void shutdown(struct cyclades_port *info)
{ {
struct cyclades_card *card;
unsigned long flags; unsigned long flags;
void __iomem *base_addr; void __iomem *base_addr;
int card, chip, channel, index; int chip, channel, index;
if (!(info->flags & ASYNC_INITIALIZED)) { if (!(info->flags & ASYNC_INITIALIZED)) {
return; return;
} }
card = info->card; card = info->card;
channel = info->line - cy_card[card].first_line; channel = info->line - card->first_line;
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = card->bus_index;
base_addr = cy_card[card].base_addr + base_addr = card->base_addr + (cy_chip_offset[chip] << index);
(cy_chip_offset[chip] << index);
#ifdef CY_DEBUG_OPEN #ifdef CY_DEBUG_OPEN
printk(KERN_DEBUG "cyc shutdown Y card %d, chip %d, " printk(KERN_DEBUG "cyc shutdown Y card %d, chip %d, "
...@@ -2248,18 +2246,18 @@ static void shutdown(struct cyclades_port *info) ...@@ -2248,18 +2246,18 @@ static void shutdown(struct cyclades_port *info)
struct CH_CTRL __iomem *ch_ctrl; struct CH_CTRL __iomem *ch_ctrl;
int retval; int retval;
base_addr = cy_card[card].base_addr; base_addr = card->base_addr;
#ifdef CY_DEBUG_OPEN #ifdef CY_DEBUG_OPEN
printk(KERN_DEBUG "cyc shutdown Z card %d, channel %d, " printk(KERN_DEBUG "cyc shutdown Z card %d, channel %d, "
"base_addr %p\n", card, channel, base_addr); "base_addr %p\n", card, channel, base_addr);
#endif #endif
firm_id = base_addr + ID_ADDRESS; firm_id = base_addr + ID_ADDRESS;
if (!ISZLOADED(cy_card[card])) { if (!ISZLOADED(*card)) {
return; return;
} }
zfw_ctrl = cy_card[card].base_addr + zfw_ctrl = card->base_addr +
(readl(&firm_id->zfwctrl_addr) & 0xfffff); (readl(&firm_id->zfwctrl_addr) & 0xfffff);
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = zfw_ctrl->ch_ctrl; ch_ctrl = zfw_ctrl->ch_ctrl;
...@@ -2277,7 +2275,7 @@ static void shutdown(struct cyclades_port *info) ...@@ -2277,7 +2275,7 @@ static void shutdown(struct cyclades_port *info)
cy_writel(&ch_ctrl[channel].rs_control, cy_writel(&ch_ctrl[channel].rs_control,
(__u32)(readl(&ch_ctrl[channel].rs_control) & (__u32)(readl(&ch_ctrl[channel].rs_control) &
~(C_RS_RTS | C_RS_DTR))); ~(C_RS_RTS | C_RS_DTR)));
retval = cyz_issue_cmd(&cy_card[info->card], channel, retval = cyz_issue_cmd(info->card, channel,
C_CM_IOCTLM, 0L); C_CM_IOCTLM, 0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR"cyc:shutdown retval on ttyC%d " printk(KERN_ERR"cyc:shutdown retval on ttyC%d "
...@@ -2318,7 +2316,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp, ...@@ -2318,7 +2316,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
int retval; int retval;
void __iomem *base_addr; void __iomem *base_addr;
cinfo = &cy_card[info->card]; cinfo = info->card;
channel = info->line - cinfo->first_line; channel = info->line - cinfo->first_line;
/* /*
...@@ -2443,7 +2441,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp, ...@@ -2443,7 +2441,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
cy_writel(&ch_ctrl[channel].rs_control, cy_writel(&ch_ctrl[channel].rs_control,
readl(&ch_ctrl[channel].rs_control) | readl(&ch_ctrl[channel].rs_control) |
C_RS_RTS | C_RS_DTR); C_RS_RTS | C_RS_DTR);
retval = cyz_issue_cmd(&cy_card[info->card], retval = cyz_issue_cmd(info->card,
channel, C_CM_IOCTLM, 0L); channel, C_CM_IOCTLM, 0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR "cyc:block_til_ready " printk(KERN_ERR "cyc:block_til_ready "
...@@ -2522,8 +2520,8 @@ static int cy_open(struct tty_struct *tty, struct file *filp) ...@@ -2522,8 +2520,8 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
treat it as absent from the system. This treat it as absent from the system. This
will make the user pay attention. will make the user pay attention.
*/ */
if (IS_CYC_Z(cy_card[info->card])) { if (IS_CYC_Z(*info->card)) {
struct cyclades_card *cinfo = &cy_card[info->card]; struct cyclades_card *cinfo = info->card;
struct FIRM_ID __iomem *firm_id = cinfo->base_addr + ID_ADDRESS; struct FIRM_ID __iomem *firm_id = cinfo->base_addr + ID_ADDRESS;
if (!ISZLOADED(*cinfo)) { if (!ISZLOADED(*cinfo)) {
...@@ -2634,9 +2632,10 @@ static int cy_open(struct tty_struct *tty, struct file *filp) ...@@ -2634,9 +2632,10 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
*/ */
static void cy_wait_until_sent(struct tty_struct *tty, int timeout) static void cy_wait_until_sent(struct tty_struct *tty, int timeout)
{ {
struct cyclades_card *card;
struct cyclades_port *info = tty->driver_data; struct cyclades_port *info = tty->driver_data;
void __iomem *base_addr; void __iomem *base_addr;
int card, chip, channel, index; int chip, channel, index;
unsigned long orig_jiffies; unsigned long orig_jiffies;
int char_time; int char_time;
...@@ -2679,13 +2678,12 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -2679,13 +2678,12 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout)
timeout, char_time, jiffies); timeout, char_time, jiffies);
#endif #endif
card = info->card; card = info->card;
channel = (info->line) - (cy_card[card].first_line); channel = (info->line) - (card->first_line);
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = card->bus_index;
base_addr = base_addr = card->base_addr + (cy_chip_offset[chip] << index);
cy_card[card].base_addr + (cy_chip_offset[chip] << index);
while (readb(base_addr + (CySRER << index)) & CyTxRdy) { while (readb(base_addr + (CySRER << index)) & CyTxRdy) {
#ifdef CY_DEBUG_WAIT_UNTIL_SENT #ifdef CY_DEBUG_WAIT_UNTIL_SENT
printk(KERN_DEBUG "Not clean (jiff=%lu)...", jiffies); printk(KERN_DEBUG "Not clean (jiff=%lu)...", jiffies);
...@@ -2771,10 +2769,10 @@ static void cy_close(struct tty_struct *tty, struct file *filp) ...@@ -2771,10 +2769,10 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
} }
CY_LOCK(info, flags); CY_LOCK(info, flags);
if (!IS_CYC_Z(cy_card[info->card])) { if (!IS_CYC_Z(*info->card)) {
int channel = info->line - cy_card[info->card].first_line; int channel = info->line - info->card->first_line;
int index = cy_card[info->card].bus_index; int index = info->card->bus_index;
void __iomem *base_addr = cy_card[info->card].base_addr + void __iomem *base_addr = info->card->base_addr +
(cy_chip_offset[channel >> 2] << index); (cy_chip_offset[channel >> 2] << index);
/* Stop accepting input */ /* Stop accepting input */
channel &= 0x03; channel &= 0x03;
...@@ -2791,16 +2789,16 @@ static void cy_close(struct tty_struct *tty, struct file *filp) ...@@ -2791,16 +2789,16 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
} else { } else {
#ifdef Z_WAKE #ifdef Z_WAKE
/* Waiting for on-board buffers to be empty before closing the port */ /* Waiting for on-board buffers to be empty before closing the port */
void __iomem *base_addr = cy_card[info->card].base_addr; void __iomem *base_addr = info->card->base_addr;
struct FIRM_ID __iomem *firm_id = base_addr + ID_ADDRESS; struct FIRM_ID __iomem *firm_id = base_addr + ID_ADDRESS;
struct ZFW_CTRL __iomem *zfw_ctrl = struct ZFW_CTRL __iomem *zfw_ctrl =
base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff); base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff);
struct CH_CTRL __iomem *ch_ctrl = zfw_ctrl->ch_ctrl; struct CH_CTRL __iomem *ch_ctrl = zfw_ctrl->ch_ctrl;
int channel = info->line - cy_card[info->card].first_line; int channel = info->line - info->card->first_line;
int retval; int retval;
if (readl(&ch_ctrl[channel].flow_status) != C_FS_TXIDLE) { if (readl(&ch_ctrl[channel].flow_status) != C_FS_TXIDLE) {
retval = cyz_issue_cmd(&cy_card[info->card], channel, retval = cyz_issue_cmd(info->card, channel,
C_CM_IOCTLW, 0L); C_CM_IOCTLW, 0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_DEBUG "cyc:cy_close retval on " printk(KERN_DEBUG "cyc:cy_close retval on "
...@@ -2982,14 +2980,15 @@ static int cy_write_room(struct tty_struct *tty) ...@@ -2982,14 +2980,15 @@ static int cy_write_room(struct tty_struct *tty)
static int cy_chars_in_buffer(struct tty_struct *tty) static int cy_chars_in_buffer(struct tty_struct *tty)
{ {
struct cyclades_card *card;
struct cyclades_port *info = tty->driver_data; struct cyclades_port *info = tty->driver_data;
int card, channel; int channel;
if (serial_paranoia_check(info, tty->name, "cy_chars_in_buffer")) if (serial_paranoia_check(info, tty->name, "cy_chars_in_buffer"))
return 0; return 0;
card = info->card; card = info->card;
channel = (info->line) - (cy_card[card].first_line); channel = (info->line) - (card->first_line);
#ifdef Z_EXT_CHARS_IN_BUFFER #ifdef Z_EXT_CHARS_IN_BUFFER
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(cy_card[card])) {
...@@ -3008,8 +3007,8 @@ static int cy_chars_in_buffer(struct tty_struct *tty) ...@@ -3008,8 +3007,8 @@ static int cy_chars_in_buffer(struct tty_struct *tty)
int char_count; int char_count;
__u32 tx_put, tx_get, tx_bufsize; __u32 tx_put, tx_get, tx_bufsize;
firm_id = cy_card[card].base_addr + ID_ADDRESS; firm_id = card->base_addr + ID_ADDRESS;
zfw_ctrl = cy_card[card].base_addr + zfw_ctrl = card->base_addr +
(readl(&firm_id->zfwctrl_addr) & 0xfffff); (readl(&firm_id->zfwctrl_addr) & 0xfffff);
ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]); ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
buf_ctrl = &(zfw_ctrl->buf_ctrl[channel]); buf_ctrl = &(zfw_ctrl->buf_ctrl[channel]);
...@@ -3067,9 +3066,10 @@ static void cyy_baud_calc(struct cyclades_port *info, __u32 baud) ...@@ -3067,9 +3066,10 @@ static void cyy_baud_calc(struct cyclades_port *info, __u32 baud)
*/ */
static void set_line_char(struct cyclades_port *info) static void set_line_char(struct cyclades_port *info)
{ {
struct cyclades_card *card;
unsigned long flags; unsigned long flags;
void __iomem *base_addr; void __iomem *base_addr;
int card, chip, channel, index; int chip, channel, index;
unsigned cflag, iflag; unsigned cflag, iflag;
unsigned short chip_number; unsigned short chip_number;
int baud, baud_rate = 0; int baud, baud_rate = 0;
...@@ -3099,12 +3099,12 @@ static void set_line_char(struct cyclades_port *info) ...@@ -3099,12 +3099,12 @@ static void set_line_char(struct cyclades_port *info)
} }
card = info->card; card = info->card;
channel = (info->line) - (cy_card[card].first_line); channel = info->line - card->first_line;
chip_number = channel / 4; chip_number = channel / 4;
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
index = cy_card[card].bus_index; index = card->bus_index;
/* baud rate */ /* baud rate */
baud = tty_get_baud_rate(info->tty); baud = tty_get_baud_rate(info->tty);
...@@ -3222,8 +3222,7 @@ static void set_line_char(struct cyclades_port *info) ...@@ -3222,8 +3222,7 @@ static void set_line_char(struct cyclades_port *info)
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
base_addr = cy_card[card].base_addr + base_addr = card->base_addr + (cy_chip_offset[chip] << index);
(cy_chip_offset[chip] << index);
CY_LOCK(info, flags); CY_LOCK(info, flags);
cy_writeb(base_addr + (CyCAR << index), (u_char) channel); cy_writeb(base_addr + (CyCAR << index), (u_char) channel);
...@@ -3331,12 +3330,12 @@ static void set_line_char(struct cyclades_port *info) ...@@ -3331,12 +3330,12 @@ static void set_line_char(struct cyclades_port *info)
__u32 sw_flow; __u32 sw_flow;
int retval; int retval;
firm_id = cy_card[card].base_addr + ID_ADDRESS; firm_id = card->base_addr + ID_ADDRESS;
if (!ISZLOADED(cy_card[card])) { if (!ISZLOADED(*card)) {
return; return;
} }
zfw_ctrl = cy_card[card].base_addr + zfw_ctrl = card->base_addr +
(readl(&firm_id->zfwctrl_addr) & 0xfffff); (readl(&firm_id->zfwctrl_addr) & 0xfffff);
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]); ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
...@@ -3424,7 +3423,7 @@ static void set_line_char(struct cyclades_port *info) ...@@ -3424,7 +3423,7 @@ static void set_line_char(struct cyclades_port *info)
} }
cy_writel(&ch_ctrl->sw_flow, sw_flow); cy_writel(&ch_ctrl->sw_flow, sw_flow);
retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_IOCTL, 0L); retval = cyz_issue_cmd(card, channel, C_CM_IOCTL, 0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR "cyc:set_line_char retval on ttyC%d " printk(KERN_ERR "cyc:set_line_char retval on ttyC%d "
"was %x\n", info->line, retval); "was %x\n", info->line, retval);
...@@ -3451,7 +3450,7 @@ static void set_line_char(struct cyclades_port *info) ...@@ -3451,7 +3450,7 @@ static void set_line_char(struct cyclades_port *info)
#endif #endif
} }
retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_IOCTLM,0L); retval = cyz_issue_cmd(card, channel, C_CM_IOCTLM,0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR "cyc:set_line_char(2) retval on ttyC%d " printk(KERN_ERR "cyc:set_line_char(2) retval on ttyC%d "
"was %x\n", info->line, retval); "was %x\n", info->line, retval);
...@@ -3468,14 +3467,15 @@ get_serial_info(struct cyclades_port *info, ...@@ -3468,14 +3467,15 @@ get_serial_info(struct cyclades_port *info,
struct serial_struct __user * retinfo) struct serial_struct __user * retinfo)
{ {
struct serial_struct tmp; struct serial_struct tmp;
struct cyclades_card *cinfo = &cy_card[info->card]; struct cyclades_card *cinfo = info->card;
if (!retinfo) if (!retinfo)
return -EFAULT; return -EFAULT;
memset(&tmp, 0, sizeof(tmp)); memset(&tmp, 0, sizeof(tmp));
tmp.type = info->type; tmp.type = info->type;
tmp.line = info->line; tmp.line = info->line;
tmp.port = info->card * 0x100 + info->line - cinfo->first_line; tmp.port = (info->card - cy_card) * 0x100 + info->line -
cinfo->first_line;
tmp.irq = cinfo->irq; tmp.irq = cinfo->irq;
tmp.flags = info->flags; tmp.flags = info->flags;
tmp.close_delay = info->close_delay; tmp.close_delay = info->close_delay;
...@@ -3544,20 +3544,20 @@ set_serial_info(struct cyclades_port *info, ...@@ -3544,20 +3544,20 @@ set_serial_info(struct cyclades_port *info,
*/ */
static int get_lsr_info(struct cyclades_port *info, unsigned int __user * value) static int get_lsr_info(struct cyclades_port *info, unsigned int __user * value)
{ {
int card, chip, channel, index; struct cyclades_card *card;
int chip, channel, index;
unsigned char status; unsigned char status;
unsigned int result; unsigned int result;
unsigned long flags; unsigned long flags;
void __iomem *base_addr; void __iomem *base_addr;
card = info->card; card = info->card;
channel = (info->line) - (cy_card[card].first_line); channel = (info->line) - (card->first_line);
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = card->bus_index;
base_addr = base_addr = card->base_addr + (cy_chip_offset[chip] << index);
cy_card[card].base_addr + (cy_chip_offset[chip] << index);
CY_LOCK(info, flags); CY_LOCK(info, flags);
status = readb(base_addr + (CySRER << index)) & status = readb(base_addr + (CySRER << index)) &
...@@ -3574,7 +3574,8 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user * value) ...@@ -3574,7 +3574,8 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user * value)
static int cy_tiocmget(struct tty_struct *tty, struct file *file) static int cy_tiocmget(struct tty_struct *tty, struct file *file)
{ {
struct cyclades_port *info = tty->driver_data; struct cyclades_port *info = tty->driver_data;
int card, chip, channel, index; struct cyclades_card *card;
int chip, channel, index;
void __iomem *base_addr; void __iomem *base_addr;
unsigned long flags; unsigned long flags;
unsigned char status; unsigned char status;
...@@ -3589,13 +3590,12 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file) ...@@ -3589,13 +3590,12 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file)
return -ENODEV; return -ENODEV;
card = info->card; card = info->card;
channel = (info->line) - (cy_card[card].first_line); channel = info->line - card->first_line;
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = card->bus_index;
base_addr = base_addr = card->base_addr + (cy_chip_offset[chip] << index);
cy_card[card].base_addr + (cy_chip_offset[chip] << index);
CY_LOCK(info, flags); CY_LOCK(info, flags);
cy_writeb(base_addr + (CyCAR << index), (u_char) channel); cy_writeb(base_addr + (CyCAR << index), (u_char) channel);
...@@ -3615,10 +3615,10 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file) ...@@ -3615,10 +3615,10 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file)
((status & CyDSR) ? TIOCM_DSR : 0) | ((status & CyDSR) ? TIOCM_DSR : 0) |
((status & CyCTS) ? TIOCM_CTS : 0); ((status & CyCTS) ? TIOCM_CTS : 0);
} else { } else {
base_addr = cy_card[card].base_addr; base_addr = card->base_addr;
firm_id = cy_card[card].base_addr + ID_ADDRESS; firm_id = card->base_addr + ID_ADDRESS;
if (ISZLOADED(cy_card[card])) { if (ISZLOADED(*card)) {
zfw_ctrl = cy_card[card].base_addr + zfw_ctrl = card->base_addr +
(readl(&firm_id->zfwctrl_addr) & 0xfffff); (readl(&firm_id->zfwctrl_addr) & 0xfffff);
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = zfw_ctrl->ch_ctrl; ch_ctrl = zfw_ctrl->ch_ctrl;
...@@ -3643,7 +3643,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -3643,7 +3643,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
unsigned int set, unsigned int clear) unsigned int set, unsigned int clear)
{ {
struct cyclades_port *info = tty->driver_data; struct cyclades_port *info = tty->driver_data;
int card, chip, channel, index; struct cyclades_card *card;
int chip, channel, index;
void __iomem *base_addr; void __iomem *base_addr;
unsigned long flags; unsigned long flags;
struct FIRM_ID __iomem *firm_id; struct FIRM_ID __iomem *firm_id;
...@@ -3656,13 +3657,12 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -3656,13 +3657,12 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
return -ENODEV; return -ENODEV;
card = info->card; card = info->card;
channel = (info->line) - (cy_card[card].first_line); channel = (info->line) - (card->first_line);
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = card->bus_index;
base_addr = base_addr = card->base_addr + (cy_chip_offset[chip] << index);
cy_card[card].base_addr + (cy_chip_offset[chip] << index);
if (set & TIOCM_RTS) { if (set & TIOCM_RTS) {
CY_LOCK(info, flags); CY_LOCK(info, flags);
...@@ -3730,11 +3730,11 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -3730,11 +3730,11 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
} }
} else { } else {
base_addr = cy_card[card].base_addr; base_addr = card->base_addr;
firm_id = cy_card[card].base_addr + ID_ADDRESS; firm_id = card->base_addr + ID_ADDRESS;
if (ISZLOADED(cy_card[card])) { if (ISZLOADED(*card)) {
zfw_ctrl = cy_card[card].base_addr + zfw_ctrl = card->base_addr +
(readl(&firm_id->zfwctrl_addr) & 0xfffff); (readl(&firm_id->zfwctrl_addr) & 0xfffff);
board_ctrl = &zfw_ctrl->board_ctrl; board_ctrl = &zfw_ctrl->board_ctrl;
ch_ctrl = zfw_ctrl->ch_ctrl; ch_ctrl = zfw_ctrl->ch_ctrl;
...@@ -3779,7 +3779,7 @@ cy_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -3779,7 +3779,7 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
return -ENODEV; return -ENODEV;
} }
CY_LOCK(info, flags); CY_LOCK(info, flags);
retval = cyz_issue_cmd(&cy_card[info->card], retval = cyz_issue_cmd(info->card,
channel, C_CM_IOCTLM, 0L); channel, C_CM_IOCTLM, 0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR "cyc:set_modem_info retval on ttyC%d " printk(KERN_ERR "cyc:set_modem_info retval on ttyC%d "
...@@ -3802,7 +3802,7 @@ static void cy_break(struct tty_struct *tty, int break_state) ...@@ -3802,7 +3802,7 @@ static void cy_break(struct tty_struct *tty, int break_state)
return; return;
CY_LOCK(info, flags); CY_LOCK(info, flags);
if (!IS_CYC_Z(cy_card[info->card])) { if (!IS_CYC_Z(*info->card)) {
/* Let the transmit ISR take care of this (since it /* Let the transmit ISR take care of this (since it
requires stuffing characters into the output stream). requires stuffing characters into the output stream).
*/ */
...@@ -3829,16 +3829,16 @@ static void cy_break(struct tty_struct *tty, int break_state) ...@@ -3829,16 +3829,16 @@ static void cy_break(struct tty_struct *tty, int break_state)
int retval; int retval;
if (break_state == -1) { if (break_state == -1) {
retval = cyz_issue_cmd(&cy_card[info->card], retval = cyz_issue_cmd(info->card,
info->line - cy_card[info->card].first_line, info->line - info->card->first_line,
C_CM_SET_BREAK, 0L); C_CM_SET_BREAK, 0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR "cyc:cy_break (set) retval on " printk(KERN_ERR "cyc:cy_break (set) retval on "
"ttyC%d was %x\n", info->line, retval); "ttyC%d was %x\n", info->line, retval);
} }
} else { } else {
retval = cyz_issue_cmd(&cy_card[info->card], retval = cyz_issue_cmd(info->card,
info->line - cy_card[info->card].first_line, info->line - info->card->first_line,
C_CM_CLR_BREAK, 0L); C_CM_CLR_BREAK, 0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_DEBUG "cyc:cy_break (clr) retval " printk(KERN_DEBUG "cyc:cy_break (clr) retval "
...@@ -3865,18 +3865,19 @@ get_mon_info(struct cyclades_port *info, struct cyclades_monitor __user * mon) ...@@ -3865,18 +3865,19 @@ get_mon_info(struct cyclades_port *info, struct cyclades_monitor __user * mon)
static int set_threshold(struct cyclades_port *info, unsigned long value) static int set_threshold(struct cyclades_port *info, unsigned long value)
{ {
struct cyclades_card *card;
void __iomem *base_addr; void __iomem *base_addr;
int card, channel, chip, index; int channel, chip, index;
unsigned long flags; unsigned long flags;
card = info->card; card = info->card;
channel = info->line - cy_card[card].first_line; channel = info->line - card->first_line;
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = card->bus_index;
base_addr = base_addr =
cy_card[card].base_addr + (cy_chip_offset[chip] << index); card->base_addr + (cy_chip_offset[chip] << index);
info->cor3 &= ~CyREC_FIFO; info->cor3 &= ~CyREC_FIFO;
info->cor3 |= value & CyREC_FIFO; info->cor3 |= value & CyREC_FIFO;
...@@ -3894,18 +3895,18 @@ static int set_threshold(struct cyclades_port *info, unsigned long value) ...@@ -3894,18 +3895,18 @@ static int set_threshold(struct cyclades_port *info, unsigned long value)
static int static int
get_threshold(struct cyclades_port *info, unsigned long __user * value) get_threshold(struct cyclades_port *info, unsigned long __user * value)
{ {
struct cyclades_card *card;
void __iomem *base_addr; void __iomem *base_addr;
int card, channel, chip, index; int channel, chip, index;
unsigned long tmp; unsigned long tmp;
card = info->card; card = info->card;
channel = info->line - cy_card[card].first_line; channel = info->line - card->first_line;
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = card->bus_index;
base_addr = base_addr = card->base_addr + (cy_chip_offset[chip] << index);
cy_card[card].base_addr + (cy_chip_offset[chip] << index);
tmp = readb(base_addr + (CyCOR3 << index)) & CyREC_FIFO; tmp = readb(base_addr + (CyCOR3 << index)) & CyREC_FIFO;
return put_user(tmp, value); return put_user(tmp, value);
...@@ -3930,18 +3931,18 @@ get_default_threshold(struct cyclades_port *info, unsigned long __user * value) ...@@ -3930,18 +3931,18 @@ get_default_threshold(struct cyclades_port *info, unsigned long __user * value)
static int set_timeout(struct cyclades_port *info, unsigned long value) static int set_timeout(struct cyclades_port *info, unsigned long value)
{ {
struct cyclades_card *card;
void __iomem *base_addr; void __iomem *base_addr;
int card, channel, chip, index; int channel, chip, index;
unsigned long flags; unsigned long flags;
card = info->card; card = info->card;
channel = info->line - cy_card[card].first_line; channel = info->line - card->first_line;
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = card->bus_index;
base_addr = base_addr = card->base_addr + (cy_chip_offset[chip] << index);
cy_card[card].base_addr + (cy_chip_offset[chip] << index);
CY_LOCK(info, flags); CY_LOCK(info, flags);
cy_writeb(base_addr + (CyRTPR << index), value & 0xff); cy_writeb(base_addr + (CyRTPR << index), value & 0xff);
...@@ -3954,18 +3955,18 @@ static int set_timeout(struct cyclades_port *info, unsigned long value) ...@@ -3954,18 +3955,18 @@ static int set_timeout(struct cyclades_port *info, unsigned long value)
static int get_timeout(struct cyclades_port *info, unsigned long __user * value) static int get_timeout(struct cyclades_port *info, unsigned long __user * value)
{ {
struct cyclades_card *card;
void __iomem *base_addr; void __iomem *base_addr;
int card, channel, chip, index; int channel, chip, index;
unsigned long tmp; unsigned long tmp;
card = info->card; card = info->card;
channel = info->line - cy_card[card].first_line; channel = info->line - card->first_line;
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = card->bus_index;
base_addr = base_addr = card->base_addr + (cy_chip_offset[chip] << index);
cy_card[card].base_addr + (cy_chip_offset[chip] << index);
tmp = readb(base_addr + (CyRTPR << index)); tmp = readb(base_addr + (CyRTPR << index));
return put_user(tmp, value); return put_user(tmp, value);
...@@ -4218,7 +4219,8 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios) ...@@ -4218,7 +4219,8 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
static void cy_send_xchar(struct tty_struct *tty, char ch) static void cy_send_xchar(struct tty_struct *tty, char ch)
{ {
struct cyclades_port *info = tty->driver_data; struct cyclades_port *info = tty->driver_data;
int card, channel; struct cyclades_card *card;
int channel;
if (serial_paranoia_check(info, tty->name, "cy_send_xchar")) if (serial_paranoia_check(info, tty->name, "cy_send_xchar"))
return; return;
...@@ -4229,15 +4231,13 @@ static void cy_send_xchar(struct tty_struct *tty, char ch) ...@@ -4229,15 +4231,13 @@ static void cy_send_xchar(struct tty_struct *tty, char ch)
cy_start(tty); cy_start(tty);
card = info->card; card = info->card;
channel = info->line - cy_card[card].first_line; channel = info->line - card->first_line;
if (IS_CYC_Z(cy_card[card])) { if (IS_CYC_Z(*card)) {
if (ch == STOP_CHAR(tty)) if (ch == STOP_CHAR(tty))
cyz_issue_cmd(&cy_card[card], channel, C_CM_SENDXOFF, cyz_issue_cmd(card, channel, C_CM_SENDXOFF, 0L);
0L);
else if (ch == START_CHAR(tty)) else if (ch == START_CHAR(tty))
cyz_issue_cmd(&cy_card[card], channel, C_CM_SENDXON, cyz_issue_cmd(card, channel, C_CM_SENDXON, 0L);
0L);
} }
} }
...@@ -4248,9 +4248,10 @@ static void cy_send_xchar(struct tty_struct *tty, char ch) ...@@ -4248,9 +4248,10 @@ static void cy_send_xchar(struct tty_struct *tty, char ch)
static void cy_throttle(struct tty_struct *tty) static void cy_throttle(struct tty_struct *tty)
{ {
struct cyclades_port *info = tty->driver_data; struct cyclades_port *info = tty->driver_data;
struct cyclades_card *card;
unsigned long flags; unsigned long flags;
void __iomem *base_addr; void __iomem *base_addr;
int card, chip, channel, index; int chip, channel, index;
#ifdef CY_DEBUG_THROTTLE #ifdef CY_DEBUG_THROTTLE
char buf[64]; char buf[64];
...@@ -4266,19 +4267,19 @@ static void cy_throttle(struct tty_struct *tty) ...@@ -4266,19 +4267,19 @@ static void cy_throttle(struct tty_struct *tty)
card = info->card; card = info->card;
if (I_IXOFF(tty)) { if (I_IXOFF(tty)) {
if (!IS_CYC_Z(cy_card[card])) if (!IS_CYC_Z(*card))
cy_send_xchar(tty, STOP_CHAR(tty)); cy_send_xchar(tty, STOP_CHAR(tty));
else else
info->throttle = 1; info->throttle = 1;
} }
if (tty->termios->c_cflag & CRTSCTS) { if (tty->termios->c_cflag & CRTSCTS) {
channel = info->line - cy_card[card].first_line; channel = info->line - card->first_line;
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = card->bus_index;
base_addr = cy_card[card].base_addr + base_addr = card->base_addr +
(cy_chip_offset[chip] << index); (cy_chip_offset[chip] << index);
CY_LOCK(info, flags); CY_LOCK(info, flags);
...@@ -4306,9 +4307,10 @@ static void cy_throttle(struct tty_struct *tty) ...@@ -4306,9 +4307,10 @@ static void cy_throttle(struct tty_struct *tty)
static void cy_unthrottle(struct tty_struct *tty) static void cy_unthrottle(struct tty_struct *tty)
{ {
struct cyclades_port *info = tty->driver_data; struct cyclades_port *info = tty->driver_data;
struct cyclades_card *card;
unsigned long flags; unsigned long flags;
void __iomem *base_addr; void __iomem *base_addr;
int card, chip, channel, index; int chip, channel, index;
#ifdef CY_DEBUG_THROTTLE #ifdef CY_DEBUG_THROTTLE
char buf[64]; char buf[64];
...@@ -4330,12 +4332,12 @@ static void cy_unthrottle(struct tty_struct *tty) ...@@ -4330,12 +4332,12 @@ static void cy_unthrottle(struct tty_struct *tty)
if (tty->termios->c_cflag & CRTSCTS) { if (tty->termios->c_cflag & CRTSCTS) {
card = info->card; card = info->card;
channel = info->line - cy_card[card].first_line; channel = info->line - card->first_line;
if (!IS_CYC_Z(cy_card[card])) { if (!IS_CYC_Z(*card)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
index = cy_card[card].bus_index; index = card->bus_index;
base_addr = cy_card[card].base_addr + base_addr = card->base_addr +
(cy_chip_offset[chip] << index); (cy_chip_offset[chip] << index);
CY_LOCK(info, flags); CY_LOCK(info, flags);
...@@ -4373,13 +4375,13 @@ static void cy_stop(struct tty_struct *tty) ...@@ -4373,13 +4375,13 @@ static void cy_stop(struct tty_struct *tty)
if (serial_paranoia_check(info, tty->name, "cy_stop")) if (serial_paranoia_check(info, tty->name, "cy_stop"))
return; return;
cinfo = &cy_card[info->card]; cinfo = info->card;
channel = info->line - cinfo->first_line; channel = info->line - cinfo->first_line;
if (!IS_CYC_Z(*cinfo)) { if (!IS_CYC_Z(*cinfo)) {
index = cinfo->bus_index; index = cinfo->bus_index;
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
base_addr = cy_card[info->card].base_addr + base_addr = info->card->base_addr +
(cy_chip_offset[chip] << index); (cy_chip_offset[chip] << index);
CY_LOCK(info, flags); CY_LOCK(info, flags);
...@@ -4408,13 +4410,13 @@ static void cy_start(struct tty_struct *tty) ...@@ -4408,13 +4410,13 @@ static void cy_start(struct tty_struct *tty)
if (serial_paranoia_check(info, tty->name, "cy_start")) if (serial_paranoia_check(info, tty->name, "cy_start"))
return; return;
cinfo = &cy_card[info->card]; cinfo = info->card;
channel = info->line - cinfo->first_line; channel = info->line - cinfo->first_line;
index = cinfo->bus_index; index = cinfo->bus_index;
if (!IS_CYC_Z(*cinfo)) { if (!IS_CYC_Z(*cinfo)) {
chip = channel >> 2; chip = channel >> 2;
channel &= 0x03; channel &= 0x03;
base_addr = cy_card[info->card].base_addr + base_addr = info->card->base_addr +
(cy_chip_offset[chip] << index); (cy_chip_offset[chip] << index);
CY_LOCK(info, flags); CY_LOCK(info, flags);
...@@ -4430,7 +4432,8 @@ static void cy_start(struct tty_struct *tty) ...@@ -4430,7 +4432,8 @@ static void cy_start(struct tty_struct *tty)
static void cy_flush_buffer(struct tty_struct *tty) static void cy_flush_buffer(struct tty_struct *tty)
{ {
struct cyclades_port *info = tty->driver_data; struct cyclades_port *info = tty->driver_data;
int card, channel, retval; struct cyclades_card *card;
int channel, retval;
unsigned long flags; unsigned long flags;
#ifdef CY_DEBUG_IO #ifdef CY_DEBUG_IO
...@@ -4441,17 +4444,16 @@ static void cy_flush_buffer(struct tty_struct *tty) ...@@ -4441,17 +4444,16 @@ static void cy_flush_buffer(struct tty_struct *tty)
return; return;
card = info->card; card = info->card;
channel = (info->line) - (cy_card[card].first_line); channel = info->line - card->first_line;
CY_LOCK(info, flags); CY_LOCK(info, flags);
info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
CY_UNLOCK(info, flags); CY_UNLOCK(info, flags);
if (IS_CYC_Z(cy_card[card])) { /* If it is a Z card, flush the on-board if (IS_CYC_Z(*card)) { /* If it is a Z card, flush the on-board
buffers as well */ buffers as well */
CY_LOCK(info, flags); CY_LOCK(info, flags);
retval = retval = cyz_issue_cmd(card, channel, C_CM_FLUSH_TX, 0L);
cyz_issue_cmd(&cy_card[card], channel, C_CM_FLUSH_TX, 0L);
if (retval != 0) { if (retval != 0) {
printk(KERN_ERR "cyc: flush_buffer retval on ttyC%d " printk(KERN_ERR "cyc: flush_buffer retval on ttyC%d "
"was %x\n", info->line, retval); "was %x\n", info->line, retval);
...@@ -4496,8 +4498,7 @@ static void cy_hangup(struct tty_struct *tty) ...@@ -4496,8 +4498,7 @@ static void cy_hangup(struct tty_struct *tty)
* --------------------------------------------------------------------- * ---------------------------------------------------------------------
*/ */
static void __devinit cy_init_card(struct cyclades_card *cinfo, static void __devinit cy_init_card(struct cyclades_card *cinfo)
const unsigned int board)
{ {
struct cyclades_port *info; struct cyclades_port *info;
u32 mailbox; u32 mailbox;
...@@ -4524,7 +4525,7 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo, ...@@ -4524,7 +4525,7 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo,
info = &cy_port[port]; info = &cy_port[port];
memset(info, 0, sizeof(*info)); memset(info, 0, sizeof(*info));
info->magic = CYCLADES_MAGIC; info->magic = CYCLADES_MAGIC;
info->card = board; info->card = cinfo;
info->line = port; info->line = port;
info->flags = STD_COM_FLAGS; info->flags = STD_COM_FLAGS;
info->closing_wait = CLOSING_WAIT_DELAY; info->closing_wait = CLOSING_WAIT_DELAY;
...@@ -4763,7 +4764,7 @@ static int __init cy_detect_isa(void) ...@@ -4763,7 +4764,7 @@ static int __init cy_detect_isa(void)
cy_card[j].bus_index = 0; cy_card[j].bus_index = 0;
cy_card[j].first_line = cy_next_channel; cy_card[j].first_line = cy_next_channel;
cy_card[j].num_chips = cy_isa_nchan / 4; cy_card[j].num_chips = cy_isa_nchan / 4;
cy_init_card(&cy_card[j], j); cy_init_card(&cy_card[j]);
nboard++; nboard++;
printk(KERN_INFO "Cyclom-Y/ISA #%d: 0x%lx-0x%lx, IRQ%d found: " printk(KERN_INFO "Cyclom-Y/ISA #%d: 0x%lx-0x%lx, IRQ%d found: "
...@@ -4849,7 +4850,7 @@ static int __devinit cy_init_Ze(struct RUNTIME_9060 __iomem *cy_pci_addr0, ...@@ -4849,7 +4850,7 @@ static int __devinit cy_init_Ze(struct RUNTIME_9060 __iomem *cy_pci_addr0,
cy_card[j].bus_index = 1; cy_card[j].bus_index = 1;
cy_card[j].first_line = cy_next_channel; cy_card[j].first_line = cy_next_channel;
cy_card[j].num_chips = -1; cy_card[j].num_chips = -1;
cy_init_card(&cy_card[j], j); cy_init_card(&cy_card[j]);
pci_set_drvdata(pdev, &cy_card[j]); pci_set_drvdata(pdev, &cy_card[j]);
dev_info(&pdev->dev, "Cyclades-Ze/PCI #%d found: %d channels starting " dev_info(&pdev->dev, "Cyclades-Ze/PCI #%d found: %d channels starting "
...@@ -4956,7 +4957,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev, ...@@ -4956,7 +4957,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
cy_card[j].bus_index = 1; cy_card[j].bus_index = 1;
cy_card[j].first_line = cy_next_channel; cy_card[j].first_line = cy_next_channel;
cy_card[j].num_chips = cy_pci_nchan / 4; cy_card[j].num_chips = cy_pci_nchan / 4;
cy_init_card(&cy_card[j], j); cy_init_card(&cy_card[j]);
pci_set_drvdata(pdev, &cy_card[j]); pci_set_drvdata(pdev, &cy_card[j]);
/* enable interrupts in the PCI interface */ /* enable interrupts in the PCI interface */
...@@ -5110,7 +5111,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev, ...@@ -5110,7 +5111,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
cy_card[j].bus_index = 1; cy_card[j].bus_index = 1;
cy_card[j].first_line = cy_next_channel; cy_card[j].first_line = cy_next_channel;
cy_card[j].num_chips = -1; cy_card[j].num_chips = -1;
cy_init_card(&cy_card[j], j); cy_init_card(&cy_card[j]);
pci_set_drvdata(pdev, &cy_card[j]); pci_set_drvdata(pdev, &cy_card[j]);
dev_info(&pdev->dev, "Cyclades-8Zo/PCI #%d found: %d channels " dev_info(&pdev->dev, "Cyclades-8Zo/PCI #%d found: %d channels "
......
...@@ -549,7 +549,7 @@ struct cyclades_icount { ...@@ -549,7 +549,7 @@ struct cyclades_icount {
struct cyclades_port { struct cyclades_port {
int magic; int magic;
int card; struct cyclades_card *card;
int line; int line;
int flags; /* defined in tty.h */ int flags; /* defined in tty.h */
int type; /* UART type */ int type; /* UART type */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment