case SCSI_DH_RES_TEMP_UNAVAIL:
ret = -EAGAIN;
break;
+ case SCSI_DH_DEV_UNSUPP:
+ case SCSI_DH_NOSYS:
+ ret = -ENODEV;
+ break;
default:
ret = -EINVAL;
break;
}
- sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n",
- scsi_dh->name, error);
+ if (ret != -ENODEV)
+ sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n",
+ scsi_dh->name, error);
module_put(scsi_dh->module);
} else
sdev->handler = scsi_dh;
module_put(sdev->handler->module);
}
-int scsi_dh_add_device(struct scsi_device *sdev)
+void scsi_dh_add_device(struct scsi_device *sdev)
{
struct scsi_device_handler *devinfo = NULL;
const char *drv;
- int err = 0;
drv = scsi_dh_find_driver(sdev);
if (drv)
devinfo = __scsi_dh_lookup(drv);
+ /*
+ * device_handler is optional, so ignore errors
+ * from scsi_dh_handler_attach()
+ */
if (devinfo)
- err = scsi_dh_handler_attach(sdev, devinfo);
- return err;
+ (void)scsi_dh_handler_attach(sdev, devinfo);
}
void scsi_dh_release_device(struct scsi_device *sdev)
/* scsi_dh.c */
#ifdef CONFIG_SCSI_DH
-int scsi_dh_add_device(struct scsi_device *sdev);
+void scsi_dh_add_device(struct scsi_device *sdev);
void scsi_dh_release_device(struct scsi_device *sdev);
#else
-static inline int scsi_dh_add_device(struct scsi_device *sdev) { return 0; }
+static inline void scsi_dh_add_device(struct scsi_device *sdev) { }
static inline void scsi_dh_release_device(struct scsi_device *sdev) { }
#endif
static inline void scsi_dh_remove_device(struct scsi_device *sdev) { }
scsi_autopm_get_device(sdev);
- error = scsi_dh_add_device(sdev);
- if (error)
- /*
- * device_handler is optional, so any error can be ignored
- */
- sdev_printk(KERN_INFO, sdev,
- "failed to add device handler: %d\n", error);
+ scsi_dh_add_device(sdev);
error = device_add(&sdev->sdev_gendev);
if (error) {