aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/synclinkmp.c
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2010-09-16 13:21:52 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 13:20:05 -0400
commit0587102cf9f427c185bfdeb2cef41e13ee0264b1 (patch)
tree94c6dcc7ac230dee166d2f6aa1f9a54bffe5764b /drivers/char/synclinkmp.c
parent0bca1b913affbd7e2fdaffee62a499659a466eb5 (diff)
tty: icount changeover for other main devices
Again basically cut and paste Convert the main driver set to use the hooks for GICOUNT Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char/synclinkmp.c')
-rw-r--r--drivers/char/synclinkmp.c61
1 files changed, 28 insertions, 33 deletions
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index e56caf7d82aa..2f9eb4b0dec1 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -1258,10 +1258,6 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1258 unsigned int cmd, unsigned long arg) 1258 unsigned int cmd, unsigned long arg)
1259{ 1259{
1260 SLMP_INFO *info = tty->driver_data; 1260 SLMP_INFO *info = tty->driver_data;
1261 int error;
1262 struct mgsl_icount cnow; /* kernel counter temps */
1263 struct serial_icounter_struct __user *p_cuser; /* user space */
1264 unsigned long flags;
1265 void __user *argp = (void __user *)arg; 1261 void __user *argp = (void __user *)arg;
1266 1262
1267 if (debug_level >= DEBUG_LEVEL_INFO) 1263 if (debug_level >= DEBUG_LEVEL_INFO)
@@ -1272,7 +1268,7 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1272 return -ENODEV; 1268 return -ENODEV;
1273 1269
1274 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && 1270 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
1275 (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { 1271 (cmd != TIOCMIWAIT)) {
1276 if (tty->flags & (1 << TTY_IO_ERROR)) 1272 if (tty->flags & (1 << TTY_IO_ERROR))
1277 return -EIO; 1273 return -EIO;
1278 } 1274 }
@@ -1310,40 +1306,38 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1310 * NB: both 1->0 and 0->1 transitions are counted except for 1306 * NB: both 1->0 and 0->1 transitions are counted except for
1311 * RI where only 0->1 is counted. 1307 * RI where only 0->1 is counted.
1312 */ 1308 */
1313 case TIOCGICOUNT:
1314 spin_lock_irqsave(&info->lock,flags);
1315 cnow = info->icount;
1316 spin_unlock_irqrestore(&info->lock,flags);
1317 p_cuser = argp;
1318 PUT_USER(error,cnow.cts, &p_cuser->cts);
1319 if (error) return error;
1320 PUT_USER(error,cnow.dsr, &p_cuser->dsr);
1321 if (error) return error;
1322 PUT_USER(error,cnow.rng, &p_cuser->rng);
1323 if (error) return error;
1324 PUT_USER(error,cnow.dcd, &p_cuser->dcd);
1325 if (error) return error;
1326 PUT_USER(error,cnow.rx, &p_cuser->rx);
1327 if (error) return error;
1328 PUT_USER(error,cnow.tx, &p_cuser->tx);
1329 if (error) return error;
1330 PUT_USER(error,cnow.frame, &p_cuser->frame);
1331 if (error) return error;
1332 PUT_USER(error,cnow.overrun, &p_cuser->overrun);
1333 if (error) return error;
1334 PUT_USER(error,cnow.parity, &p_cuser->parity);
1335 if (error) return error;
1336 PUT_USER(error,cnow.brk, &p_cuser->brk);
1337 if (error) return error;
1338 PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun);
1339 if (error) return error;
1340 return 0;
1341 default: 1309 default:
1342 return -ENOIOCTLCMD; 1310 return -ENOIOCTLCMD;
1343 } 1311 }
1344 return 0; 1312 return 0;
1345} 1313}
1346 1314
1315static int get_icount(struct tty_struct *tty,
1316 struct serial_icounter_struct *icount)
1317{
1318 SLMP_INFO *info = tty->driver_data;
1319 struct mgsl_icount cnow; /* kernel counter temps */
1320 unsigned long flags;
1321
1322 spin_lock_irqsave(&info->lock,flags);
1323 cnow = info->icount;
1324 spin_unlock_irqrestore(&info->lock,flags);
1325
1326 icount->cts = cnow.cts;
1327 icount->dsr = cnow.dsr;
1328 icount->rng = cnow.rng;
1329 icount->dcd = cnow.dcd;
1330 icount->rx = cnow.rx;
1331 icount->tx = cnow.tx;
1332 icount->frame = cnow.frame;
1333 icount->overrun = cnow.overrun;
1334 icount->parity = cnow.parity;
1335 icount->brk = cnow.brk;
1336 icount->buf_overrun = cnow.buf_overrun;
1337
1338 return 0;
1339}
1340
1347/* 1341/*
1348 * /proc fs routines.... 1342 * /proc fs routines....
1349 */ 1343 */
@@ -3909,6 +3903,7 @@ static const struct tty_operations ops = {
3909 .hangup = hangup, 3903 .hangup = hangup,
3910 .tiocmget = tiocmget, 3904 .tiocmget = tiocmget,
3911 .tiocmset = tiocmset, 3905 .tiocmset = tiocmset,
3906 .get_icount = get_icount,
3912 .proc_fops = &synclinkmp_proc_fops, 3907 .proc_fops = &synclinkmp_proc_fops,
3913}; 3908};
3914 3909