static DEFINE_SPINLOCK(list_lock);
static LIST_HEAD(scsi_dh_list);
-static struct scsi_device_handler *get_device_handler(const char *name)
+static struct scsi_device_handler *__scsi_dh_lookup(const char *name)
{
struct scsi_device_handler *tmp, *found = NULL;
return found;
}
+static struct scsi_device_handler *scsi_dh_lookup(const char *name)
+{
+ struct scsi_device_handler *dh;
+
+ dh = __scsi_dh_lookup(name);
+ if (!dh) {
+ request_module(name);
+ dh = __scsi_dh_lookup(name);
+ }
+
+ return dh;
+}
+
/*
* device_handler_match_function - Match a device handler to a device
* @sdev - SCSI device to be tested
/*
* Attach to a device handler
*/
- if (!(scsi_dh = get_device_handler(buf)))
+ scsi_dh = scsi_dh_lookup(buf);
+ if (!scsi_dh)
return err;
err = scsi_dh_handler_attach(sdev, scsi_dh);
} else {
*/
int scsi_register_device_handler(struct scsi_device_handler *scsi_dh)
{
-
- if (get_device_handler(scsi_dh->name))
+ if (__scsi_dh_lookup(scsi_dh->name))
return -EBUSY;
if (!scsi_dh->attach || !scsi_dh->detach)
int scsi_unregister_device_handler(struct scsi_device_handler *scsi_dh)
{
- if (!get_device_handler(scsi_dh->name))
+ if (!__scsi_dh_lookup(scsi_dh->name))
return -ENODEV;
bus_for_each_dev(&scsi_bus_type, NULL, scsi_dh,
}
EXPORT_SYMBOL_GPL(scsi_dh_set_params);
-/*
- * scsi_dh_handler_exist - Return TRUE(1) if a device handler exists for
- * the given name. FALSE(0) otherwise.
- * @name - name of the device handler.
- */
-int scsi_dh_handler_exist(const char *name)
-{
- return (get_device_handler(name) != NULL);
-}
-EXPORT_SYMBOL_GPL(scsi_dh_handler_exist);
-
/*
* scsi_dh_attach - Attach device handler
* @q - Request queue that is associated with the scsi_device
struct scsi_device_handler *scsi_dh;
int err = 0;
- scsi_dh = get_device_handler(name);
+ scsi_dh = scsi_dh_lookup(name);
if (!scsi_dh)
return -EINVAL;
};
#if defined(CONFIG_SCSI_DH) || defined(CONFIG_SCSI_DH_MODULE)
extern int scsi_dh_activate(struct request_queue *, activate_complete, void *);
-extern int scsi_dh_handler_exist(const char *);
extern int scsi_dh_attach(struct request_queue *, const char *);
extern const char *scsi_dh_attached_handler_name(struct request_queue *, gfp_t);
extern int scsi_dh_set_params(struct request_queue *, const char *);
fn(data, 0);
return 0;
}
-static inline int scsi_dh_handler_exist(const char *name)
-{
- return 0;
-}
static inline int scsi_dh_attach(struct request_queue *req, const char *name)
{
return SCSI_DH_NOSYS;