diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-02-25 15:22:06 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-02-25 15:22:06 -0500 |
| commit | a36e4f0cab6311110d1703eafb325baead9caff8 (patch) | |
| tree | 09c0bda0639ea2ee36fb8f49563863dfad5dc32b | |
| parent | 0b0a0806b0d8635e046bf533225a25903b1cddce (diff) | |
| parent | 8fed43684174b68f04d01d1210fd00536af790df (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6:
ide: fix refcounting in device drivers
ide-cd: document capacity hack
it821x: remove dead URL
atiixp: fix missing parentheses
amd74xx: device/vendor confusion
ide: ide.c 'clear' fix, update "ide=nodma" documentation
| -rw-r--r-- | Documentation/kernel-parameters.txt | 6 | ||||
| -rw-r--r-- | drivers/ide/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/ide/amd74xx.c | 2 | ||||
| -rw-r--r-- | drivers/ide/atiixp.c | 4 | ||||
| -rw-r--r-- | drivers/ide/ide-cd.c | 35 | ||||
| -rw-r--r-- | drivers/ide/ide-cd.h | 2 | ||||
| -rw-r--r-- | drivers/ide/ide-gd.c | 26 | ||||
| -rw-r--r-- | drivers/ide/ide-gd.h | 2 | ||||
| -rw-r--r-- | drivers/ide/ide-tape.c | 29 | ||||
| -rw-r--r-- | drivers/ide/ide.c | 11 | ||||
| -rw-r--r-- | drivers/ide/it821x.c | 5 | ||||
| -rw-r--r-- | include/linux/ide.h | 2 |
12 files changed, 83 insertions, 43 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 319785b6dcb1..0ed3234125e3 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -868,8 +868,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
| 868 | icn= [HW,ISDN] | 868 | icn= [HW,ISDN] |
| 869 | Format: <io>[,<membase>[,<icn_id>[,<icn_id2>]]] | 869 | Format: <io>[,<membase>[,<icn_id>[,<icn_id2>]]] |
| 870 | 870 | ||
| 871 | ide= [HW] (E)IDE subsystem | 871 | ide-core.nodma= [HW] (E)IDE subsystem |
| 872 | Format: ide=nodma or ide=doubler | 872 | Format: =0.0 to prevent dma on hda, =0.1 hdb =1.0 hdc |
| 873 | .vlb_clock .pci_clock .noflush .noprobe .nowerr .cdrom | ||
| 874 | .chs .ignore_cable are additional options | ||
| 873 | See Documentation/ide/ide.txt. | 875 | See Documentation/ide/ide.txt. |
| 874 | 876 | ||
| 875 | idebus= [HW] (E)IDE subsystem - VLB/PCI bus speed | 877 | idebus= [HW] (E)IDE subsystem - VLB/PCI bus speed |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 3dad2299d9c5..e072903b12f0 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
| @@ -46,7 +46,7 @@ menuconfig IDE | |||
| 46 | SMART parameters from disk drives. | 46 | SMART parameters from disk drives. |
| 47 | 47 | ||
| 48 | To compile this driver as a module, choose M here: the | 48 | To compile this driver as a module, choose M here: the |
| 49 | module will be called ide. | 49 | module will be called ide-core.ko. |
| 50 | 50 | ||
| 51 | For further information, please read <file:Documentation/ide/ide.txt>. | 51 | For further information, please read <file:Documentation/ide/ide.txt>. |
| 52 | 52 | ||
diff --git a/drivers/ide/amd74xx.c b/drivers/ide/amd74xx.c index 69660a431cd9..77267c859965 100644 --- a/drivers/ide/amd74xx.c +++ b/drivers/ide/amd74xx.c | |||
| @@ -166,7 +166,7 @@ static unsigned int init_chipset_amd74xx(struct pci_dev *dev) | |||
| 166 | * Check for broken FIFO support. | 166 | * Check for broken FIFO support. |
| 167 | */ | 167 | */ |
| 168 | if (dev->vendor == PCI_VENDOR_ID_AMD && | 168 | if (dev->vendor == PCI_VENDOR_ID_AMD && |
| 169 | dev->vendor == PCI_DEVICE_ID_AMD_VIPER_7411) | 169 | dev->device == PCI_DEVICE_ID_AMD_VIPER_7411) |
| 170 | t &= 0x0f; | 170 | t &= 0x0f; |
| 171 | else | 171 | else |
| 172 | t |= 0xf0; | 172 | t |= 0xf0; |
diff --git a/drivers/ide/atiixp.c b/drivers/ide/atiixp.c index b2735d28f5cc..ecd1e62ca91a 100644 --- a/drivers/ide/atiixp.c +++ b/drivers/ide/atiixp.c | |||
| @@ -52,7 +52,7 @@ static void atiixp_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 52 | { | 52 | { |
| 53 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); | 53 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
| 54 | unsigned long flags; | 54 | unsigned long flags; |
| 55 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; | 55 | int timing_shift = (drive->dn ^ 1) * 8; |
| 56 | u32 pio_timing_data; | 56 | u32 pio_timing_data; |
| 57 | u16 pio_mode_data; | 57 | u16 pio_mode_data; |
| 58 | 58 | ||
| @@ -85,7 +85,7 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
| 85 | { | 85 | { |
| 86 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); | 86 | struct pci_dev *dev = to_pci_dev(drive->hwif->dev); |
| 87 | unsigned long flags; | 87 | unsigned long flags; |
| 88 | int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8; | 88 | int timing_shift = (drive->dn ^ 1) * 8; |
| 89 | u32 tmp32; | 89 | u32 tmp32; |
| 90 | u16 tmp16; | 90 | u16 tmp16; |
| 91 | u16 udma_ctl = 0; | 91 | u16 udma_ctl = 0; |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 0bfeb0c79d6e..ddfbea41d296 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
| @@ -55,7 +55,7 @@ | |||
| 55 | 55 | ||
| 56 | static DEFINE_MUTEX(idecd_ref_mutex); | 56 | static DEFINE_MUTEX(idecd_ref_mutex); |
| 57 | 57 | ||
| 58 | static void ide_cd_release(struct kref *); | 58 | static void ide_cd_release(struct device *); |
| 59 | 59 | ||
| 60 | static struct cdrom_info *ide_cd_get(struct gendisk *disk) | 60 | static struct cdrom_info *ide_cd_get(struct gendisk *disk) |
| 61 | { | 61 | { |
| @@ -67,7 +67,7 @@ static struct cdrom_info *ide_cd_get(struct gendisk *disk) | |||
| 67 | if (ide_device_get(cd->drive)) | 67 | if (ide_device_get(cd->drive)) |
| 68 | cd = NULL; | 68 | cd = NULL; |
| 69 | else | 69 | else |
| 70 | kref_get(&cd->kref); | 70 | get_device(&cd->dev); |
| 71 | 71 | ||
| 72 | } | 72 | } |
| 73 | mutex_unlock(&idecd_ref_mutex); | 73 | mutex_unlock(&idecd_ref_mutex); |
| @@ -79,7 +79,7 @@ static void ide_cd_put(struct cdrom_info *cd) | |||
| 79 | ide_drive_t *drive = cd->drive; | 79 | ide_drive_t *drive = cd->drive; |
| 80 | 80 | ||
| 81 | mutex_lock(&idecd_ref_mutex); | 81 | mutex_lock(&idecd_ref_mutex); |
| 82 | kref_put(&cd->kref, ide_cd_release); | 82 | put_device(&cd->dev); |
| 83 | ide_device_put(drive); | 83 | ide_device_put(drive); |
| 84 | mutex_unlock(&idecd_ref_mutex); | 84 | mutex_unlock(&idecd_ref_mutex); |
| 85 | } | 85 | } |
| @@ -194,6 +194,14 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
| 194 | bio_sectors = max(bio_sectors(failed_command->bio), 4U); | 194 | bio_sectors = max(bio_sectors(failed_command->bio), 4U); |
| 195 | sector &= ~(bio_sectors - 1); | 195 | sector &= ~(bio_sectors - 1); |
| 196 | 196 | ||
| 197 | /* | ||
| 198 | * The SCSI specification allows for the value | ||
| 199 | * returned by READ CAPACITY to be up to 75 2K | ||
| 200 | * sectors past the last readable block. | ||
| 201 | * Therefore, if we hit a medium error within the | ||
| 202 | * last 75 2K sectors, we decrease the saved size | ||
| 203 | * value. | ||
| 204 | */ | ||
| 197 | if (sector < get_capacity(info->disk) && | 205 | if (sector < get_capacity(info->disk) && |
| 198 | drive->probed_capacity - sector < 4 * 75) | 206 | drive->probed_capacity - sector < 4 * 75) |
| 199 | set_capacity(info->disk, sector); | 207 | set_capacity(info->disk, sector); |
| @@ -1790,15 +1798,17 @@ static void ide_cd_remove(ide_drive_t *drive) | |||
| 1790 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | 1798 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); |
| 1791 | 1799 | ||
| 1792 | ide_proc_unregister_driver(drive, info->driver); | 1800 | ide_proc_unregister_driver(drive, info->driver); |
| 1793 | 1801 | device_del(&info->dev); | |
| 1794 | del_gendisk(info->disk); | 1802 | del_gendisk(info->disk); |
| 1795 | 1803 | ||
| 1796 | ide_cd_put(info); | 1804 | mutex_lock(&idecd_ref_mutex); |
| 1805 | put_device(&info->dev); | ||
| 1806 | mutex_unlock(&idecd_ref_mutex); | ||
| 1797 | } | 1807 | } |
| 1798 | 1808 | ||
| 1799 | static void ide_cd_release(struct kref *kref) | 1809 | static void ide_cd_release(struct device *dev) |
| 1800 | { | 1810 | { |
| 1801 | struct cdrom_info *info = to_ide_drv(kref, cdrom_info); | 1811 | struct cdrom_info *info = to_ide_drv(dev, cdrom_info); |
| 1802 | struct cdrom_device_info *devinfo = &info->devinfo; | 1812 | struct cdrom_device_info *devinfo = &info->devinfo; |
| 1803 | ide_drive_t *drive = info->drive; | 1813 | ide_drive_t *drive = info->drive; |
| 1804 | struct gendisk *g = info->disk; | 1814 | struct gendisk *g = info->disk; |
| @@ -1997,7 +2007,12 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
| 1997 | 2007 | ||
| 1998 | ide_init_disk(g, drive); | 2008 | ide_init_disk(g, drive); |
| 1999 | 2009 | ||
| 2000 | kref_init(&info->kref); | 2010 | info->dev.parent = &drive->gendev; |
| 2011 | info->dev.release = ide_cd_release; | ||
| 2012 | dev_set_name(&info->dev, dev_name(&drive->gendev)); | ||
| 2013 | |||
| 2014 | if (device_register(&info->dev)) | ||
| 2015 | goto out_free_disk; | ||
| 2001 | 2016 | ||
| 2002 | info->drive = drive; | 2017 | info->drive = drive; |
| 2003 | info->driver = &ide_cdrom_driver; | 2018 | info->driver = &ide_cdrom_driver; |
| @@ -2011,7 +2026,7 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
| 2011 | g->driverfs_dev = &drive->gendev; | 2026 | g->driverfs_dev = &drive->gendev; |
| 2012 | g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; | 2027 | g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; |
| 2013 | if (ide_cdrom_setup(drive)) { | 2028 | if (ide_cdrom_setup(drive)) { |
| 2014 | ide_cd_release(&info->kref); | 2029 | put_device(&info->dev); |
| 2015 | goto failed; | 2030 | goto failed; |
| 2016 | } | 2031 | } |
| 2017 | 2032 | ||
| @@ -2021,6 +2036,8 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
| 2021 | add_disk(g); | 2036 | add_disk(g); |
| 2022 | return 0; | 2037 | return 0; |
| 2023 | 2038 | ||
| 2039 | out_free_disk: | ||
| 2040 | put_disk(g); | ||
| 2024 | out_free_cd: | 2041 | out_free_cd: |
| 2025 | kfree(info); | 2042 | kfree(info); |
| 2026 | failed: | 2043 | failed: |
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index ac40d6cb90a2..c878bfcf1116 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h | |||
| @@ -80,7 +80,7 @@ struct cdrom_info { | |||
| 80 | ide_drive_t *drive; | 80 | ide_drive_t *drive; |
| 81 | struct ide_driver *driver; | 81 | struct ide_driver *driver; |
| 82 | struct gendisk *disk; | 82 | struct gendisk *disk; |
| 83 | struct kref kref; | 83 | struct device dev; |
| 84 | 84 | ||
| 85 | /* Buffer for table of contents. NULL if we haven't allocated | 85 | /* Buffer for table of contents. NULL if we haven't allocated |
| 86 | a TOC buffer for this device yet. */ | 86 | a TOC buffer for this device yet. */ |
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index 7857b209c6df..047109419902 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c | |||
| @@ -25,7 +25,7 @@ module_param(debug_mask, ulong, 0644); | |||
| 25 | 25 | ||
| 26 | static DEFINE_MUTEX(ide_disk_ref_mutex); | 26 | static DEFINE_MUTEX(ide_disk_ref_mutex); |
| 27 | 27 | ||
| 28 | static void ide_disk_release(struct kref *); | 28 | static void ide_disk_release(struct device *); |
| 29 | 29 | ||
| 30 | static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) | 30 | static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) |
| 31 | { | 31 | { |
| @@ -37,7 +37,7 @@ static struct ide_disk_obj *ide_disk_get(struct gendisk *disk) | |||
| 37 | if (ide_device_get(idkp->drive)) | 37 | if (ide_device_get(idkp->drive)) |
| 38 | idkp = NULL; | 38 | idkp = NULL; |
| 39 | else | 39 | else |
| 40 | kref_get(&idkp->kref); | 40 | get_device(&idkp->dev); |
| 41 | } | 41 | } |
| 42 | mutex_unlock(&ide_disk_ref_mutex); | 42 | mutex_unlock(&ide_disk_ref_mutex); |
| 43 | return idkp; | 43 | return idkp; |
| @@ -48,7 +48,7 @@ static void ide_disk_put(struct ide_disk_obj *idkp) | |||
| 48 | ide_drive_t *drive = idkp->drive; | 48 | ide_drive_t *drive = idkp->drive; |
| 49 | 49 | ||
| 50 | mutex_lock(&ide_disk_ref_mutex); | 50 | mutex_lock(&ide_disk_ref_mutex); |
| 51 | kref_put(&idkp->kref, ide_disk_release); | 51 | put_device(&idkp->dev); |
| 52 | ide_device_put(drive); | 52 | ide_device_put(drive); |
| 53 | mutex_unlock(&ide_disk_ref_mutex); | 53 | mutex_unlock(&ide_disk_ref_mutex); |
| 54 | } | 54 | } |
| @@ -66,17 +66,18 @@ static void ide_gd_remove(ide_drive_t *drive) | |||
| 66 | struct gendisk *g = idkp->disk; | 66 | struct gendisk *g = idkp->disk; |
| 67 | 67 | ||
| 68 | ide_proc_unregister_driver(drive, idkp->driver); | 68 | ide_proc_unregister_driver(drive, idkp->driver); |
| 69 | 69 | device_del(&idkp->dev); | |
| 70 | del_gendisk(g); | 70 | del_gendisk(g); |
| 71 | |||
| 72 | drive->disk_ops->flush(drive); | 71 | drive->disk_ops->flush(drive); |
| 73 | 72 | ||
| 74 | ide_disk_put(idkp); | 73 | mutex_lock(&ide_disk_ref_mutex); |
| 74 | put_device(&idkp->dev); | ||
| 75 | mutex_unlock(&ide_disk_ref_mutex); | ||
| 75 | } | 76 | } |
| 76 | 77 | ||
| 77 | static void ide_disk_release(struct kref *kref) | 78 | static void ide_disk_release(struct device *dev) |
| 78 | { | 79 | { |
| 79 | struct ide_disk_obj *idkp = to_ide_drv(kref, ide_disk_obj); | 80 | struct ide_disk_obj *idkp = to_ide_drv(dev, ide_disk_obj); |
| 80 | ide_drive_t *drive = idkp->drive; | 81 | ide_drive_t *drive = idkp->drive; |
| 81 | struct gendisk *g = idkp->disk; | 82 | struct gendisk *g = idkp->disk; |
| 82 | 83 | ||
| @@ -348,7 +349,12 @@ static int ide_gd_probe(ide_drive_t *drive) | |||
| 348 | 349 | ||
| 349 | ide_init_disk(g, drive); | 350 | ide_init_disk(g, drive); |
| 350 | 351 | ||
| 351 | kref_init(&idkp->kref); | 352 | idkp->dev.parent = &drive->gendev; |
| 353 | idkp->dev.release = ide_disk_release; | ||
| 354 | dev_set_name(&idkp->dev, dev_name(&drive->gendev)); | ||
| 355 | |||
| 356 | if (device_register(&idkp->dev)) | ||
| 357 | goto out_free_disk; | ||
| 352 | 358 | ||
| 353 | idkp->drive = drive; | 359 | idkp->drive = drive; |
| 354 | idkp->driver = &ide_gd_driver; | 360 | idkp->driver = &ide_gd_driver; |
| @@ -373,6 +379,8 @@ static int ide_gd_probe(ide_drive_t *drive) | |||
| 373 | add_disk(g); | 379 | add_disk(g); |
| 374 | return 0; | 380 | return 0; |
| 375 | 381 | ||
| 382 | out_free_disk: | ||
| 383 | put_disk(g); | ||
| 376 | out_free_idkp: | 384 | out_free_idkp: |
| 377 | kfree(idkp); | 385 | kfree(idkp); |
| 378 | failed: | 386 | failed: |
diff --git a/drivers/ide/ide-gd.h b/drivers/ide/ide-gd.h index a86779f0756b..b604bdd318a1 100644 --- a/drivers/ide/ide-gd.h +++ b/drivers/ide/ide-gd.h | |||
| @@ -17,7 +17,7 @@ struct ide_disk_obj { | |||
| 17 | ide_drive_t *drive; | 17 | ide_drive_t *drive; |
| 18 | struct ide_driver *driver; | 18 | struct ide_driver *driver; |
| 19 | struct gendisk *disk; | 19 | struct gendisk *disk; |
| 20 | struct kref kref; | 20 | struct device dev; |
| 21 | unsigned int openers; /* protected by BKL for now */ | 21 | unsigned int openers; /* protected by BKL for now */ |
| 22 | 22 | ||
| 23 | /* Last failed packet command */ | 23 | /* Last failed packet command */ |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index d7ecd3c79757..bb450a7608c2 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
| @@ -169,7 +169,7 @@ typedef struct ide_tape_obj { | |||
| 169 | ide_drive_t *drive; | 169 | ide_drive_t *drive; |
| 170 | struct ide_driver *driver; | 170 | struct ide_driver *driver; |
| 171 | struct gendisk *disk; | 171 | struct gendisk *disk; |
| 172 | struct kref kref; | 172 | struct device dev; |
| 173 | 173 | ||
| 174 | /* | 174 | /* |
| 175 | * failed_pc points to the last failed packet command, or contains | 175 | * failed_pc points to the last failed packet command, or contains |
| @@ -267,7 +267,7 @@ static DEFINE_MUTEX(idetape_ref_mutex); | |||
| 267 | 267 | ||
| 268 | static struct class *idetape_sysfs_class; | 268 | static struct class *idetape_sysfs_class; |
| 269 | 269 | ||
| 270 | static void ide_tape_release(struct kref *); | 270 | static void ide_tape_release(struct device *); |
| 271 | 271 | ||
| 272 | static struct ide_tape_obj *ide_tape_get(struct gendisk *disk) | 272 | static struct ide_tape_obj *ide_tape_get(struct gendisk *disk) |
| 273 | { | 273 | { |
| @@ -279,7 +279,7 @@ static struct ide_tape_obj *ide_tape_get(struct gendisk *disk) | |||
| 279 | if (ide_device_get(tape->drive)) | 279 | if (ide_device_get(tape->drive)) |
| 280 | tape = NULL; | 280 | tape = NULL; |
| 281 | else | 281 | else |
| 282 | kref_get(&tape->kref); | 282 | get_device(&tape->dev); |
| 283 | } | 283 | } |
| 284 | mutex_unlock(&idetape_ref_mutex); | 284 | mutex_unlock(&idetape_ref_mutex); |
| 285 | return tape; | 285 | return tape; |
| @@ -290,7 +290,7 @@ static void ide_tape_put(struct ide_tape_obj *tape) | |||
| 290 | ide_drive_t *drive = tape->drive; | 290 | ide_drive_t *drive = tape->drive; |
| 291 | 291 | ||
| 292 | mutex_lock(&idetape_ref_mutex); | 292 | mutex_lock(&idetape_ref_mutex); |
| 293 | kref_put(&tape->kref, ide_tape_release); | 293 | put_device(&tape->dev); |
| 294 | ide_device_put(drive); | 294 | ide_device_put(drive); |
| 295 | mutex_unlock(&idetape_ref_mutex); | 295 | mutex_unlock(&idetape_ref_mutex); |
| 296 | } | 296 | } |
| @@ -308,7 +308,7 @@ static struct ide_tape_obj *ide_tape_chrdev_get(unsigned int i) | |||
| 308 | mutex_lock(&idetape_ref_mutex); | 308 | mutex_lock(&idetape_ref_mutex); |
| 309 | tape = idetape_devs[i]; | 309 | tape = idetape_devs[i]; |
| 310 | if (tape) | 310 | if (tape) |
| 311 | kref_get(&tape->kref); | 311 | get_device(&tape->dev); |
| 312 | mutex_unlock(&idetape_ref_mutex); | 312 | mutex_unlock(&idetape_ref_mutex); |
| 313 | return tape; | 313 | return tape; |
| 314 | } | 314 | } |
| @@ -2256,15 +2256,17 @@ static void ide_tape_remove(ide_drive_t *drive) | |||
| 2256 | idetape_tape_t *tape = drive->driver_data; | 2256 | idetape_tape_t *tape = drive->driver_data; |
| 2257 | 2257 | ||
| 2258 | ide_proc_unregister_driver(drive, tape->driver); | 2258 | ide_proc_unregister_driver(drive, tape->driver); |
| 2259 | 2259 | device_del(&tape->dev); | |
| 2260 | ide_unregister_region(tape->disk); | 2260 | ide_unregister_region(tape->disk); |
| 2261 | 2261 | ||
| 2262 | ide_tape_put(tape); | 2262 | mutex_lock(&idetape_ref_mutex); |
| 2263 | put_device(&tape->dev); | ||
| 2264 | mutex_unlock(&idetape_ref_mutex); | ||
| 2263 | } | 2265 | } |
| 2264 | 2266 | ||
| 2265 | static void ide_tape_release(struct kref *kref) | 2267 | static void ide_tape_release(struct device *dev) |
| 2266 | { | 2268 | { |
| 2267 | struct ide_tape_obj *tape = to_ide_drv(kref, ide_tape_obj); | 2269 | struct ide_tape_obj *tape = to_ide_drv(dev, ide_tape_obj); |
| 2268 | ide_drive_t *drive = tape->drive; | 2270 | ide_drive_t *drive = tape->drive; |
| 2269 | struct gendisk *g = tape->disk; | 2271 | struct gendisk *g = tape->disk; |
| 2270 | 2272 | ||
| @@ -2407,7 +2409,12 @@ static int ide_tape_probe(ide_drive_t *drive) | |||
| 2407 | 2409 | ||
| 2408 | ide_init_disk(g, drive); | 2410 | ide_init_disk(g, drive); |
| 2409 | 2411 | ||
| 2410 | kref_init(&tape->kref); | 2412 | tape->dev.parent = &drive->gendev; |
| 2413 | tape->dev.release = ide_tape_release; | ||
| 2414 | dev_set_name(&tape->dev, dev_name(&drive->gendev)); | ||
| 2415 | |||
| 2416 | if (device_register(&tape->dev)) | ||
| 2417 | goto out_free_disk; | ||
| 2411 | 2418 | ||
| 2412 | tape->drive = drive; | 2419 | tape->drive = drive; |
| 2413 | tape->driver = &idetape_driver; | 2420 | tape->driver = &idetape_driver; |
| @@ -2436,6 +2443,8 @@ static int ide_tape_probe(ide_drive_t *drive) | |||
| 2436 | 2443 | ||
| 2437 | return 0; | 2444 | return 0; |
| 2438 | 2445 | ||
| 2446 | out_free_disk: | ||
| 2447 | put_disk(g); | ||
| 2439 | out_free_tape: | 2448 | out_free_tape: |
| 2440 | kfree(tape); | 2449 | kfree(tape); |
| 2441 | failed: | 2450 | failed: |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 258805da15c3..0920e3b0c962 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
| @@ -337,6 +337,7 @@ static int ide_set_dev_param_mask(const char *s, struct kernel_param *kp) | |||
| 337 | int a, b, i, j = 1; | 337 | int a, b, i, j = 1; |
| 338 | unsigned int *dev_param_mask = (unsigned int *)kp->arg; | 338 | unsigned int *dev_param_mask = (unsigned int *)kp->arg; |
| 339 | 339 | ||
| 340 | /* controller . device (0 or 1) [ : 1 (set) | 0 (clear) ] */ | ||
| 340 | if (sscanf(s, "%d.%d:%d", &a, &b, &j) != 3 && | 341 | if (sscanf(s, "%d.%d:%d", &a, &b, &j) != 3 && |
| 341 | sscanf(s, "%d.%d", &a, &b) != 2) | 342 | sscanf(s, "%d.%d", &a, &b) != 2) |
| 342 | return -EINVAL; | 343 | return -EINVAL; |
| @@ -349,7 +350,7 @@ static int ide_set_dev_param_mask(const char *s, struct kernel_param *kp) | |||
| 349 | if (j) | 350 | if (j) |
| 350 | *dev_param_mask |= (1 << i); | 351 | *dev_param_mask |= (1 << i); |
| 351 | else | 352 | else |
| 352 | *dev_param_mask &= (1 << i); | 353 | *dev_param_mask &= ~(1 << i); |
| 353 | 354 | ||
| 354 | return 0; | 355 | return 0; |
| 355 | } | 356 | } |
| @@ -392,6 +393,8 @@ static int ide_set_disk_chs(const char *str, struct kernel_param *kp) | |||
| 392 | { | 393 | { |
| 393 | int a, b, c = 0, h = 0, s = 0, i, j = 1; | 394 | int a, b, c = 0, h = 0, s = 0, i, j = 1; |
| 394 | 395 | ||
| 396 | /* controller . device (0 or 1) : Cylinders , Heads , Sectors */ | ||
| 397 | /* controller . device (0 or 1) : 1 (use CHS) | 0 (ignore CHS) */ | ||
| 395 | if (sscanf(str, "%d.%d:%d,%d,%d", &a, &b, &c, &h, &s) != 5 && | 398 | if (sscanf(str, "%d.%d:%d,%d,%d", &a, &b, &c, &h, &s) != 5 && |
| 396 | sscanf(str, "%d.%d:%d", &a, &b, &j) != 3) | 399 | sscanf(str, "%d.%d:%d", &a, &b, &j) != 3) |
| 397 | return -EINVAL; | 400 | return -EINVAL; |
| @@ -407,7 +410,7 @@ static int ide_set_disk_chs(const char *str, struct kernel_param *kp) | |||
| 407 | if (j) | 410 | if (j) |
| 408 | ide_disks |= (1 << i); | 411 | ide_disks |= (1 << i); |
| 409 | else | 412 | else |
| 410 | ide_disks &= (1 << i); | 413 | ide_disks &= ~(1 << i); |
| 411 | 414 | ||
| 412 | ide_disks_chs[i].cyl = c; | 415 | ide_disks_chs[i].cyl = c; |
| 413 | ide_disks_chs[i].head = h; | 416 | ide_disks_chs[i].head = h; |
| @@ -469,6 +472,8 @@ static int ide_set_ignore_cable(const char *s, struct kernel_param *kp) | |||
| 469 | { | 472 | { |
| 470 | int i, j = 1; | 473 | int i, j = 1; |
| 471 | 474 | ||
| 475 | /* controller (ignore) */ | ||
| 476 | /* controller : 1 (ignore) | 0 (use) */ | ||
| 472 | if (sscanf(s, "%d:%d", &i, &j) != 2 && sscanf(s, "%d", &i) != 1) | 477 | if (sscanf(s, "%d:%d", &i, &j) != 2 && sscanf(s, "%d", &i) != 1) |
| 473 | return -EINVAL; | 478 | return -EINVAL; |
| 474 | 479 | ||
| @@ -478,7 +483,7 @@ static int ide_set_ignore_cable(const char *s, struct kernel_param *kp) | |||
| 478 | if (j) | 483 | if (j) |
| 479 | ide_ignore_cable |= (1 << i); | 484 | ide_ignore_cable |= (1 << i); |
| 480 | else | 485 | else |
| 481 | ide_ignore_cable &= (1 << i); | 486 | ide_ignore_cable &= ~(1 << i); |
| 482 | 487 | ||
| 483 | return 0; | 488 | return 0; |
| 484 | } | 489 | } |
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c index e1c4f5437396..13b8153112ed 100644 --- a/drivers/ide/it821x.c +++ b/drivers/ide/it821x.c | |||
| @@ -5,9 +5,8 @@ | |||
| 5 | * May be copied or modified under the terms of the GNU General Public License | 5 | * May be copied or modified under the terms of the GNU General Public License |
| 6 | * Based in part on the ITE vendor provided SCSI driver. | 6 | * Based in part on the ITE vendor provided SCSI driver. |
| 7 | * | 7 | * |
| 8 | * Documentation available from | 8 | * Documentation: |
| 9 | * http://www.ite.com.tw/pc/IT8212F_V04.pdf | 9 | * Datasheet is freely available, some other documents under NDA. |
| 10 | * Some other documents are NDA. | ||
| 11 | * | 10 | * |
| 12 | * The ITE8212 isn't exactly a standard IDE controller. It has two | 11 | * The ITE8212 isn't exactly a standard IDE controller. It has two |
| 13 | * modes. In pass through mode then it is an IDE controller. In its smart | 12 | * modes. In pass through mode then it is an IDE controller. In its smart |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 194da5a4b0d6..fe235b65207e 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
| @@ -663,7 +663,7 @@ typedef struct ide_drive_s ide_drive_t; | |||
| 663 | #define to_ide_device(dev) container_of(dev, ide_drive_t, gendev) | 663 | #define to_ide_device(dev) container_of(dev, ide_drive_t, gendev) |
| 664 | 664 | ||
| 665 | #define to_ide_drv(obj, cont_type) \ | 665 | #define to_ide_drv(obj, cont_type) \ |
| 666 | container_of(obj, struct cont_type, kref) | 666 | container_of(obj, struct cont_type, dev) |
| 667 | 667 | ||
| 668 | #define ide_drv_g(disk, cont_type) \ | 668 | #define ide_drv_g(disk, cont_type) \ |
| 669 | container_of((disk)->private_data, struct cont_type, driver) | 669 | container_of((disk)->private_data, struct cont_type, driver) |
