Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
24769621
Commit
24769621
authored
Aug 30, 2003
by
Alexander Viro
Committed by
Linus Torvalds
Aug 30, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] dev_t handling cleanups (3/12)
killed gratitious uses of kdev_t in tpqic02
parent
5be694bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
34 deletions
+35
-34
drivers/char/tpqic02.c
drivers/char/tpqic02.c
+32
-31
include/linux/tpqic02.h
include/linux/tpqic02.h
+3
-3
No files found.
drivers/char/tpqic02.c
View file @
24769621
...
@@ -169,7 +169,7 @@ static unsigned long dma_bytes_done;
...
@@ -169,7 +169,7 @@ static unsigned long dma_bytes_done;
static
volatile
unsigned
dma_mode
;
/* !=0 also means DMA in use */
static
volatile
unsigned
dma_mode
;
/* !=0 also means DMA in use */
static
flag
need_rewind
=
YES
;
static
flag
need_rewind
=
YES
;
static
kdev_t
current_tape_dev
;
static
int
current_type
;
static
int
extra_blocks_left
=
BLOCKS_BEYOND_EW
;
static
int
extra_blocks_left
=
BLOCKS_BEYOND_EW
;
static
struct
timer_list
tp_timer
;
static
struct
timer_list
tp_timer
;
...
@@ -677,7 +677,7 @@ static int rdstatus(char *stp, unsigned size, char qcmd)
...
@@ -677,7 +677,7 @@ static int rdstatus(char *stp, unsigned size, char qcmd)
* exception flag from previous exception which we are trying to clear.
* exception flag from previous exception which we are trying to clear.
*/
*/
if
(
TP_DIAGS
(
current_t
ape_dev
))
if
(
TP_DIAGS
(
current_t
ype
))
printk
(
TPQIC02_NAME
": reading status bytes: "
);
printk
(
TPQIC02_NAME
": reading status bytes: "
);
for
(
q
=
stp
;
q
<
stp
+
size
;
q
++
)
{
for
(
q
=
stp
;
q
<
stp
+
size
;
q
++
)
{
...
@@ -693,7 +693,7 @@ static int rdstatus(char *stp, unsigned size, char qcmd)
...
@@ -693,7 +693,7 @@ static int rdstatus(char *stp, unsigned size, char qcmd)
*
q
=
inb_p
(
QIC02_DATA_PORT
);
/* read status byte */
*
q
=
inb_p
(
QIC02_DATA_PORT
);
/* read status byte */
if
(
TP_DIAGS
(
current_t
ape_dev
))
if
(
TP_DIAGS
(
current_t
ype
))
printk
(
"[%1d]=0x%x "
,
q
-
stp
,
(
unsigned
)
(
*
q
)
&
0xff
);
printk
(
"[%1d]=0x%x "
,
q
-
stp
,
(
unsigned
)
(
*
q
)
&
0xff
);
outb_p
(
ctlbits
|
QIC02_CTL_REQUEST
,
QIC02_CTL_PORT
);
/* set request */
outb_p
(
ctlbits
|
QIC02_CTL_REQUEST
,
QIC02_CTL_PORT
);
/* set request */
...
@@ -714,7 +714,7 @@ static int rdstatus(char *stp, unsigned size, char qcmd)
...
@@ -714,7 +714,7 @@ static int rdstatus(char *stp, unsigned size, char qcmd)
cpu_relax
();
cpu_relax
();
/* wait for ready */
/* wait for ready */
if
(
TP_DIAGS
(
current_t
ape_dev
))
if
(
TP_DIAGS
(
current_t
ype
))
printk
(
"
\n
"
);
printk
(
"
\n
"
);
return
TE_OK
;
return
TE_OK
;
...
@@ -1614,7 +1614,7 @@ static irqreturn_t qic02_tape_interrupt(int irq, void *dev_id,
...
@@ -1614,7 +1614,7 @@ static irqreturn_t qic02_tape_interrupt(int irq, void *dev_id,
if
(
status_expect_int
)
{
if
(
status_expect_int
)
{
#ifdef WANT_EXTRA_FULL_DEBUGGING
#ifdef WANT_EXTRA_FULL_DEBUGGING
if
(
TP_DIAGS
(
current_t
ape_dev
))
if
(
TP_DIAGS
(
current_t
ype
))
printk
(
"@"
);
printk
(
"@"
);
#endif
#endif
stat
=
inb
(
QIC02_STAT_PORT
);
/* Knock, knock */
stat
=
inb
(
QIC02_STAT_PORT
);
/* Knock, knock */
...
@@ -1726,7 +1726,7 @@ static irqreturn_t qic02_tape_interrupt(int irq, void *dev_id,
...
@@ -1726,7 +1726,7 @@ static irqreturn_t qic02_tape_interrupt(int irq, void *dev_id,
static
ssize_t
qic02_tape_read
(
struct
file
*
filp
,
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
qic02_tape_read
(
struct
file
*
filp
,
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
{
kdev_t
dev
=
filp
->
f_dentry
->
d_inode
->
i_rdev
;
int
type
=
minor
(
filp
->
f_dentry
->
d_inode
->
i_rdev
)
;
unsigned
short
flags
=
filp
->
f_flags
;
unsigned
short
flags
=
filp
->
f_flags
;
unsigned
long
bytes_todo
,
bytes_done
,
total_bytes_done
=
0
;
unsigned
long
bytes_todo
,
bytes_done
,
total_bytes_done
=
0
;
int
stat
;
int
stat
;
...
@@ -1736,8 +1736,8 @@ static ssize_t qic02_tape_read(struct file *filp, char *buf, size_t count, loff_
...
@@ -1736,8 +1736,8 @@ static ssize_t qic02_tape_read(struct file *filp, char *buf, size_t count, loff_
return
-
ENXIO
;
return
-
ENXIO
;
}
}
if
(
TP_DIAGS
(
current_t
ape_dev
))
if
(
TP_DIAGS
(
current_t
ype
))
printk
(
TPQIC02_NAME
": request READ, minor=%x, buf=%p, count=%lx, pos=%Lx, flags=%x
\n
"
,
minor
(
dev
)
,
buf
,
printk
(
TPQIC02_NAME
": request READ, minor=%x, buf=%p, count=%lx, pos=%Lx, flags=%x
\n
"
,
type
,
buf
,
(
long
)
count
,
filp
->
f_pos
,
flags
);
(
long
)
count
,
filp
->
f_pos
,
flags
);
if
(
count
%
TAPE_BLKSIZE
)
{
/* Only allow mod 512 bytes at a time. */
if
(
count
%
TAPE_BLKSIZE
)
{
/* Only allow mod 512 bytes at a time. */
...
@@ -1904,7 +1904,7 @@ static ssize_t qic02_tape_read(struct file *filp, char *buf, size_t count, loff_
...
@@ -1904,7 +1904,7 @@ static ssize_t qic02_tape_read(struct file *filp, char *buf, size_t count, loff_
*/
*/
static
ssize_t
qic02_tape_write
(
struct
file
*
filp
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
qic02_tape_write
(
struct
file
*
filp
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
{
kdev_t
dev
=
filp
->
f_dentry
->
d_inode
->
i_rdev
;
int
type
=
minor
(
filp
->
f_dentry
->
d_inode
->
i_rdev
)
;
unsigned
short
flags
=
filp
->
f_flags
;
unsigned
short
flags
=
filp
->
f_flags
;
unsigned
long
bytes_todo
,
bytes_done
,
total_bytes_done
=
0
;
unsigned
long
bytes_todo
,
bytes_done
,
total_bytes_done
=
0
;
...
@@ -1913,9 +1913,9 @@ static ssize_t qic02_tape_write(struct file *filp, const char *buf, size_t count
...
@@ -1913,9 +1913,9 @@ static ssize_t qic02_tape_write(struct file *filp, const char *buf, size_t count
return
-
ENXIO
;
return
-
ENXIO
;
}
}
if
(
TP_DIAGS
(
current_t
ape_dev
))
{
if
(
TP_DIAGS
(
current_t
ype
))
{
printk
(
TPQIC02_NAME
": request WRITE, minor=%x, buf=%p, count=%lx, pos=%Lx, flags=%x
\n
"
,
printk
(
TPQIC02_NAME
": request WRITE, minor=%x, buf=%p, count=%lx, pos=%Lx, flags=%x
\n
"
,
minor
(
dev
)
,
buf
,
(
long
)
count
,
filp
->
f_pos
,
flags
);
type
,
buf
,
(
long
)
count
,
filp
->
f_pos
,
flags
);
}
}
if
(
count
%
TAPE_BLKSIZE
)
{
/* only allow mod 512 bytes at a time */
if
(
count
%
TAPE_BLKSIZE
)
{
/* only allow mod 512 bytes at a time */
...
@@ -2070,17 +2070,18 @@ static int qic02_tape_open(struct inode *inode, struct file *filp)
...
@@ -2070,17 +2070,18 @@ static int qic02_tape_open(struct inode *inode, struct file *filp)
static
int
qic02_tape_open_no_use_count
(
struct
inode
*
inode
,
static
int
qic02_tape_open_no_use_count
(
struct
inode
*
inode
,
struct
file
*
filp
)
struct
file
*
filp
)
{
{
kdev_t
dev
=
inode
->
i_rdev
;
int
type
=
minor
(
inode
->
i_rdev
)
;
unsigned
short
flags
=
filp
->
f_flags
;
unsigned
short
flags
=
filp
->
f_flags
;
unsigned
short
dens
=
0
;
unsigned
short
dens
=
0
;
int
s
;
int
s
;
if
(
TP_DIAGS
(
dev
))
{
if
(
TP_DIAGS
(
type
))
{
printk
(
"qic02_tape_open: dev=%s, flags=%x "
,
cdevname
(
dev
),
flags
);
printk
(
"qic02_tape_open: dev=tpqic2(%d), flags=%x "
,
type
,
flags
);
}
}
if
(
minor
(
dev
)
==
255
)
{
/* special case for resetting */
if
(
type
==
255
)
{
/* special case for resetting */
if
(
capable
(
CAP_SYS_ADMIN
))
{
if
(
capable
(
CAP_SYS_ADMIN
))
{
return
(
tape_reset
(
1
)
==
TE_OK
)
?
-
EAGAIN
:
-
ENXIO
;
return
(
tape_reset
(
1
)
==
TE_OK
)
?
-
EAGAIN
:
-
ENXIO
;
}
else
{
}
else
{
...
@@ -2162,7 +2163,7 @@ static int qic02_tape_open_no_use_count(struct inode *inode,
...
@@ -2162,7 +2163,7 @@ static int qic02_tape_open_no_use_count(struct inode *inode,
*/
*/
/* not allowed to do QCMD_DENS_* unless tape is rewound */
/* not allowed to do QCMD_DENS_* unless tape is rewound */
if
((
TP_DENS
(
dev
)
!=
0
)
&&
(
TP_DENS
(
current_tape_dev
)
!=
TP_DENS
(
dev
)))
{
if
((
TP_DENS
(
type
)
!=
0
)
&&
(
TP_DENS
(
current_type
)
!=
TP_DENS
(
type
)))
{
/* force rewind if minor bits have changed,
/* force rewind if minor bits have changed,
* i.e. user wants to use tape in different format.
* i.e. user wants to use tape in different format.
* [assuming single drive operation]
* [assuming single drive operation]
...
@@ -2175,7 +2176,7 @@ static int qic02_tape_open_no_use_count(struct inode *inode,
...
@@ -2175,7 +2176,7 @@ static int qic02_tape_open_no_use_count(struct inode *inode,
/* density bits still the same, but TP_DIAGS bit
/* density bits still the same, but TP_DIAGS bit
* may have changed.
* may have changed.
*/
*/
current_t
ape_dev
=
dev
;
current_t
ype
=
type
;
}
}
if
(
need_rewind
==
YES
)
{
if
(
need_rewind
==
YES
)
{
...
@@ -2212,14 +2213,14 @@ static int qic02_tape_open_no_use_count(struct inode *inode,
...
@@ -2212,14 +2213,14 @@ static int qic02_tape_open_no_use_count(struct inode *inode,
* so we must have done a rewind by now. If not, just skip over.
* so we must have done a rewind by now. If not, just skip over.
* Only give set density command when minor bits have changed.
* Only give set density command when minor bits have changed.
*/
*/
if
(
TP_DENS
(
current_t
ape_dev
)
==
TP_DENS
(
dev
))
{
if
(
TP_DENS
(
current_t
ype
)
==
TP_DENS
(
type
))
{
return
0
;
return
0
;
}
}
current_t
ape_dev
=
dev
;
current_t
ype
=
type
;
need_rewind
=
NO
;
need_rewind
=
NO
;
if
(
TP_HAVE_DENS
)
{
if
(
TP_HAVE_DENS
)
{
dens
=
TP_DENS
(
dev
);
dens
=
TP_DENS
(
type
);
}
}
if
(
dens
<
sizeof
(
format_names
)
/
sizeof
(
char
*
))
if
(
dens
<
sizeof
(
format_names
)
/
sizeof
(
char
*
))
...
@@ -2227,7 +2228,7 @@ static int qic02_tape_open_no_use_count(struct inode *inode,
...
@@ -2227,7 +2228,7 @@ static int qic02_tape_open_no_use_count(struct inode *inode,
else
else
tpqputs
(
TPQD_REWIND
,
"Wait for retensioning..."
);
tpqputs
(
TPQD_REWIND
,
"Wait for retensioning..."
);
switch
(
TP_DENS
(
dev
))
{
switch
(
TP_DENS
(
type
))
{
case
0
:
/* Minor 0 is for drives without set-density support */
case
0
:
/* Minor 0 is for drives without set-density support */
s
=
0
;
s
=
0
;
break
;
break
;
...
@@ -2254,7 +2255,7 @@ static int qic02_tape_open_no_use_count(struct inode *inode,
...
@@ -2254,7 +2255,7 @@ static int qic02_tape_open_no_use_count(struct inode *inode,
}
}
if
(
s
!=
0
)
{
if
(
s
!=
0
)
{
status_dead
=
YES
;
/* force reset */
status_dead
=
YES
;
/* force reset */
current_t
ape_dev
=
NODEV
;
/* earlier 0xff80 */
current_t
ype
=
0
;
/* earlier 0xff80 */
return
-
EIO
;
return
-
EIO
;
}
}
...
@@ -2264,10 +2265,10 @@ static int qic02_tape_open_no_use_count(struct inode *inode,
...
@@ -2264,10 +2265,10 @@ static int qic02_tape_open_no_use_count(struct inode *inode,
static
int
qic02_tape_release
(
struct
inode
*
inode
,
struct
file
*
filp
)
static
int
qic02_tape_release
(
struct
inode
*
inode
,
struct
file
*
filp
)
{
{
kdev_t
dev
=
inode
->
i_rdev
;
int
type
=
minor
(
inode
->
i_rdev
)
;
if
(
TP_DIAGS
(
dev
))
{
if
(
TP_DIAGS
(
type
))
{
printk
(
"qic02_tape_release: dev=
%s
\n
"
,
cdevname
(
dev
)
);
printk
(
"qic02_tape_release: dev=
tpqic2(%d)
\n
"
,
type
);
}
}
if
(
status_zombie
==
NO
)
{
/* don't rewind in zombie mode */
if
(
status_zombie
==
NO
)
{
/* don't rewind in zombie mode */
...
@@ -2283,7 +2284,7 @@ static int qic02_tape_release(struct inode *inode, struct file *filp)
...
@@ -2283,7 +2284,7 @@ static int qic02_tape_release(struct inode *inode, struct file *filp)
/* Rewind only if minor number requires it AND
/* Rewind only if minor number requires it AND
* read/writes have been done. ************* IS THIS CORRECT??????????
* read/writes have been done. ************* IS THIS CORRECT??????????
*/
*/
if
(
(
TP_REWCLOSE
(
dev
)
)
&&
(
status_bytes_rd
|
status_bytes_wr
))
{
if
(
TP_REWCLOSE
(
type
)
&&
(
status_bytes_rd
|
status_bytes_wr
))
{
tpqputs
(
TPQD_REWIND
,
"release: Doing rewind..."
);
tpqputs
(
TPQD_REWIND
,
"release: Doing rewind..."
);
(
void
)
do_qic_cmd
(
QCMD_REWIND
,
TIM_R
);
(
void
)
do_qic_cmd
(
QCMD_REWIND
,
TIM_R
);
}
}
...
@@ -2398,7 +2399,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int
...
@@ -2398,7 +2399,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int
struct
mtpos
ioctl_tell
;
struct
mtpos
ioctl_tell
;
if
(
TP_DIAGS
(
current_t
ape_dev
))
if
(
TP_DIAGS
(
current_t
ype
))
printk
(
TPQIC02_NAME
": ioctl(%4x, %4lx)
\n
"
,
iocmd
,
ioarg
);
printk
(
TPQIC02_NAME
": ioctl(%4x, %4lx)
\n
"
,
iocmd
,
ioarg
);
if
(
!
inode
)
if
(
!
inode
)
...
@@ -2459,7 +2460,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int
...
@@ -2459,7 +2460,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int
* --- tape at the beginning of the current file.
* --- tape at the beginning of the current file.
*/
*/
if
(
TP_DIAGS
(
current_t
ape_dev
))
if
(
TP_DIAGS
(
current_t
ype
))
printk
(
"OP op=%4x, count=%4x
\n
"
,
operation
.
mt_op
,
operation
.
mt_count
);
printk
(
"OP op=%4x, count=%4x
\n
"
,
operation
.
mt_op
,
operation
.
mt_count
);
if
(
operation
.
mt_count
<
0
)
if
(
operation
.
mt_count
<
0
)
...
@@ -2492,7 +2493,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int
...
@@ -2492,7 +2493,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int
return
0
;
return
0
;
}
else
if
(
c
==
_IOC_NR
(
MTIOCGET
))
{
}
else
if
(
c
==
_IOC_NR
(
MTIOCGET
))
{
if
(
TP_DIAGS
(
current_t
ape_dev
))
if
(
TP_DIAGS
(
current_t
ype
))
printk
(
"GET "
);
printk
(
"GET "
);
CHECK_IOC_SIZE
(
mtget
);
CHECK_IOC_SIZE
(
mtget
);
...
@@ -2507,7 +2508,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int
...
@@ -2507,7 +2508,7 @@ static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
else
if
(
TP_HAVE_TELL
&&
(
c
==
_IOC_NR
(
MTIOCPOS
)))
{
}
else
if
(
TP_HAVE_TELL
&&
(
c
==
_IOC_NR
(
MTIOCPOS
)))
{
if
(
TP_DIAGS
(
current_t
ape_dev
))
if
(
TP_DIAGS
(
current_t
ype
))
printk
(
"POS "
);
printk
(
"POS "
);
CHECK_IOC_SIZE
(
mtpos
);
CHECK_IOC_SIZE
(
mtpos
);
...
@@ -2664,7 +2665,7 @@ int __init qic02_tape_init(void)
...
@@ -2664,7 +2665,7 @@ int __init qic02_tape_init(void)
return
-
ENODEV
;
return
-
ENODEV
;
}
}
current_t
ape_dev
=
mk_kdev
(
QIC02_TAPE_MAJOR
,
0
)
;
current_t
ype
=
0
;
#ifndef CONFIG_QIC02_DYNCONF
#ifndef CONFIG_QIC02_DYNCONF
printk
(
TPQIC02_NAME
": IRQ %d, DMA %d, IO 0x%x, IFC %s, %s, %s
\n
"
,
printk
(
TPQIC02_NAME
": IRQ %d, DMA %d, IO 0x%x, IFC %s, %s, %s
\n
"
,
...
...
include/linux/tpqic02.h
View file @
24769621
...
@@ -587,10 +587,10 @@
...
@@ -587,10 +587,10 @@
* |___________________ Reserved for diagnostics during debugging.
* |___________________ Reserved for diagnostics during debugging.
*/
*/
#define TP_REWCLOSE(d) ((
minor(d)&0x01) ==
1)
/* rewind bit */
#define TP_REWCLOSE(d) ((
d)&
1)
/* rewind bit */
/* rewind is only done if data has been transferred */
/* rewind is only done if data has been transferred */
#define TP_DENS(d
ev) ((minor(dev
) >> 1) & 0x07)
/* tape density */
#define TP_DENS(d
) (((d
) >> 1) & 0x07)
/* tape density */
#define TP_UNIT(d
ev) ((minor(dev
) >> 4) & 0x07)
/* unit number */
#define TP_UNIT(d
) (((d
) >> 4) & 0x07)
/* unit number */
/* print excessive diagnostics */
/* print excessive diagnostics */
#define TP_DIAGS(dev) (QIC02_TAPE_DEBUG & TPQD_DIAGS)
#define TP_DIAGS(dev) (QIC02_TAPE_DEBUG & TPQD_DIAGS)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment