X-Git-Url: http://git.agner.ch/gitweb/?a=blobdiff_plain;f=drivers%2Fide%2Fide-proc.c;h=30a5780f4185a7e6c4fe6ac65c79df25d822357c;hb=7baca6ad0ef09c8a78d798c93a3ce25336e8f50f;hp=c12f1b71e934fcdd23b349dc309bef0a09053941;hpb=c4e00fac42f268ed0a547cdd1d12bb8399864040;p=linux-drm-fsl-dcu.git diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index c12f1b71e934..30a5780f4185 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c @@ -326,15 +326,24 @@ static int ide_replace_subdriver(ide_drive_t *drive, const char *driver) { struct device *dev = &drive->gendev; int ret = 1; + int err; down_write(&dev->bus->subsys.rwsem); device_release_driver(dev); /* FIXME: device can still be in use by previous driver */ strlcpy(drive->driver_req, driver, sizeof(drive->driver_req)); - device_attach(dev); + err = device_attach(dev); + if (err < 0) + printk(KERN_WARNING "IDE: %s: device_attach error: %d\n", + __FUNCTION__, err); drive->driver_req[0] = 0; - if (dev->driver == NULL) - device_attach(dev); + if (dev->driver == NULL) { + err = device_attach(dev); + if (err < 0) + printk(KERN_WARNING + "IDE: %s: device_attach(2) error: %d\n", + __FUNCTION__, err); + } if (dev->driver && !strcmp(dev->driver->name, driver)) ret = 0; up_write(&dev->bus->subsys.rwsem); @@ -376,6 +385,8 @@ static int proc_ide_read_media break; case ide_floppy:media = "floppy\n"; break; + case ide_optical:media = "optical\n"; + break; default: media = "UNKNOWN\n"; break; } @@ -402,7 +413,6 @@ void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p, void while (p->name != NULL) { ent = create_proc_entry(p->name, p->mode, dir); if (!ent) return; - ent->nlink = 1; ent->data = data; ent->read_proc = p->read_proc; ent->write_proc = p->write_proc; @@ -524,7 +534,12 @@ static int proc_print_driver(struct device_driver *drv, void *data) static int ide_drivers_show(struct seq_file *s, void *p) { - bus_for_each_drv(&ide_bus_type, NULL, s, proc_print_driver); + int err; + + err = bus_for_each_drv(&ide_bus_type, NULL, s, proc_print_driver); + if (err < 0) + printk(KERN_WARNING "IDE: %s: bus_for_each_drv error: %d\n", + __FUNCTION__, err); return 0; } @@ -533,7 +548,7 @@ static int ide_drivers_open(struct inode *inode, struct file *file) return single_open(file, &ide_drivers_show, NULL); } -static struct file_operations ide_drivers_operations = { +static const struct file_operations ide_drivers_operations = { .open = ide_drivers_open, .read = seq_read, .llseek = seq_lseek,