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
Kirill Smelkov
linux
Commits
26f6deaa
Commit
26f6deaa
authored
Oct 05, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Oct 05, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] swim* switched to alloc_disk()
parent
b6b51807
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
25 deletions
+33
-25
drivers/block/swim3.c
drivers/block/swim3.c
+30
-20
drivers/block/swim_iop.c
drivers/block/swim_iop.c
+3
-5
No files found.
drivers/block/swim3.c
View file @
26f6deaa
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
#include <linux/blk.h>
#include <linux/blk.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/devfs_fs_kernel.h>
static
struct
gendisk
disks
[
2
];
static
struct
gendisk
*
disks
[
2
];
#define MAX_FLOPPIES 2
#define MAX_FLOPPIES 2
...
@@ -1014,6 +1014,7 @@ static devfs_handle_t floppy_devfs_handle;
...
@@ -1014,6 +1014,7 @@ static devfs_handle_t floppy_devfs_handle;
int
swim3_init
(
void
)
int
swim3_init
(
void
)
{
{
struct
device_node
*
swim
;
struct
device_node
*
swim
;
int
err
=
-
ENOMEM
;
int
i
;
int
i
;
floppy_devfs_handle
=
devfs_mk_dir
(
NULL
,
"floppy"
,
NULL
);
floppy_devfs_handle
=
devfs_mk_dir
(
NULL
,
"floppy"
,
NULL
);
...
@@ -1032,26 +1033,37 @@ int swim3_init(void)
...
@@ -1032,26 +1033,37 @@ int swim3_init(void)
swim
=
swim
->
next
;
swim
=
swim
->
next
;
}
}
if
(
floppy_count
>
0
)
if
(
!
floppy_count
)
{
return
-
ENODEV
;
if
(
register_blkdev
(
MAJOR_NR
,
"fd"
,
&
floppy_fops
))
{
printk
(
KERN_ERR
"Unable to get major %d for floppy
\n
"
,
for
(
i
=
0
;
i
<
floppy_count
;
i
++
)
{
MAJOR_NR
);
disks
[
i
]
=
alloc_disk
();
return
-
EBUSY
;
if
(
!
disks
[
i
])
}
goto
out
;
blk_init_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
),
do_fd_request
,
&
swim3_lock
);
for
(
i
=
0
;
i
<
floppy_count
;
i
++
)
{
struct
gendisk
*
disk
=
disks
+
i
;
disk
->
major
=
MAJOR_NR
;
disk
->
first_minor
=
i
;
disk
->
fops
=
&
floppy_fops
;
sprintf
(
disk
->
disk_name
,
"fd%d"
,
i
);
set_capacity
(
disk
,
2880
);
add_disk
(
disk
);
}
}
}
if
(
register_blkdev
(
MAJOR_NR
,
"fd"
,
&
floppy_fops
))
{
printk
(
KERN_ERR
"Unable to get major %d for floppy
\n
"
,
MAJOR_NR
);
err
=
-
EBUSY
;
goto
out
;
}
blk_init_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
),
do_fd_request
,
&
swim3_lock
);
for
(
i
=
0
;
i
<
floppy_count
;
i
++
)
{
struct
gendisk
*
disk
=
disks
[
i
];
disk
->
major
=
MAJOR_NR
;
disk
->
first_minor
=
i
;
disk
->
fops
=
&
floppy_fops
;
sprintf
(
disk
->
disk_name
,
"fd%d"
,
i
);
set_capacity
(
disk
,
2880
);
add_disk
(
disk
);
}
return
0
;
return
0
;
out:
while
(
i
--
)
put_disk
(
disks
[
i
]);
/* shouldn't we do something with results of swim_add_device()? */
return
err
;
}
}
static
int
swim3_add_device
(
struct
device_node
*
swim
)
static
int
swim3_add_device
(
struct
device_node
*
swim
)
...
@@ -1118,8 +1130,6 @@ static int swim3_add_device(struct device_node *swim)
...
@@ -1118,8 +1130,6 @@ static int swim3_add_device(struct device_node *swim)
init_timer
(
&
fs
->
timeout
);
init_timer
(
&
fs
->
timeout
);
do_floppy
=
NULL
;
printk
(
KERN_INFO
"fd%d: SWIM3 floppy controller %s
\n
"
,
floppy_count
,
printk
(
KERN_INFO
"fd%d: SWIM3 floppy controller %s
\n
"
,
floppy_count
,
mediabay
?
"in media bay"
:
""
);
mediabay
?
"in media bay"
:
""
);
sprintf
(
floppy_name
,
"%s%d"
,
floppy_devfs_handle
?
""
:
"floppy"
,
sprintf
(
floppy_name
,
"%s%d"
,
floppy_devfs_handle
?
""
:
"floppy"
,
...
...
drivers/block/swim_iop.c
View file @
26f6deaa
...
@@ -82,9 +82,6 @@ static struct swim_iop_req *current_req;
...
@@ -82,9 +82,6 @@ static struct swim_iop_req *current_req;
static
int
floppy_count
;
static
int
floppy_count
;
static
struct
floppy_state
floppy_states
[
MAX_FLOPPIES
];
static
struct
floppy_state
floppy_states
[
MAX_FLOPPIES
];
static
struct
gendisk
disks
[
2
];
static
spinlock_t
swim_iop_lock
=
SPIN_LOCK_UNLOCKED
;
static
spinlock_t
swim_iop_lock
=
SPIN_LOCK_UNLOCKED
;
static
char
*
drive_names
[
7
]
=
{
static
char
*
drive_names
[
7
]
=
{
...
@@ -190,9 +187,10 @@ int swimiop_init(void)
...
@@ -190,9 +187,10 @@ int swimiop_init(void)
}
}
printk
(
"SWIM-IOP: detected %d installed drives.
\n
"
,
floppy_count
);
printk
(
"SWIM-IOP: detected %d installed drives.
\n
"
,
floppy_count
);
do_floppy
=
NULL
;
for
(
i
=
0
;
i
<
floppy_count
;
i
++
)
{
for
(
i
=
0
;
i
<
floppy_count
;
i
++
)
{
struct
gendisk
*
disk
=
disks
+
i
;
struct
gendisk
*
disk
=
alloc_disk
();
if
(
!
disk
)
continue
;
disk
->
major
=
MAJOR_NR
;
disk
->
major
=
MAJOR_NR
;
disk
->
first_minor
=
i
;
disk
->
first_minor
=
i
;
disk
->
fops
=
&
floppy_fops
;
disk
->
fops
=
&
floppy_fops
;
...
...
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