patch-2.4.6 linux/drivers/block/swim3.c
Next file: linux/drivers/bluetooth/Config.in
Previous file: linux/drivers/block/ps2esdi.c
Back to the patch index
Back to the overall index
- Lines: 68
- Date:
Wed Jun 27 13:37:35 2001
- Orig file:
v2.4.5/linux/drivers/block/swim3.c
- Orig date:
Tue May 22 10:23:16 2001
diff -u --recursive --new-file v2.4.5/linux/drivers/block/swim3.c linux/drivers/block/swim3.c
@@ -33,6 +33,7 @@
#define MAJOR_NR FLOPPY_MAJOR
#include <linux/blk.h>
+#include <linux/devfs_fs_kernel.h>
static int floppy_blocksizes[2] = {512,512};
static int floppy_sizes[2] = {2880,2880};
@@ -248,10 +249,7 @@
int swim3_init(void);
#ifndef CONFIG_PMAC_PBOOK
-static inline int check_media_bay(struct device_node *which_bay, int what)
-{
- return 1;
-}
+#define check_media_bay(which, what) 1
#endif
static void swim3_select(struct floppy_state *fs, int sel)
@@ -1014,10 +1012,14 @@
revalidate: floppy_revalidate,
};
+static devfs_handle_t floppy_devfs_handle;
+
int swim3_init(void)
{
struct device_node *swim;
+ floppy_devfs_handle = devfs_mk_dir(NULL, "floppy", NULL);
+
swim = find_devices("floppy");
while (swim && (floppy_count < MAX_FLOPPIES))
{
@@ -1034,7 +1036,7 @@
if (floppy_count > 0)
{
- if (register_blkdev(MAJOR_NR, "fd", &floppy_fops)) {
+ if (devfs_register_blkdev(MAJOR_NR, "fd", &floppy_fops)) {
printk(KERN_ERR "Unable to get major %d for floppy\n",
MAJOR_NR);
return -EBUSY;
@@ -1051,7 +1053,9 @@
{
struct device_node *mediabay;
struct floppy_state *fs = &floppy_states[floppy_count];
-
+ char floppy_name[16];
+ devfs_handle_t floppy_handle;
+
if (swim->n_addrs < 2)
{
printk(KERN_INFO "swim3: expecting 2 addrs (n_addrs:%d, n_intrs:%d)\n",
@@ -1108,6 +1112,12 @@
printk(KERN_INFO "fd%d: SWIM3 floppy controller %s\n", floppy_count,
mediabay ? "in media bay" : "");
+ sprintf(floppy_name, "%s%d", floppy_devfs_handle ? "" : "floppy",
+ floppy_count);
+ floppy_handle = devfs_register(floppy_devfs_handle, floppy_name,
+ DEVFS_FL_DEFAULT, MAJOR_NR, floppy_count,
+ S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |S_IWGRP,
+ &floppy_fops, NULL);
floppy_count++;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)