Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7208
b: refs/heads/master
c: 94fd0db
h: refs/heads/master
v: v3
  • Loading branch information
Hannes Reinecke authored and Greg Kroah-Hartman committed Sep 5, 2005
1 parent e037d67 commit dbfce2e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 76d1ce00bdd76c2987fbfb763cd40447413a55b3
refs/heads/master: 94fd0db7bfb4a03da202fd426d4e8e7eab42ab86
42 changes: 29 additions & 13 deletions trunk/drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ static struct floppy_struct user_params[N_DRIVE];

static sector_t floppy_sizes[256];

static char floppy_device_name[] = "floppy";

/*
* The driver is trying to determine the correct media format
* while probing is set. rw_interrupt() clears it after a
Expand Down Expand Up @@ -4191,18 +4193,25 @@ static int __init floppy_setup(char *str)

static int have_no_fdc = -ENODEV;

static ssize_t floppy_cmos_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct platform_device *p = container_of(dev,struct platform_device,dev);
int drive = p->id;
ssize_t retval;

retval = sprintf(buf,"%X\n", UDP->cmos);

return retval;
}

DEVICE_ATTR(cmos,S_IRUGO,floppy_cmos_show,NULL);

static void floppy_device_release(struct device *dev)
{
complete(&device_release);
}

static struct platform_device floppy_device = {
.name = "floppy",
.id = 0,
.dev = {
.release = floppy_device_release,
}
};
static struct platform_device floppy_device[N_DRIVE];

static struct kobject *floppy_find(dev_t dev, int *part, void *data)
{
Expand Down Expand Up @@ -4370,20 +4379,26 @@ static int __init floppy_init(void)
goto out_flush_work;
}

err = platform_device_register(&floppy_device);
if (err)
goto out_flush_work;

for (drive = 0; drive < N_DRIVE; drive++) {
if (!(allowed_drive_mask & (1 << drive)))
continue;
if (fdc_state[FDC(drive)].version == FDC_NONE)
continue;

floppy_device[drive].name = floppy_device_name;
floppy_device[drive].id = drive;
floppy_device[drive].dev.release = floppy_device_release;

err = platform_device_register(&floppy_device[drive]);
if (err)
goto out_flush_work;

device_create_file(&floppy_device[drive].dev,&dev_attr_cmos);
/* to be cleaned up... */
disks[drive]->private_data = (void *)(long)drive;
disks[drive]->queue = floppy_queue;
disks[drive]->flags |= GENHD_FL_REMOVABLE;
disks[drive]->driverfs_dev = &floppy_device.dev;
disks[drive]->driverfs_dev = &floppy_device[drive].dev;
add_disk(disks[drive]);
}

Expand Down Expand Up @@ -4603,10 +4618,11 @@ void cleanup_module(void)
fdc_state[FDC(drive)].version != FDC_NONE) {
del_gendisk(disks[drive]);
unregister_devfs_entries(drive);
device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
platform_device_unregister(&floppy_device[drive]);
}
put_disk(disks[drive]);
}
platform_device_unregister(&floppy_device);
devfs_remove("floppy");

del_timer_sync(&fd_timeout);
Expand Down

0 comments on commit dbfce2e

Please sign in to comment.