diff options
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r-- | drivers/ide/ide-floppy.c | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 36c0b74a4e45..c949e98df4b6 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -1865,13 +1865,13 @@ static void idefloppy_setup (ide_drive_t *drive, idefloppy_floppy_t *floppy) | |||
1865 | idefloppy_add_settings(drive); | 1865 | idefloppy_add_settings(drive); |
1866 | } | 1866 | } |
1867 | 1867 | ||
1868 | static int idefloppy_cleanup (ide_drive_t *drive) | 1868 | static int ide_floppy_remove(struct device *dev) |
1869 | { | 1869 | { |
1870 | ide_drive_t *drive = to_ide_device(dev); | ||
1870 | idefloppy_floppy_t *floppy = drive->driver_data; | 1871 | idefloppy_floppy_t *floppy = drive->driver_data; |
1871 | struct gendisk *g = floppy->disk; | 1872 | struct gendisk *g = floppy->disk; |
1872 | 1873 | ||
1873 | if (ide_unregister_subdriver(drive)) | 1874 | ide_unregister_subdriver(drive, floppy->driver); |
1874 | return 1; | ||
1875 | 1875 | ||
1876 | del_gendisk(g); | 1876 | del_gendisk(g); |
1877 | 1877 | ||
@@ -1916,26 +1916,24 @@ static ide_proc_entry_t idefloppy_proc[] = { | |||
1916 | 1916 | ||
1917 | #endif /* CONFIG_PROC_FS */ | 1917 | #endif /* CONFIG_PROC_FS */ |
1918 | 1918 | ||
1919 | static int idefloppy_attach(ide_drive_t *drive); | 1919 | static int ide_floppy_probe(struct device *); |
1920 | 1920 | ||
1921 | /* | ||
1922 | * IDE subdriver functions, registered with ide.c | ||
1923 | */ | ||
1924 | static ide_driver_t idefloppy_driver = { | 1921 | static ide_driver_t idefloppy_driver = { |
1925 | .owner = THIS_MODULE, | 1922 | .owner = THIS_MODULE, |
1926 | .name = "ide-floppy", | 1923 | .gen_driver = { |
1924 | .name = "ide-floppy", | ||
1925 | .bus = &ide_bus_type, | ||
1926 | .probe = ide_floppy_probe, | ||
1927 | .remove = ide_floppy_remove, | ||
1928 | }, | ||
1927 | .version = IDEFLOPPY_VERSION, | 1929 | .version = IDEFLOPPY_VERSION, |
1928 | .media = ide_floppy, | 1930 | .media = ide_floppy, |
1929 | .busy = 0, | ||
1930 | .supports_dsc_overlap = 0, | 1931 | .supports_dsc_overlap = 0, |
1931 | .cleanup = idefloppy_cleanup, | ||
1932 | .do_request = idefloppy_do_request, | 1932 | .do_request = idefloppy_do_request, |
1933 | .end_request = idefloppy_do_end_request, | 1933 | .end_request = idefloppy_do_end_request, |
1934 | .error = __ide_error, | 1934 | .error = __ide_error, |
1935 | .abort = __ide_abort, | 1935 | .abort = __ide_abort, |
1936 | .proc = idefloppy_proc, | 1936 | .proc = idefloppy_proc, |
1937 | .attach = idefloppy_attach, | ||
1938 | .drives = LIST_HEAD_INIT(idefloppy_driver.drives), | ||
1939 | }; | 1937 | }; |
1940 | 1938 | ||
1941 | static int idefloppy_open(struct inode *inode, struct file *filp) | 1939 | static int idefloppy_open(struct inode *inode, struct file *filp) |
@@ -2122,8 +2120,9 @@ static struct block_device_operations idefloppy_ops = { | |||
2122 | .revalidate_disk= idefloppy_revalidate_disk | 2120 | .revalidate_disk= idefloppy_revalidate_disk |
2123 | }; | 2121 | }; |
2124 | 2122 | ||
2125 | static int idefloppy_attach (ide_drive_t *drive) | 2123 | static int ide_floppy_probe(struct device *dev) |
2126 | { | 2124 | { |
2125 | ide_drive_t *drive = to_ide_device(dev); | ||
2127 | idefloppy_floppy_t *floppy; | 2126 | idefloppy_floppy_t *floppy; |
2128 | struct gendisk *g; | 2127 | struct gendisk *g; |
2129 | 2128 | ||
@@ -2152,10 +2151,7 @@ static int idefloppy_attach (ide_drive_t *drive) | |||
2152 | 2151 | ||
2153 | ide_init_disk(g, drive); | 2152 | ide_init_disk(g, drive); |
2154 | 2153 | ||
2155 | if (ide_register_subdriver(drive, &idefloppy_driver)) { | 2154 | ide_register_subdriver(drive, &idefloppy_driver); |
2156 | printk (KERN_ERR "ide-floppy: %s: Failed to register the driver with ide.c\n", drive->name); | ||
2157 | goto out_put_disk; | ||
2158 | } | ||
2159 | 2155 | ||
2160 | memset(floppy, 0, sizeof(*floppy)); | 2156 | memset(floppy, 0, sizeof(*floppy)); |
2161 | 2157 | ||
@@ -2169,9 +2165,8 @@ static int idefloppy_attach (ide_drive_t *drive) | |||
2169 | 2165 | ||
2170 | drive->driver_data = floppy; | 2166 | drive->driver_data = floppy; |
2171 | 2167 | ||
2172 | DRIVER(drive)->busy++; | ||
2173 | idefloppy_setup (drive, floppy); | 2168 | idefloppy_setup (drive, floppy); |
2174 | DRIVER(drive)->busy--; | 2169 | |
2175 | g->minors = 1 << PARTN_BITS; | 2170 | g->minors = 1 << PARTN_BITS; |
2176 | g->driverfs_dev = &drive->gendev; | 2171 | g->driverfs_dev = &drive->gendev; |
2177 | strcpy(g->devfs_name, drive->devfs_name); | 2172 | strcpy(g->devfs_name, drive->devfs_name); |
@@ -2181,19 +2176,17 @@ static int idefloppy_attach (ide_drive_t *drive) | |||
2181 | add_disk(g); | 2176 | add_disk(g); |
2182 | return 0; | 2177 | return 0; |
2183 | 2178 | ||
2184 | out_put_disk: | ||
2185 | put_disk(g); | ||
2186 | out_free_floppy: | 2179 | out_free_floppy: |
2187 | kfree(floppy); | 2180 | kfree(floppy); |
2188 | failed: | 2181 | failed: |
2189 | return 1; | 2182 | return -ENODEV; |
2190 | } | 2183 | } |
2191 | 2184 | ||
2192 | MODULE_DESCRIPTION("ATAPI FLOPPY Driver"); | 2185 | MODULE_DESCRIPTION("ATAPI FLOPPY Driver"); |
2193 | 2186 | ||
2194 | static void __exit idefloppy_exit (void) | 2187 | static void __exit idefloppy_exit (void) |
2195 | { | 2188 | { |
2196 | ide_unregister_driver(&idefloppy_driver); | 2189 | driver_unregister(&idefloppy_driver.gen_driver); |
2197 | } | 2190 | } |
2198 | 2191 | ||
2199 | /* | 2192 | /* |
@@ -2202,8 +2195,7 @@ static void __exit idefloppy_exit (void) | |||
2202 | static int idefloppy_init (void) | 2195 | static int idefloppy_init (void) |
2203 | { | 2196 | { |
2204 | printk("ide-floppy driver " IDEFLOPPY_VERSION "\n"); | 2197 | printk("ide-floppy driver " IDEFLOPPY_VERSION "\n"); |
2205 | ide_register_driver(&idefloppy_driver); | 2198 | return driver_register(&idefloppy_driver.gen_driver); |
2206 | return 0; | ||
2207 | } | 2199 | } |
2208 | 2200 | ||
2209 | module_init(idefloppy_init); | 2201 | module_init(idefloppy_init); |